Enum TypeUseLocation

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

    public enum TypeUseLocation
    extends java.lang.Enum<TypeUseLocation>
    Specifies the locations to which a DefaultQualifier annotation applies.

    The order of enums is important. Defaults are applied in this order. In particular, this means that OTHERWISE and ALL should be last.

    See Also:
    DefaultQualifier, ElementKind
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ALL
      Apply default annotations to all type uses other than uses of type parameters.
      CONSTRUCTOR_RESULT
      Apply default annotations to all unannotated raw types of constructor result types.
      EXCEPTION_PARAMETER
      Apply default annotations to all unannotated raw types of exception parameters.
      EXPLICIT_LOWER_BOUND
      Apply default annotations to unannotated, but explicit lower bounds: <? super Object>
      EXPLICIT_UPPER_BOUND
      Apply default annotations to unannotated, but explicit upper bounds: <T extends Object>.
      FIELD
      Apply default annotations to all unannotated raw types of fields.
      IMPLICIT_LOWER_BOUND
      Apply default annotations to unannotated, but implicit lower bounds: <T> <?>.
      IMPLICIT_UPPER_BOUND
      Apply default annotations to unannotated type variables: <T>.
      LOCAL_VARIABLE
      Apply default annotations to all unannotated raw types of local variables, casts, and instanceof.
      LOWER_BOUND
      Apply default annotations to unannotated lower bounds for type variables and wildcards both explicit ones in extends clauses, and implicit upper bounds when no explicit extends or super clause is present.
      OTHERWISE
      Apply if nothing more concrete is provided.
      PARAMETER
      Apply default annotations to all unannotated raw types of formal parameter types, excluding the receiver.
      RECEIVER
      Apply default annotations to all unannotated raw types of receiver types.
      RESOURCE_VARIABLE
      Apply default annotations to all unannotated raw types of resource variables.
      RETURN
      Apply default annotations to all unannotated raw types of return types.
      UPPER_BOUND
      Apply default annotations to unannotated upper bounds: both explicit ones in extends clauses, and implicit upper bounds when no explicit extends or super clause is present.
    • Method Summary

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

      • FIELD

        public static final TypeUseLocation FIELD
        Apply default annotations to all unannotated raw types of fields.
      • LOCAL_VARIABLE

        public static final TypeUseLocation LOCAL_VARIABLE
        Apply default annotations to all unannotated raw types of local variables, casts, and instanceof.

        TODO: should cast/instanceof be separated?

      • RESOURCE_VARIABLE

        public static final TypeUseLocation RESOURCE_VARIABLE
        Apply default annotations to all unannotated raw types of resource variables.
      • EXCEPTION_PARAMETER

        public static final TypeUseLocation EXCEPTION_PARAMETER
        Apply default annotations to all unannotated raw types of exception parameters.
      • RECEIVER

        public static final TypeUseLocation RECEIVER
        Apply default annotations to all unannotated raw types of receiver types.
      • PARAMETER

        public static final TypeUseLocation PARAMETER
        Apply default annotations to all unannotated raw types of formal parameter types, excluding the receiver.
      • RETURN

        public static final TypeUseLocation RETURN
        Apply default annotations to all unannotated raw types of return types.
      • CONSTRUCTOR_RESULT

        public static final TypeUseLocation CONSTRUCTOR_RESULT
        Apply default annotations to all unannotated raw types of constructor result types.
      • LOWER_BOUND

        public static final TypeUseLocation LOWER_BOUND
        Apply default annotations to unannotated lower bounds for type variables and wildcards both explicit ones in extends clauses, and implicit upper bounds when no explicit extends or super clause is present.
      • EXPLICIT_LOWER_BOUND

        public static final TypeUseLocation EXPLICIT_LOWER_BOUND
        Apply default annotations to unannotated, but explicit lower bounds: <? super Object>
      • IMPLICIT_LOWER_BOUND

        public static final TypeUseLocation IMPLICIT_LOWER_BOUND
        Apply default annotations to unannotated, but implicit lower bounds: <T> <?>.
      • UPPER_BOUND

        public static final TypeUseLocation UPPER_BOUND
        Apply default annotations to unannotated upper bounds: both explicit ones in extends clauses, and implicit upper bounds when no explicit extends or super clause is present.

        Especially useful for parametrized classes that provide a lot of static methods with the same generic parameters as the class.

      • EXPLICIT_UPPER_BOUND

        public static final TypeUseLocation EXPLICIT_UPPER_BOUND
        Apply default annotations to unannotated, but explicit upper bounds: <T extends Object>.
      • IMPLICIT_UPPER_BOUND

        public static final TypeUseLocation IMPLICIT_UPPER_BOUND
        Apply default annotations to unannotated type variables: <T>.
      • OTHERWISE

        public static final TypeUseLocation OTHERWISE
        Apply if nothing more concrete is provided. TODO: clarify relation to ALL.
      • ALL

        public static final TypeUseLocation ALL
        Apply default annotations to all type uses other than uses of type parameters. Does not allow any of the other constants. Usually you want OTHERWISE.
    • Method Detail

      • values

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

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