Enum NullPolicy

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

    public enum NullPolicy
    extends java.lang.Enum<NullPolicy>
    Describes when a function/operator will return null.

    STRICT and ANY are similar. STRICT says f(a0, a1) will NEVER return null if a0 and a1 are not null. This means that we can check whether f returns null just by checking its arguments. Use STRICT in preference to ANY whenever possible.

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AND
      If any of the arguments are false, result is false; else if any arguments are null, result is null; else true.
      ANY
      If any of the arguments are null, return null.
      NONE  
      NOT
      If any argument is true, result is false; else if any argument is null, result is null; else true.
      OR
      If any of the arguments are true, result is true; else if any arguments are null, result is null; else false.
      SEMI_STRICT
      Returns null if one of the arguments is null, and possibly other times.
      STRICT
      Returns null if and only if one of the arguments are null.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NullPolicy()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static NullPolicy valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static NullPolicy[] 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

      • STRICT

        public static final NullPolicy STRICT
        Returns null if and only if one of the arguments are null.
      • SEMI_STRICT

        public static final NullPolicy SEMI_STRICT
        Returns null if one of the arguments is null, and possibly other times.
      • ANY

        public static final NullPolicy ANY
        If any of the arguments are null, return null.
      • AND

        public static final NullPolicy AND
        If any of the arguments are false, result is false; else if any arguments are null, result is null; else true.
      • OR

        public static final NullPolicy OR
        If any of the arguments are true, result is true; else if any arguments are null, result is null; else false.
      • NOT

        public static final NullPolicy NOT
        If any argument is true, result is false; else if any argument is null, result is null; else true.
    • Constructor Detail

      • NullPolicy

        private NullPolicy()
    • Method Detail

      • values

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

        public static NullPolicy 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