List of utility methods to do String Value Of
T | valueOf(Class value Of try { return Enum.valueOf(cls, s); } catch (IllegalArgumentException e) { s = s.toLowerCase(); T theOne = null; for (T value : cls.getEnumConstants()) { if (value.toString().toLowerCase().startsWith(s)) { ... |
T | valueOf(Class Gets the value of an enum from a name. if (name == null) return null; try { return Enum.valueOf(en, name); } catch (IllegalArgumentException e) { return null; |
T | valueOf(Class This works like Enum#valueOf(Class,String) but returns null if constant wasn't found instead of throwing an IllegalArgumentException .
try { T constant = Enum.valueOf(enumType, constantName); return constant; } catch (IllegalArgumentException ex) { return null; |
T | valueOf(Class value Of return valueOf(enumType, name, null);
|
T | valueOf(Class value Of return valueOf(enumType, name, null);
|
T | valueOf(Class Null-safe valueOf function if (name == null) { return null; return Enum.valueOf(enumType, name); |
T | valueOf(Class value Of try { return Enum.<T>valueOf(enumType, name); } catch (Exception e) { return defaultValue; |
Enum> | valueOf(final Class> enumType, final String value) Convert a string to an enum. return Enum.valueOf((Class<Enum>) enumType, value);
|
Object | valueOf(final Class> type, final String value) Convert a string value to a boxed primitive type. if (type == String.class) { return value; if (type == boolean.class) { return Boolean.valueOf(value); if (type == int.class) { return Integer.valueOf(value); ... |
E | valueOf(final Class value Of if (clazz == null) { return null; final E[] es = clazz.getEnumConstants(); for (final E e : es) { if (e.name().equalsIgnoreCase(name)) { return e; return null; |