Liefert den enum-Type fuer den angegebenen Wert.

@param type  der Type. "pain", "camt".
@param value der Wert. 001, 002, 008, ....
@return der zugehoerige Enum-Wert.
@throws IllegalArgumentException wenn der Typ unbekannt ist.
359919
private static Type findType(String type, String value) throws IllegalArgumentException {
        if (type == null || type.length() == 0)
            throw new IllegalArgumentException("no SEPA type type given");

        if (value == null || value.length() == 0)
            throw new IllegalArgumentException("no SEPA version value given");

        for (Type t : Type.values()) {
            if (t.getType().equalsIgnoreCase(type) && t.getValue().equals(value))
                return t;
        }
        throw new IllegalArgumentException("unknown SEPA version type: " + type + "." + value);
    }
1273727
@SuppressWarnings({"unchecked", "rawtypes"})
    public U encode(Object value) {
        requireNonNull(value, "Value for encoding can not be null");

        TypeEncoder encoder = classMapping.get(value.getClass());
        if (encoder != null)
            return (U) encoder.encode(value);

        throw new TypeEncodingException("An unknown type [" + value.getClass() + "] was encountered");
    }
1144975
public static String format(Object value, Type type) {
        value = decode(value, type);
        switch (type.getTag()) {
        case BYTE:      return formatByte((Byte) value);
        case LONG:      return formatLong((Long) value);
        case FLOAT:     return formatFloat((Float) value);
        case DOUBLE:    return formatDouble((Double) value);
        case CHAR:      return formatChar((Character) value);
        }
        if (value instanceof String)
            return formatString((String) value);
        return value + "";
    }
58869
public static <T extends Enum<T>> T enuum(Class<T> enumClass, String value) {
		List<Enum> values = (List<Enum>) EnumUtils.valueList(enumClass);
		for (Enum enumValue : values) {
			if (enumValue.name().equalsIgnoreCase(value)) {
				return (T) enumValue;
			}
		}
		return InvalidValues.createInvalidEnum(enumClass, value);
	}
696725
private function isType(string $type, $value)
    {
        switch ($type) {
            case 'bool':
                return is_bool($value);

            case 'int':
                return is_int($value);

            case 'float':
                return is_float($value) || is_int($value);

            case 'string':
                return is_string($value);

            case 'array':
                return is_array($value);

            default:
                throw new InvalidParamsException('Type match error');
        }
    }
643205
protected static <E extends Enum<E> & ByteEnum> int toIntFlag (E value)
    {
        byte code = value.toByte(); // allow this to throw NPE
        if (code < 0 || code > 31) {
            throw new IllegalArgumentException(
                "ByteEnum code is outside the range that can be turned into an int " +
                "[value=" + value + ", code=" + code + "]");
        }
        return (1 << code);
    }
1195996
public static String enumToString(final Enum<?> value) {

    if (value == null) {
      return null;
    }

    final String underscored = value.name();

    final StringBuilder sb = new StringBuilder();
    for (int i = 0; i < underscored.length(); i++) {
      final char c = underscored.charAt(i);
      if (c == '_') {
        sb.append(Character.toUpperCase(underscored.charAt(++i)));
      } else {
        sb.append(Character.toLowerCase(c));
      }
    }
    return sb.toString();
  }
315673
private Comparable<?>  getValue(String value, int type)
   {
      switch (type)
      {
         case PropertyType.BOOLEAN :
            return ComparableBoolean.valueOf(Boolean.valueOf(value).booleanValue());
         case PropertyType.DATE :
            return new Long(DateField.stringToTime(value));
         case PropertyType.LONG :
            return new Long(LongField.stringToLong(value));
         case PropertyType.DOUBLE :
            return new Double(DoubleField.stringToDouble(value));
         default :
            return value;
      }
   }
309192
private function checkType($type, $value)
    {        
        switch($type)
        {
            case 'bool':
            case 'boolean':
                $codeException = (!is_bool($value)) ? 1 : 0;
                break;
            case 'int':
            case 'integer':
                $codeException = (!is_int($value)) ? 1 : 0;
                break;
            case 'string':
                $codeException = (!is_string($value)) ? 1 : 0;
                break;
            case 'not_resource':
                $codeException = (is_resource($value)) ? 2 : 0;
                break;
            default :
                $codeException = 3;
                break;
        }
        
        return $codeException;
    }
1143296
protected function verifyCorrectType($type, $value)
    {
        // Switch various types
        switch ($type) {
            case 'string':
                if (!is_string($value)) {
                    throw new SetterGetterException('String type expected', 3);
                }
                break;

            case 'number':
                if (!is_numeric($value)) {
                    throw new SetterGetterException('Number type expected', 4);
                }
                break;

            case 'array':
                if (!is_array($value)) {
                    throw new SetterGetterException('Array type expected', 5);
                }
                break;

            case 'object':
                if (!is_object($value)) {
                    throw new SetterGetterException('Object type expected.', 6);
                }
                break;

            default:
                // If a @var type is given in annotation and we haven't received
                // proper type.
                if (!is_null($type) && !$value instanceof $type) {
                    throw new SetterGetterException('Instance of ' . $type . ' expected.', 7);
                }
                break;
        }
    }
234711
function checkType($value)
    {
        if( $this->type !== null ) {
            // check type constraints
            if( $this->isTypeInteger() ) {
                if( ! is_numeric($value) )
                    throw new NonNumericException;
                $value = (int) $value;
            }
        }
        return $value;
    }
1155531
private static Object transformType(Object value) {
    if (value == null) {
      return null;
    }
    String valueString = value.toString();

    // check for boolean
    boolean boolValue = BooleanUtils.toBoolean(valueString);
    if (StringUtils.equals(valueString, Boolean.toString(boolValue))) {
      return boolValue;
    }

    // check for integer
    int intValue = NumberUtils.toInt(valueString);
    if (StringUtils.equals(valueString, Integer.toString(intValue))) {
      return intValue;
    }

    return value;
  }
1069832
private String getDataType(final Value value) {
        if (value instanceof BigDecimalValue) {
            return DataType.TYPE_NUMERIC_BIGDECIMAL;
        } else if (value instanceof BigIntegerValue) {
            return DataType.TYPE_NUMERIC_BIGINTEGER;
        } else if (value instanceof BooleanValue) {
            return DataType.TYPE_BOOLEAN;
        } else if (value instanceof ByteValue) {
            return DataType.TYPE_NUMERIC_BYTE;
        } else if (value instanceof DateValue) {
            return DataType.TYPE_DATE;
        } else if (value instanceof DoubleValue) {
            return DataType.TYPE_NUMERIC_DOUBLE;
        } else if (value instanceof FloatValue) {
            return DataType.TYPE_NUMERIC_FLOAT;
        } else if (value instanceof IntegerValue) {
            return DataType.TYPE_NUMERIC_INTEGER;
        } else if (value instanceof LongValue) {
            return DataType.TYPE_NUMERIC_LONG;
        } else if (value instanceof ShortValue) {
            return DataType.TYPE_NUMERIC_SHORT;
        } else if (value instanceof EnumValue) {
            return DataType.TYPE_COMPARABLE;
        }

        return DataType.TYPE_STRING;
    }
778033
public long value() {
        switch (type) {
        case AVERAGE:
            return numPoints != 0 ? value / numPoints : 0;
        case NONE:
            return 0;
        case MAXIMUM:
        case MINIMUM:
        case SUM:
            return value;
        default:
            throw new IllegalStateException("Unknown type [" + type + "]!");
        }
    }
929098
public static <T extends Enum<?>> T enumFromString(final String value, final T[] values) {
        if (value == null) {
            return null;
        }

        for (T v : values) {
            if (v.toString().equalsIgnoreCase(value)) {
                return v;
            }
        }

        return null;
    }
1182616
public static boolean checkValueIsType(Object value, Object name, Class type) {
        if (value != null) {
            if (type.isAssignableFrom(value.getClass())) {
                return true;
            } else {
                throw new RuntimeException("The value argument of '" + name + "' must be of type "
                        + type.getName() + ". Found: " + value.getClass());
            }
        } else {
            return false;
        }
    }
852517
@SuppressWarnings("unchecked")
  public static <E extends Enum<E> & NumberedValue> Option<E> valueOf(final Class<E> type, int number) {
    checkNotNull(type);
    E value = (E) mappings.getUnchecked(type).get(number);
    return Option.of(value);
  }