com.atlassian.plugin.util
Class EnumUtils

java.lang.Object
  extended by com.atlassian.plugin.util.EnumUtils

public class EnumUtils
extends Object

Utilities for Java Enum classes.

Since:
v3.2.20

Constructor Summary
EnumUtils()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumUtils

public EnumUtils()
Method Detail

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, usually E.values().
defaultValue - the value to default to if the property is unset or does not match E.name() for some element of values.
Returns:
the corresponding enum value if the property is set and recognized, or defaultValue otherwise.
Since:
v3.2.20


Copyright © 2015 Atlassian. All rights reserved.