Class EnumNames<T extends java.lang.Enum<T> & NamedEnum>

  • Type Parameters:
    T - the type of the enum

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String format​(T value)
      Creates a standard Strata mixed case name from an enum-style constant.
      static <T extends java.lang.Enum<T> & NamedEnum>
      EnumNames<T>
      of​(java.lang.Class<T> enumType)
      Creates an instance deriving the formatted string from the enum constant name.
      static <T extends java.lang.Enum<T> & NamedEnum>
      EnumNames<T>
      ofManualToString​(java.lang.Class<T> enumType)
      Creates an instance where the toString method is written manually.
      T parse​(java.lang.String name)
      Parses the standard external name for an enum.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • of

        public static <T extends java.lang.Enum<T> & NamedEnumEnumNames<T> of​(java.lang.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 java.lang.Enum<T> & NamedEnumEnumNames<T> ofManualToString​(java.lang.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
      • format

        public java.lang.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​(java.lang.String name)
        Parses the standard external name for an enum.
        Parameters:
        name - the external name
        Returns:
        the enum value