Package com.atlassian.plugin.util
Class EnumUtils
java.lang.Object
com.atlassian.plugin.util.EnumUtils
Utilities for Java Enum classes.
- Since:
- v3.2.20
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends Enum<E>>
EenumValueFromProperty(String propertyName, E[] values, E defaultValue) Obtain an enum value by looking up the name in a given property, defaulting if necessary.
-
Constructor Details
-
EnumUtils
public EnumUtils()
-
-
Method Details
-
enumValueFromProperty
public static <E extends Enum<E>> E enumValueFromProperty(String propertyName, E[] values, E defaultValue) Obtain an enum value by looking up the name in a given property, defaulting if necessary.- Parameters:
propertyName- the name of the property containing the stringified enum value.values- the value of the enumeration, usuallyE.values().defaultValue- the value to default to if the property is unset or does not matchE.name()for some element ofvalues.- Returns:
- the corresponding enum value if the property is set and recognized, or
defaultValueotherwise. - Since:
- v3.2.20
-