Interface EnumeratedValue


public interface EnumeratedValue
A configuration option with a fixed set of possible values, i.e. an enum. To be implemented by any enum types used with
invalid reference
ConfigBuilder
.
Author:
Brendan Maguire
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the string representation of this value
    default boolean
    matches(String value)
    Determine whether this enumerated option matches the supplied value.
    static <T extends Enum<T> & EnumeratedValue>
    T
    parse(Class<T> enumType, String value)
    Parse the supplied value into the matching enum constant.
    static <T extends Enum<T> & EnumeratedValue>
    T
    parse(Class<T> enumType, String value, String defaultValue)
    Parse the supplied value into the matching enum constant, falling back to the supplied default value.
  • Method Details

    • getValue

      String getValue()
      Returns the string representation of this value
      Returns:
      The string representation of this value
    • matches

      default boolean matches(String value)
      Determine whether this enumerated option matches the supplied value.
      Parameters:
      value - the value to compare; may be null
      Returns:
      true when the value matches this option
    • parse

      static <T extends Enum<T> & EnumeratedValue> T parse(Class<T> enumType, String value)
      Parse the supplied value into the matching enum constant.
      Type Parameters:
      T - enum type
      Parameters:
      enumType - the enum type to parse
      value - the supplied value
      Returns:
      the matching enum value
    • parse

      static <T extends Enum<T> & EnumeratedValue> T parse(Class<T> enumType, String value, String defaultValue)
      Parse the supplied value into the matching enum constant, falling back to the supplied default value.
      Type Parameters:
      T - enum type
      Parameters:
      enumType - the enum type to parse
      value - the supplied value
      defaultValue - the default value string
      Returns:
      the matching enum value
      Throws:
      IllegalArgumentException - if no match can be found