Class EnumNames<T extends Enum<T> & NamedEnum>

  • Type Parameters:
    T - the type of the enum

    public final class EnumNames<T extends Enum<T> & NamedEnum>
    extends Object
    Helper that allows enum names to be created and parsed.
    • Method Detail

      • of

        public static <T extends Enum<T> & NamedEnumEnumNames<T> of​(Class<T> enumType)
        Creates an instance deriving the formatted string from the enum constant name.
        Type Parameters:
        T - the type of the enum
        Parameters:
        enumType - the type of the enum
        Returns:
        the names instance
      • ofManualToString

        public static <T extends Enum<T> & NamedEnumEnumNames<T> ofManualToString​(Class<T> enumType)
        Creates an instance where the toString method is written manually.

        The toString method is called to extract the correct formatted string.

        Type Parameters:
        T - the type of the enum
        Parameters:
        enumType - the type of the enum
        Returns:
        the names instance
      • withParseAlias

        public EnumNames<T> withParseAlias​(String alias,
                                           T value)
        Returns an instance with an additional alias added.
        Parameters:
        alias - the string of the alias
        value - the enum value that the alias represents
        Returns:
        the converted name
      • format

        public String format​(T value)
        Creates a standard Strata mixed case name from an enum-style constant.
        Parameters:
        value - the enum value to convert
        Returns:
        the converted name
      • parse

        public T parse​(String name)
        Parses the standard external name for an enum.
        Parameters:
        name - the external name
        Returns:
        the enum value