public class EnumUtils extends Object
Constructor and Description |
---|
EnumUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
camelCase(String s)
Converts the string value to a camel case string.
|
static String |
enumJsonName(Enum<?> e)
Converts the enum value to a camel case string.
|
static <T extends Enum<T>> |
forKey(int key,
Map<Integer,T> mapping,
Class<T> enumeration)
Boilerplate method to retrieve an enum method via an arbitrary key, rather than just the enum value.
|
static <T extends Enum<T>> |
forKey(String key,
Map<String,T> mapping,
Class<T> enumeration)
Boilerplate method to retrieve an enum method via an arbitrary key, rather than just the enum value.
|
public static <T extends Enum<T>> T forKey(String key, Map<String,T> mapping, Class<T> enumeration)
T
- Enum we are getting the value by key forkey
- Key to get the enum value formapping
- Mapping to use to look up the value by keyenumeration
- Enum we are getting value by key for (needed due to type erasure)IllegalArgumentException
- if this enum type has no constant with the specified namepublic static <T extends Enum<T>> T forKey(int key, Map<Integer,T> mapping, Class<T> enumeration)
T
- Enum we are getting the value by key forkey
- Key to get the enum value formapping
- Mapping to use to look up the value by keyenumeration
- Enum we are getting value by key for (needed due to type erasure)IllegalArgumentException
- if this enum type has no constant with the specified namepublic static String enumJsonName(Enum<?> e)
e
- enumCopyright © 2016–2018 Yahoo! Inc.. All rights reserved.