Class EnumUtil
- java.lang.Object
-
- com.github.toolarium.enumeration.configuration.util.EnumUtil
-
public final class EnumUtil extends java.lang.Object
Enum utility
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends java.lang.Enum<T>>
EnumKeyConfigurationgetEnumKeyConfigurationAnnotationInformation(T e)
Get theEnumKeyConfiguration
from an enumeration configurationEnumKeyValueConfiguration
getEnumKeyValueConfigurationAnnotationInformation(java.lang.Enum<?> e)
Get theEnumKeyValueConfiguration
from an enumeration configurationstatic EnumUtil
getInstance()
Get the instance<T extends java.lang.Enum<T>>
TmapEnum(java.lang.Class<T> enumType, java.lang.Enum<?> inputEnum)
Returns the enum constant of the specified enum type with the specified name.<T extends java.lang.Enum<T>>
TvalueOf(java.lang.Class<T> enumType, java.lang.String name)
Returns the enum constant of the specified enum type with the specified name.
-
-
-
Method Detail
-
getInstance
public static EnumUtil getInstance()
Get the instance- Returns:
- the instance
-
getEnumKeyConfigurationAnnotationInformation
public <T extends java.lang.Enum<T>> EnumKeyConfiguration getEnumKeyConfigurationAnnotationInformation(T e) throws java.lang.IllegalArgumentException
Get theEnumKeyConfiguration
from an enumeration configuration- Type Parameters:
T
- the generic type- Parameters:
e
- the enumeration value- Returns:
- the parsed content
- Throws:
java.lang.IllegalArgumentException
- In case the annotation could not be resolved
-
getEnumKeyValueConfigurationAnnotationInformation
public EnumKeyValueConfiguration getEnumKeyValueConfigurationAnnotationInformation(java.lang.Enum<?> e) throws java.lang.IllegalArgumentException
Get theEnumKeyValueConfiguration
from an enumeration configuration- Parameters:
e
- the enumeration value- Returns:
- the parsed content
- Throws:
java.lang.IllegalArgumentException
- In case the annotation could not be resolved
-
valueOf
public <T extends java.lang.Enum<T>> T valueOf(java.lang.Class<T> enumType, java.lang.String name)
Returns the enum constant of the specified enum type with the specified name. The name must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Type Parameters:
T
- the type- Parameters:
enumType
- the Class object of the enum type from which to return a constantname
- the name of the constant to return- Returns:
- the enum constant of the specified enum type with the specified name
-
mapEnum
public <T extends java.lang.Enum<T>> T mapEnum(java.lang.Class<T> enumType, java.lang.Enum<?> inputEnum)
Returns the enum constant of the specified enum type with the specified name. The name must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Type Parameters:
T
- the type- Parameters:
enumType
- the Class object of the enum type from which to return a constantinputEnum
- the input enum to map- Returns:
- the enum constant of the specified enum type with the specified name
-
-