Class QualifierDefaults.DefaultApplierElement

  • Enclosing class:
    QualifierDefaults

    protected class QualifierDefaults.DefaultApplierElement
    extends java.lang.Object
    A default applier element.
    • Field Detail

      • scope

        protected final javax.lang.model.element.Element scope
        The scope of the default.
      • location

        protected TypeUseLocation location
        Location to which to apply the default. (Should only be set by the applyDefault method.)
    • Method Detail

      • applyDefault

        public void applyDefault​(Default def)
        Apply default to the type.
        Parameters:
        def - default to apply
      • shouldBeAnnotated

        protected boolean shouldBeAnnotated​(AnnotatedTypeMirror type,
                                            boolean applyToTypeVar)
        Returns true if the given qualifier should be applied to the given type. Currently we do not apply defaults to void types, packages, wildcards, and type variables.
        Parameters:
        type - type to which qual would be applied
        applyToTypeVar - whether to apply to type variables
        Returns:
        true if this application should proceed
      • addAnnotation

        protected void addAnnotation​(AnnotatedTypeMirror type,
                                     javax.lang.model.element.AnnotationMirror qual)
        Add the qualifier to the type if it does not already have an annotation in the same hierarchy as qual.
        Parameters:
        type - type to add qual
        qual - annotation to add