Class AnnotatedTypeReplacer

  • All Implemented Interfaces:
    AnnotatedTypeVisitor<java.lang.Void,​AnnotatedTypeMirror>

    public class AnnotatedTypeReplacer
    extends DoubleAnnotatedTypeScanner<java.lang.Void>
    Replaces or adds all the annotations in the parameter with the annotations from the visited type. An annotation is replaced if the parameter type already has an annotation in the same hierarchy at the same location as the visited type.

    Example use:

    
     AnnotatedTypeMirror visitType = ...;
     AnnotatedTypeMirror parameter = ...;
     visitType.accept(new AnnotatedTypeReplacer(), parameter);
     
    • Constructor Detail

      • AnnotatedTypeReplacer

        public AnnotatedTypeReplacer()
        Construct an AnnotatedTypeReplacer that will replace all annotations.
      • AnnotatedTypeReplacer

        public AnnotatedTypeReplacer​(@Nullable javax.lang.model.element.AnnotationMirror top)
        Construct an AnnotatedTypeReplacer that will only replace annotations in top's hierarchy.
        Parameters:
        top - if top != null, then only annotations in the hierarchy of top are affected