Package org.forgerock.openig.util
Class EnumUtil
- java.lang.Object
-
- org.forgerock.openig.util.EnumUtil
-
public final class EnumUtil extends Object
Utility class for accessing Java enum types.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Enum<T>>
Set<String>names(Class<T> enumType)
Returns a set of the names of the enum constants of the specified enum type.static <T extends Enum<T>>
TvalueOf(Class<T> enumType, Object name)
Returns the enum constant of the specified enum type with the specified name.
-
-
-
Method Detail
-
names
public static <T extends Enum<T>> Set<String> names(Class<T> enumType)
Returns a set of the names of the enum constants of the specified enum type. The returned set maintains iteration order of the constants in the order they're declared in the enum type.- Type Parameters:
T
- enumeration type- Parameters:
enumType
- the class of the enum type from which to return the names.- Returns:
- a set of the names of the enum constants in the specified enum.
-
valueOf
public static <T extends Enum<T>> T valueOf(Class<T> enumType, Object name)
Returns the enum constant of the specified enum type with the specified name.- Type Parameters:
T
- enumeration type- Parameters:
enumType
- The class of the enum type from which to return a constant.name
- The name of the constant to return.- Returns:
- The matching enum constant or
IllegalArgumentException
if no match found. - Throws:
IllegalArgumentException
- if no match found.
-
-