String
This class supports multiple types of identification of enumeration constants. For example, you can match the literal (Enum#name() the ordinal (Enum#ordinal() or
the result of a method defined in your enumeration.
The reverse conversion from an enumeration to String (in EnumConversion#revert(Enum) will return a String using the first EnumSelector provided in the constructor of this class.
ObjectConversion, EnumSelector
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final Field | |
| private final Method | |
| private final Class | |
| private final EnumSelector[] |
| Access | Constructor and Description |
|---|---|
| public | EnumConversion(Class<T>
the enumeration type to be converted from/to enumType)StringDefines a conversion for an enumeration type that will attempt to match Strings against
the results of the output produced by ( |
| public | EnumConversion(Class<T>
the enumeration type to be converted from/to enumType, EnumSelector... Stringthe selection elements of the enumeration to use for matching selectors)Strings.Defines a conversion for an enumeration type that will attempt to match Strings the list of |
| public | EnumConversion(Class<T>
the enumeration type to be converted from/to enumType, String Stringname of custom element of the enumeration (attribute or method) whose values should be used to match equivalent customEnumElement, EnumSelector... Strings.the selection elements of the enumeration to use for matching selectors)Strings.Defines a conversion for an enumeration type that will attempt to match Strings the list of |
| public | EnumConversion(Class<T>
the enumeration type to be converted from/to enumType, T Stringthe default enumeration constant to use if the input valueIfStringIsNull, String String is nullthe default valueIfEnumIsNull, String String value to use if the input enum constant is nullname of custom element of the enumeration (attribute or method) whose values should be used to match equivalent customEnumElement, EnumSelector... Strings.the selection elements of the enumeration to use for matching selectors)Strings.Defines a conversion for an enumeration type that will attempt to match Strings the list of |
| Modifier and Type | Method and Description |
|---|---|
| protected T | fromString(String
The String to be converted to T input)Implements abstract com. |
| private String | |
| private void | |
| public String | revert(T
the input of type T to be converted to a String input)Overrides com. Implements com. This is a general implementation that simply returns the result of input.toString() |
| conversions | back to summary |
|---|---|
| private final Map<String, T>[] conversions | |
| customEnumField | back to summary |
|---|---|
| private final Field customEnumField | |
| customEnumMethod | back to summary |
|---|---|
| private final Method customEnumMethod | |
| enumType | back to summary |
|---|---|
| private final Class<T> enumType | |
| selectors | back to summary |
|---|---|
| private final EnumSelector[] selectors | |
| EnumConversion | back to summary |
|---|---|
| public EnumConversion(Class<T> enumType) Defines a conversion for an enumeration type that will attempt to match Strings against
the results of the output produced by (
| |
| EnumConversion | back to summary |
|---|---|
| public EnumConversion(Class<T> enumType, EnumSelector... selectors) Defines a conversion for an enumeration type that will attempt to match Strings the list of
| |
| EnumConversion | back to summary |
|---|---|
| public EnumConversion(Class<T> enumType, String customEnumElement, EnumSelector... selectors) Defines a conversion for an enumeration type that will attempt to match Strings the list of
| |
| EnumConversion | back to summary |
|---|---|
| public EnumConversion(Class<T> enumType, T valueIfStringIsNull, String valueIfEnumIsNull, String customEnumElement, EnumSelector... selectors) Defines a conversion for an enumeration type that will attempt to match Strings the list of
| |
| fromString | back to summary |
|---|---|
| protected T fromString(String input) Implements abstract com. Doc from com. Creates an instance of T from a String representation. | |
| getKey | back to summary |
|---|---|
| private String getKey(T constant, EnumSelector conversionType) | |
| initializeMappings | back to summary |
|---|---|
| private void initializeMappings(Set<EnumSelector> conversionTypes) | |
| revert | back to summary |
|---|---|
| public String revert(T input) Overrides com. Implements com. Doc from com. Converts a value of type T back to a String This is a general implementation that simply returns the result of input.toString()
| |