Get a Range object from a header value
@param value the header value
@return the Range object or null if the value is not parseable
544049
public static Range valueOf(final String value) {
        final Optional<Integer[]> vals = parse(value);
        if (vals.isPresent()) {
            return new Range(vals.get()[0], vals.get()[1]);
        }
        return null;
    }
1266410
public static MessageBody fromValueData(Object value)
    {
    	if(value == null)
    	{
    		throw new IllegalArgumentException("Value data is null.");
    	}
    	
    	MessageBody body = new MessageBody();
    	body.bodyType = MessageBodyType.VALUE;
    	body.valueData = value;
    	body.sequenceData = null;
    	body.binaryData = null;
    	return body;
    }
1105397
@Override
    public String convertTo(final Object value) {
        if (value == null) return "null";
        return convertTo(value.getClass(), value);
    }
937881
public function getValue(): ?Range
	{
		if (!empty($this->value)) {
			$result = new Range;
			@list($from, $to) = explode($this->delimiter, $this->value);

			if ($from && $to) {
				$result->from = DateTime::createFromFormat($this->format, $from);
				$result->to = DateTime::createFromFormat($this->format, $to);
				return $result;
			}
		}
		return null;
	}
1178141
public static Object getValue(Object obj, String field) {
        Method getter = getGetterMethod(obj.getClass(), field);

        try {
            return getter.invoke(obj);
        } catch (IllegalAccessException | InvocationTargetException e) {
            return null;
        }
    }
403357
public Node<T> get(long value) {
    	if (root == null) return null;
    	if (value == first.value) return first;
    	if (value == last.value) return last;
    	if (value < first.value) return null;
    	if (value > last.value) return null;
    	return get(root, value);
    }
422751
@Override
    public ValueRange range(TemporalField field) {
        if (field instanceof ChronoField) {
            if (field == INSTANT_SECONDS || field == OFFSET_SECONDS) {
                return field.range();
            }
            return toLocalDateTime().range(field);
        }
        return field.rangeRefinedBy(this);
    }
1009831
public <T> T convert(String value, Class<T> to) {
        if (Strings.isEmpty(value) && !(String.class.equals(to) || String[].class.equals(to))) {
            return null;
        }

        if (String.class.equals(to)) {
            return to.cast(value);
        } else if (Integer.class.equals(to)) {
            return to.cast(Integer.valueOf(value));
        } else if (Double.class.equals(to)) {
            return to.cast(Double.valueOf(value));
        } else if (Long.class.equals(to)) {
            return to.cast(Long.valueOf(value));
        } else if (Boolean.class.equals(to)) {
            return to.cast(Boolean.valueOf(value));
        } else if (URL.class.equals(to)) {
            try {
                return to.cast(new URI(value).toURL());
            } catch (MalformedURLException e) {
                throw new IllegalArgumentException("Unable to convert value " + value + " to URL", e);
            } catch (URISyntaxException e) {
                throw new IllegalArgumentException("Unable to convert value " + value + " to URL", e);
            }
        } else if (URI.class.equals(to)) {
            try {
                return to.cast(new URI(value));
            } catch (URISyntaxException e) {
                throw new IllegalArgumentException("Unable to convert value " + value + " to URL", e);
            }
        } else {
            String trimmedValue = extractEnumName(value);
            if (to.isEnum()) {
                return (T) Enum.valueOf((Class<Enum>) to, trimmedValue.toUpperCase());
            } else if (String[].class.equals(to)) {
                final String[] convertedArray = value.split(",");
                if (convertedArray.length == 0) {
                    return to.cast(new String[0]);
                }

                trimElements(convertedArray);

                if (convertedArray.length == 1 && hasOnlyBlanks(convertedArray)) {
                    return to.cast(new String[0]);
                }

                return to.cast(convertedArray);
            } else if (Charset.class.equals(to)) {
                return to.cast(Charset.forName(trimmedValue.toUpperCase()));
            } else if (Class.class.equals(to)) {
                try {
                    Object clazz = Class.forName(value);
                    return to.cast(clazz);
                } catch (Exception e) {
                    throw new IllegalArgumentException("Unable to find class [" + value + "].", e);
                }
            } else // Try to create instance via reflection
            {
                try {
                    Object instance = Class.forName(value).newInstance();
                    return to.cast(instance);
                } catch (Exception e) {
                    throw new IllegalArgumentException(
                        "Unable to convert value [" + value + "] to a class [" + to.getName() + "].", e);
                }
            }
        }
    }
908705
public int valueToIndex(Object value)
    {
        if (value != null)
            if (!(value instanceof String))
                value = value.toString();
        if ((m_record != null) && (m_strIndexValue != null))
        {
            try   {
                FieldTable table = m_record.getTable();
                for (int iIndex = 0; ; iIndex++)
                {
                    if (table.get(iIndex) == null)  // I use get, so the index matches the index of JComboBox
                        break;
                    FieldInfo field = m_record.getField(m_strIndexValue);
                    if (field == null)
                        field = m_record.getField(0);
                    String strValue = field.getString();
                    if ((strValue != null) && (strValue.length() > 0))
                        if (strValue.equals(value))
                            return iIndex + 1;
                }
            } catch (Exception ex)  {
                ex.printStackTrace();
            }
        }
        else
        {
            this.setSelectedItem(value);
            if (this.getSelectedIndex() != -1)
                return this.getSelectedIndex();
        }
        return 0;
    }
1153922
protected String getHeaderValueText(Object value) {
        if (value == null) {
            return null;
        }

        // TODO: Type conversion based on provided config
        if (value.getClass() == String.class) {
            return (String) value;
        } else if (value instanceof List) {
            List<?> list = (List<?>) value;
            if (list.size() == 1) {
                return getHeaderValueText(list.get(0));
            } else {
                return list.toString();
            }
        }

        return null;
    }
1113616
public static ConstraintField getInstance(int value)
   {
      ConstraintField result = null;

      if (value >= 0 && value < FIELD_ARRAY.length)
      {
         result = FIELD_ARRAY[value];
      }

      return (result);
   }
292214
public final hqlParser.fromRange_return fromRange() throws RecognitionException {
		hqlParser.fromRange_return retval = new hqlParser.fromRange_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		ParserRuleReturnScope fromClassOrOuterQueryPath88 =null;
		ParserRuleReturnScope inClassDeclaration89 =null;
		ParserRuleReturnScope inCollectionDeclaration90 =null;
		ParserRuleReturnScope inCollectionElementsDeclaration91 =null;


		try {
			// hql.g:289:2: ( fromClassOrOuterQueryPath | inClassDeclaration | inCollectionDeclaration | inCollectionElementsDeclaration )
			int alt33=4;
			switch ( input.LA(1) ) {
			case IDENT:
				{
				int LA33_1 = input.LA(2);
				if ( (LA33_1==EOF||LA33_1==AS||LA33_1==CLOSE||LA33_1==COMMA||LA33_1==DOT||LA33_1==FETCH||LA33_1==FULL||LA33_1==GROUP||LA33_1==HAVING||LA33_1==IDENT||LA33_1==INNER||LA33_1==JOIN||LA33_1==LEFT||LA33_1==ORDER||LA33_1==RIGHT||LA33_1==SKIP||LA33_1==TAKE||LA33_1==UNION||LA33_1==WHERE) ) {
					alt33=1;
				}
				else if ( (LA33_1==IN) ) {
					int LA33_5 = input.LA(3);
					if ( (LA33_5==ELEMENTS) ) {
						alt33=4;
					}
					else if ( (LA33_5==CLASS||LA33_5==IDENT) ) {
						alt33=2;
					}

					else {
						int nvaeMark = input.mark();
						try {
							for (int nvaeConsume = 0; nvaeConsume < 3 - 1; nvaeConsume++) {
								input.consume();
							}
							NoViableAltException nvae =
								new NoViableAltException("", 33, 5, input);
							throw nvae;
						} finally {
							input.rewind(nvaeMark);
						}
					}

				}

				else {
					int nvaeMark = input.mark();
					try {
						input.consume();
						NoViableAltException nvae =
							new NoViableAltException("", 33, 1, input);
						throw nvae;
					} finally {
						input.rewind(nvaeMark);
					}
				}

				}
				break;
			case IN:
				{
				alt33=3;
				}
				break;
			case ELEMENTS:
				{
				alt33=4;
				}
				break;
			default:
				NoViableAltException nvae =
					new NoViableAltException("", 33, 0, input);
				throw nvae;
			}
			switch (alt33) {
				case 1 :
					// hql.g:289:4: fromClassOrOuterQueryPath
					{
					root_0 = (CommonTree)adaptor.nil();


					pushFollow(FOLLOW_fromClassOrOuterQueryPath_in_fromRange1302);
					fromClassOrOuterQueryPath88=fromClassOrOuterQueryPath();
					state._fsp--;

					adaptor.addChild(root_0, fromClassOrOuterQueryPath88.getTree());

					}
					break;
				case 2 :
					// hql.g:290:4: inClassDeclaration
					{
					root_0 = (CommonTree)adaptor.nil();


					pushFollow(FOLLOW_inClassDeclaration_in_fromRange1307);
					inClassDeclaration89=inClassDeclaration();
					state._fsp--;

					adaptor.addChild(root_0, inClassDeclaration89.getTree());

					}
					break;
				case 3 :
					// hql.g:291:4: inCollectionDeclaration
					{
					root_0 = (CommonTree)adaptor.nil();


					pushFollow(FOLLOW_inCollectionDeclaration_in_fromRange1312);
					inCollectionDeclaration90=inCollectionDeclaration();
					state._fsp--;

					adaptor.addChild(root_0, inCollectionDeclaration90.getTree());

					}
					break;
				case 4 :
					// hql.g:292:4: inCollectionElementsDeclaration
					{
					root_0 = (CommonTree)adaptor.nil();


					pushFollow(FOLLOW_inCollectionElementsDeclaration_in_fromRange1317);
					inCollectionElementsDeclaration91=inCollectionElementsDeclaration();
					state._fsp--;

					adaptor.addChild(root_0, inCollectionElementsDeclaration91.getTree());

					}
					break;

			}
			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}
		catch (RecognitionException re) {
			reportError(re);
			recover(input,re);
			retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
		}
		finally {
			// do for sure before leaving
		}
		return retval;
	}
1276064
private boolean isWithinRange(T value) {
        if (getMinInclusive() != null
                && compareTo(getMinInclusive(), value) > 0) {
            return false;
        }
        if (getMaxInclusive() != null
                && compareTo(getMaxInclusive(), value) < 0) {
            return false;
        }
        return true;
    }
130966
protected Object getDataValue(Trace trace, Node node, Direction direction, Map<String, ?> headers,
            Object[] values) {
        if (source == DataSource.Content) {
            return values[index];
        } else if (source == DataSource.Header) {
            return headers.get(key);
        }
        return null;
    }
268036
@SuppressWarnings("unchecked")
    @InternalFunction(operator=">", precedence=10)
    public Boolean gt(Object value, Object value2)
    {
        if (value2 != null && value2 instanceof Comparable)
        {
            @SuppressWarnings("rawtypes")
			final int ret = ((Comparable)value2).compareTo(value);
            return (ret > 0); 
        }
        return null;
    }
429130
public static PagingParams fromValue(Object value) {
		if (value instanceof PagingParams)
			return (PagingParams) value;

		AnyValueMap map = AnyValueMap.fromValue(value);
		return PagingParams.fromMap(map);
	}
916747
public String getHeaderValue(final String headerName) {
     if (headerName == null) { return null; }
     return request.headers().get(headerName);
   }