public class AnnotatedTypeReplacer extends AnnotatedTypeComparer<Void>
Example use:
AnnotatedTypeMirror visitType = ...;
AnnotatedTypeMirror parameter = ...;
visitType.accept(new AnnotatedTypeReplacer(), parameter);
AnnotatedTypeScanner.Reduce<R>defaultResult, reduceFunction, visitedNodes| Constructor and Description |
|---|
AnnotatedTypeReplacer()
Construct an AnnotatedTypeReplacer that will replace all annotations.
|
AnnotatedTypeReplacer(AnnotationMirror top)
Construct an AnnotatedTypeReplacer that will only replace annotations in
top's
hierarchy. |
| Modifier and Type | Method and Description |
|---|---|
protected Void |
combineRs(Void r1,
Void r2)
Supplies the logic to reduce on how to combine two R objects.
|
protected Void |
compare(AnnotatedTypeMirror from,
AnnotatedTypeMirror to)
Compares two annotated type mirrors.
|
static void |
replace(AnnotatedTypeMirror from,
AnnotatedTypeMirror to)
Replaces or adds all annotations from
from to to. |
static void |
replace(AnnotatedTypeMirror from,
AnnotatedTypeMirror to,
AnnotationMirror top)
Replaces or adds annotations in
top's hierarchy from from to to. |
protected void |
replaceAnnotations(AnnotatedTypeMirror from,
AnnotatedTypeMirror to)
Replace the annotations in to with the annotations in from, wherever from has an annotation.
|
void |
resolvePrimaries(AnnotatedTypeMirror from,
AnnotatedTypeMirror to)
For type variables and wildcards, the absence of a primary annotations has an implied meaning
on substitution.
|
Void |
visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable from,
AnnotatedTypeMirror to)
Visits a type variable.
|
Void |
visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType from,
AnnotatedTypeMirror to)
Visits a wildcard type.
|
reduce, scan, scan, scanAndReduce, scanAndReduce, visitArray, visitDeclared, visitExecutable, visitIntersection, visitUnionreset, scan, scanAndReduce, visit, visit, visitNoType, visitNull, visitPrimitivepublic AnnotatedTypeReplacer()
public AnnotatedTypeReplacer(AnnotationMirror top)
top's
hierarchy.top - if top != null, then only annotation in the hierarchy of top are affectedpublic static void replace(AnnotatedTypeMirror from, AnnotatedTypeMirror to)
from to to. Annotations from from will be used everywhere they exist, but annotations in to will be kept anywhere
that from is unannotated.from - the annotated type mirror from which to take new annotationsto - the annotated type mirror to which the annotations will be addedpublic static void replace(AnnotatedTypeMirror from, AnnotatedTypeMirror to, AnnotationMirror top)
top's hierarchy from from to to.
Annotations from from will be used everywhere they exist, but annotations in to will be kept anywhere that from is unannotated.from - the annotated type mirror from which to take new annotationsto - the annotated type mirror to which the annotations will be addedtop - the top type of the hierarchy whose annotations will be addedprotected Void compare(AnnotatedTypeMirror from, AnnotatedTypeMirror to)
AnnotatedTypeComparercompare in class AnnotatedTypeComparer<Void>protected Void combineRs(Void r1, Void r2)
AnnotatedTypeComparercombineRs in class AnnotatedTypeComparer<Void>protected void replaceAnnotations(AnnotatedTypeMirror from, AnnotatedTypeMirror to)
from - the source of the annotationsto - the destination of the annotations, modified by this methodpublic Void visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable from, AnnotatedTypeMirror to)
AnnotatedTypeVisitorvisitTypeVariable in interface AnnotatedTypeVisitor<Void,AnnotatedTypeMirror>visitTypeVariable in class AnnotatedTypeComparer<Void>from - the type to visitto - a visitor-specified parameterpublic Void visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType from, AnnotatedTypeMirror to)
AnnotatedTypeVisitorvisitWildcard in interface AnnotatedTypeVisitor<Void,AnnotatedTypeMirror>visitWildcard in class AnnotatedTypeComparer<Void>from - the type to visitto - a visitor-specified parameterpublic void resolvePrimaries(AnnotatedTypeMirror from, AnnotatedTypeMirror to)
from - a type variable or wildcardto - the destination annotated type mirror