public static class AnnotatedTypeMirror.AnnotatedIntersectionType extends AnnotatedTypeMirror
For example: MyObject & Serializable & Comparable<MyObject>
AnnotatedTypeMirror.AnnotatedArrayType, AnnotatedTypeMirror.AnnotatedDeclaredType, AnnotatedTypeMirror.AnnotatedExecutableType, AnnotatedTypeMirror.AnnotatedIntersectionType, AnnotatedTypeMirror.AnnotatedNoType, AnnotatedTypeMirror.AnnotatedNullType, AnnotatedTypeMirror.AnnotatedPrimitiveType, AnnotatedTypeMirror.AnnotatedTypeVariable, AnnotatedTypeMirror.AnnotatedUnionType, AnnotatedTypeMirror.AnnotatedWildcardType
Modifier and Type | Field and Description |
---|---|
protected List<AnnotatedTypeMirror> |
bounds
A list of the bounds of this which are also its direct super types.
|
annotations, atypeFactory, EQUALITY_COMPARER, HASHCODE_VISITOR, underlyingType
Modifier and Type | Method and Description |
---|---|
<R,P> R |
accept(AnnotatedTypeVisitor<R,P> v,
P p)
Applies a visitor to this type.
|
void |
addAnnotation(AnnotationMirror a)
Adds an annotation to this type.
|
void |
copyIntersectionBoundAnnotations()
Copy the first annotation (in each hierarchy) on a bound to the primary annotation location
of the intersection type.
|
AnnotatedTypeMirror.AnnotatedIntersectionType |
deepCopy()
Returns a deep copy of this type with annotations.
|
AnnotatedTypeMirror.AnnotatedIntersectionType |
deepCopy(boolean copyAnnotations)
Returns a deep copy of this type.
|
List<? extends AnnotatedTypeMirror> |
directSupertypes()
This method returns a list of AnnotatedTypeMirrors where the Java type of each ATM is an
immediate supertype (class or interface) of the Java type of this.
|
List<AnnotatedTypeMirror> |
getBounds()
This returns the bounds of the intersection type.
|
IntersectionType |
getUnderlyingType()
Returns the underlying unannotated Java type, which this wraps.
|
void |
setBounds(List<AnnotatedTypeMirror> bounds)
Sets the bounds.
|
AnnotatedTypeMirror.AnnotatedIntersectionType |
shallowCopy()
Returns a shallow copy of this type with annotations.
|
AnnotatedTypeMirror.AnnotatedIntersectionType |
shallowCopy(boolean copyAnnotations)
Returns a shallow copy of this type.
|
addAnnotation, addAnnotations, addMissingAnnotations, asUse, clearPrimaryAnnotations, containsUninferredTypeArguments, createType, createTypeOfObject, equals, getAnnotation, getAnnotation, getAnnotation, getAnnotationInHierarchy, getAnnotations, getAnnotationsField, getEffectiveAnnotation, getEffectiveAnnotationInHierarchy, getEffectiveAnnotations, getErased, getExplicitAnnotations, getKind, getPrimitiveKind, getUnderlyingTypeHashCode, hasAnnotation, hasAnnotation, hasAnnotationRelaxed, hasEffectiveAnnotation, hasEffectiveAnnotation, hasEffectiveAnnotationRelaxed, hasExplicitAnnotation, hasExplicitAnnotation, hasExplicitAnnotationRelaxed, hashCode, isAnnotatedInHierarchy, isDeclaration, removeAnnotation, removeAnnotationByClass, removeAnnotationInHierarchy, removeAnnotations, removeNonTopAnnotationInHierarchy, replaceAnnotation, replaceAnnotations, toString, toString
protected List<AnnotatedTypeMirror> bounds
public void addAnnotation(AnnotationMirror a)
Also, copies a
to all the bounds.
addAnnotation
in class AnnotatedTypeMirror
a
- the annotation to addpublic <R,P> R accept(AnnotatedTypeVisitor<R,P> v, P p)
AnnotatedTypeMirror
accept
in class AnnotatedTypeMirror
R
- the return type of the visitor's methodsP
- the type of the additional parameter to the visitor's methodsv
- the visitor operating on this typep
- additional parameter to the visitorpublic IntersectionType getUnderlyingType()
AnnotatedTypeMirror
getUnderlyingType
in class AnnotatedTypeMirror
public AnnotatedTypeMirror.AnnotatedIntersectionType deepCopy(boolean copyAnnotations)
AnnotatedTypeMirror
Note: deepCopy provides two important properties in the returned copy:
deepCopy
in class AnnotatedTypeMirror
public AnnotatedTypeMirror.AnnotatedIntersectionType deepCopy()
AnnotatedTypeMirror
Each subclass implements this method with the subclass return type. The method body must always be a call to deepCopy(true).
deepCopy
in class AnnotatedTypeMirror
AnnotatedTypeMirror.deepCopy(boolean)
public AnnotatedTypeMirror.AnnotatedIntersectionType shallowCopy(boolean copyAnnotations)
AnnotatedTypeMirror
shallowCopy
in class AnnotatedTypeMirror
copyAnnotations
- whether copy should have annotations, i.e. whether field annotations
should be copied.public AnnotatedTypeMirror.AnnotatedIntersectionType shallowCopy()
AnnotatedTypeMirror
Each subclass implements this method with the subclass return type. The method body must always be a call to shallowCopy(true).
shallowCopy
in class AnnotatedTypeMirror
AnnotatedTypeMirror.shallowCopy(boolean)
public List<? extends AnnotatedTypeMirror> directSupertypes()
For example,
The direct supertype of the ATMclass B<T> { ... }
class A extends B<@NonNull String> { ... }
@Nullable A a;
@Nullable A
is @Nullable B<@NonNull String>
.
An example with more complex type arguments:
The direct supertype of the ATMclass D<Q,R> { ... }
class A<T,S> extends D<S,T> { ... }
@Nullable A<@NonNull String, @NonNull Object> a;
@Nullable A<@NonNull String, @NonNull Object>
is
@Nullable B<@NonNull Object, @NonNull String>
.
An example with more than one direct supertype:
The direct supertypes of the ATMclass B<T> implements List<Integer> { ... }
class A extends B<@NonNull String> implements List<Integer> { ... }
@Nullable A a;
@Nullable A
are @Nullable B <@NonNull String>
and @Nullable List<@NonNull Integer>
.
This returns the same types as getBounds()
.
directSupertypes
in class AnnotatedTypeMirror
Types.directSupertypes(TypeMirror)
public List<AnnotatedTypeMirror> getBounds()
This returns the same types as directSupertypes()
.
public void setBounds(List<AnnotatedTypeMirror> bounds)
bounds
- bounds to usepublic void copyIntersectionBoundAnnotations()
For example, in the type @NonNull Object & @Initialized @Nullable Serializable
,
@Nullable
and @Initialized
are copied to the primary annotation location.