public class AnnotatedTypeCopier extends Object implements AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
TypeVariableSubstitutor
,
AnnotatedTypeReplacer
Modifier and Type | Field and Description |
---|---|
protected boolean |
copyAnnotations |
protected boolean |
visitingExecutableTypeParam
This is a hack to handle the curious behavior of substitution on an AnnotatedExecutableType.
|
Constructor and Description |
---|
AnnotatedTypeCopier()
Creates an AnnotatedTypeCopier that copies both the structure and annotations of the source
AnnotatedTypeMirror
|
AnnotatedTypeCopier(boolean copyAnnotations)
Creates an AnnotatedTypeCopier that may or may not copyAnnotations
By default AnnotatedTypeCopier provides two major properties in its copies:
1) Structure preservation - the exact structure of the original AnnotatedTypeMirror is preserved in the copy
including all component types.
|
protected boolean visitingExecutableTypeParam
protected final boolean copyAnnotations
AnnotatedTypeCopier(boolean)
public AnnotatedTypeCopier(boolean copyAnnotations)
public AnnotatedTypeCopier()
AnnotatedTypeCopier(boolean)
public AnnotatedTypeMirror visit(AnnotatedTypeMirror type)
AnnotatedTypeVisitor
v.visit(t, null)
.visit
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
type
- the type to visitpublic AnnotatedTypeMirror visit(AnnotatedTypeMirror type, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visit
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
type
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitDeclared
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitIntersection(AnnotatedTypeMirror.AnnotatedIntersectionType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitIntersection
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitUnion(AnnotatedTypeMirror.AnnotatedUnionType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitUnion
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitExecutable
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitArray(AnnotatedTypeMirror.AnnotatedArrayType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitArray
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitTypeVariable(AnnotatedTypeMirror.AnnotatedTypeVariable original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitTypeVariable
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitPrimitive(AnnotatedTypeMirror.AnnotatedPrimitiveType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitPrimitive
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitNoType(AnnotatedTypeMirror.AnnotatedNoType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitNoType
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitNull(AnnotatedTypeMirror.AnnotatedNullType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
null
type.visitNull
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterpublic AnnotatedTypeMirror visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
AnnotatedTypeVisitor
visitWildcard
in interface AnnotatedTypeVisitor<AnnotatedTypeMirror,IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror>>
original
- the type to visitoriginalToCopy
- a visitor-specified parameterprotected <T extends AnnotatedTypeMirror> T makeOrReturnCopy(T original, IdentityHashMap<AnnotatedTypeMirror,AnnotatedTypeMirror> originalToCopy)
T
- The type of original copy, this is a shortcut to avoid having to insert casts all over the visitororiginal
- a reference to a type to copyoriginalToCopy
- a mapping of previously encountered references to the copies made for those referencesprotected <T extends AnnotatedTypeMirror> T makeCopy(T original)
protected void maybeCopyPrimaryAnnotations(AnnotatedTypeMirror source, AnnotatedTypeMirror dest)
source
- the type whose primary annotations are being copieddest
- a copy of source that should receive its primary annotations