Class EnumUtils

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

public class EnumUtils extends Object
Utilities for Java Enum classes.
Since:
v3.2.20
  • 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, 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