Enum OptBoolean

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<OptBoolean>

    public enum OptBoolean
    extends java.lang.Enum<OptBoolean>
    Optional Boolean value ("nullean"). Needed just because Java annotations can not take 'null' as a value (even as default), so there is no way to distinguish between explicit `true` and `false`, and lack of choice (related: annotations are limited to primitives, so Boolean not allowed as solution).

    Note: although use of `true` and `false` would be more convenient, they can not be chosen since they are Java keyword and compiler won't allow the choice. And since enum naming convention suggests all-upper-case, that is what is done here.

    Since:
    2.6
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DEFAULT
      Value that indicates that the annotation property does NOT have an explicit definition of enabled/disabled (or true/false); instead, a higher-level configuration value is used; or lacking higher-level global setting, default.
      FALSE
      Value that indicates that the annotation property is explicitly defined to be disabled, or false.
      TRUE
      Value that indicates that the annotation property is explicitly defined to be enabled, or true.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Boolean asBoolean()  
      boolean asPrimitive()  
      static boolean equals​(java.lang.Boolean b1, java.lang.Boolean b2)  
      static OptBoolean fromBoolean​(java.lang.Boolean b)  
      static OptBoolean valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static OptBoolean[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

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

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

      • TRUE

        public static final OptBoolean TRUE
        Value that indicates that the annotation property is explicitly defined to be enabled, or true.
      • FALSE

        public static final OptBoolean FALSE
        Value that indicates that the annotation property is explicitly defined to be disabled, or false.
      • DEFAULT

        public static final OptBoolean DEFAULT
        Value that indicates that the annotation property does NOT have an explicit definition of enabled/disabled (or true/false); instead, a higher-level configuration value is used; or lacking higher-level global setting, default.
    • Method Detail

      • values

        public static OptBoolean[] 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 (OptBoolean c : OptBoolean.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OptBoolean 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
      • asBoolean

        public java.lang.Boolean asBoolean()
      • asPrimitive

        public boolean asPrimitive()
      • fromBoolean

        public static OptBoolean fromBoolean​(java.lang.Boolean b)
      • equals

        public static boolean equals​(java.lang.Boolean b1,
                                     java.lang.Boolean b2)