Class HEnum


  • public final class HEnum
    extends Object
    • Method Detail

      • valueOfInsensitive

        public static <E extends Enum<E>> E valueOfInsensitive​(Class<E> klass,
                                                               String text)
      • valueOf

        public static <E extends Enum<E>,​T> E valueOf​(Class<E> klass,
                                                            IFunction1<? super E,​? extends T> represent,
                                                            boolean ignoreNull,
                                                            IFunction1<? super T,​? extends T> mangle,
                                                            T value)
        Determine which member of an enum matches value.
        Type Parameters:
        E - The enum type.
        T - The value type, and the type used to represent enum elements (e.g. String)
        Parameters:
        klass - The enum type.
        represent - A function to convert enum members to the representation on which we'll try to match them.
        ignoreNull - Should enum members whose representation is null be ignored? If so, those members will never be returned by this method.
        mangle - A function to mangle representations, both generated by represent and the text. Can be used to implement case insensitive matching for example.
        value - The representation to match.
        Returns:
        The enum member which matched value.
        Throws:
        IllegalArgumentException - if the enum members are not unique under represent and mangle.
        IllegalArgumentException - if the value does not match any enum member.
      • getEnumClass

        public static <E extends Enum<E>> Class<E> getEnumClass​(E object)