Enum EnumGetMethod

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      NAME
      If the config value is an enum constant, returns it as it is.
      NAME_IGNORECASE
      If the config value is an enum constant, returns it as it is.
      ORDINAL_OR_NAME
      If the config value is an enum constant, returns it as it is.
      ORDINAL_OR_NAME_IGNORECASE
      If the config value is an enum constant, returns it as it is.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends java.lang.Enum<T>>
      T
      get​(java.lang.Object value, java.lang.Class<T> enumType)  
      boolean isCaseSensitive()  
      boolean isOrdinalOk()  
      <T extends java.lang.Enum<T>>
      boolean
      validate​(java.lang.Object value, java.lang.Class<T> enumType)  
      static EnumGetMethod valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static EnumGetMethod[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • NAME

        public static final EnumGetMethod NAME
        If the config value is an enum constant, returns it as it is. If it's a String, returns the enum constant whose name exactly matches the string (string case-sensitive equality). If it's a value of another type, throws an error. In particular, throws an error if it's an Integer.
      • NAME_IGNORECASE

        public static final EnumGetMethod NAME_IGNORECASE
        If the config value is an enum constant, returns it as it is. If it's a String, returns the enum constant whose name matches the string, ignoring the case. If it's a value of another type, throws an error. In particular, throws an error if it's an Integer. This is the default method used by UnmodifiableConfig (and other classes) when not explicitely specified.
      • ORDINAL_OR_NAME

        public static final EnumGetMethod ORDINAL_OR_NAME
        If the config value is an enum constant, returns it as it is. If it's a String, returns the enum constant whose name exactly matches the string (string case-sensitive equality). If it's an Integer, returns the enum constant whose ordinal() is equal to the value. If it's a value of another type, throws an error.
      • ORDINAL_OR_NAME_IGNORECASE

        public static final EnumGetMethod ORDINAL_OR_NAME_IGNORECASE
        If the config value is an enum constant, returns it as it is. If it's a String, returns the enum constant whose name exactly matches the string. If it's an Integer, returns the enum constant whose ordinal() is equal to the value. If it's a value of another type, throws an error.
    • Method Detail

      • values

        public static EnumGetMethod[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (EnumGetMethod c : EnumGetMethod.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static EnumGetMethod valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • isCaseSensitive

        public boolean isCaseSensitive()
      • isOrdinalOk

        public boolean isOrdinalOk()
      • get

        public <T extends java.lang.Enum<T>> T get​(java.lang.Object value,
                                                   java.lang.Class<T> enumType)
      • validate

        public <T extends java.lang.Enum<T>> boolean validate​(java.lang.Object value,
                                                              java.lang.Class<T> enumType)