public class TypeMirrorConverter<Q> extends Object
QualifiedTypeMirror
and AnnotatedTypeMirror
.
Only adapters should ever have a reference to this class. All adapters for
a single type system must use the same TypeMirrorConverter
instance,
since converting from QualifiedTypeMirror
to AnnotatedTypeMirror
and back will fail if the two conversion steps are
performed with different instances.Modifier and Type | Field and Description |
---|---|
LinkedHashMap<Integer,AnnotationMirror> |
keyToAnnoCache
Cache @QualifierKey annotation mirrors so they are not to be recreated on every conversion
|
Constructor and Description |
---|
TypeMirrorConverter(ProcessingEnvironment processingEnv,
CheckerAdapter<Q> checkerAdapter) |
Modifier and Type | Method and Description |
---|---|
void |
applyQualifiers(QualifiedTypeMirror<Q> qtm,
AnnotatedTypeMirror atm)
Given a QualifiedTypeMirror and an AnnotatedTypeMirror with the same
underlying TypeMirror, recursively update annotations on the
AnnotatedTypeMirror to match the qualifiers present on the
QualifiedTypeMirror.
|
AnnotatedTypeMirror |
getAnnotatedType(QualifiedTypeMirror<Q> qtm)
Given a QualifiedTypeMirror, produce an AnnotatedTypeMirror with the
same underlying TypeMirror and with annotations corresponding to the
qualifiers on the input QualifiedTypeMirror.
|
List<AnnotatedTypeMirror> |
getAnnotatedTypeList(List<? extends QualifiedTypeMirror<Q>> qtms) |
AnnotationMirror |
getAnnotation(Q qual)
Get an AnnotationMirror for a QualifierKey annotation encoding the specified
qualifier.
|
AnnotationMirror |
getBlankKeyAnnotation()
Get a QualifierKey annotation containing no index.
|
QualifiedTypeMirror<Q> |
getQualifiedType(AnnotatedTypeMirror atm)
Given an AnnotatedTypeMirror, construct a QualifiedTypeMirror with the
same underlying type with the qualifiers extracted from the
AnnotatedTypeMirror's @QualifierKey annotations.
|
List<QualifiedTypeMirror<Q>> |
getQualifiedTypeList(List<? extends AnnotatedTypeMirror> atms) |
Q |
getQualifier(AnnotatedTypeMirror atm)
Get the qualifier corresponding to the QualifierKey annotation present on an
AnnotatedTypeMirror, or null if no such annotation exists.
|
Q |
getQualifier(AnnotationMirror anno)
Get the qualifier corresponding to a QualifierKey annotation.
|
boolean |
isKey(AnnotationMirror anno)
Check if an AnnotationMirror is a valid QualifierKey annotation.
|
public LinkedHashMap<Integer,AnnotationMirror> keyToAnnoCache
public TypeMirrorConverter(ProcessingEnvironment processingEnv, CheckerAdapter<Q> checkerAdapter)
public void applyQualifiers(QualifiedTypeMirror<Q> qtm, AnnotatedTypeMirror atm)
public AnnotatedTypeMirror getAnnotatedType(QualifiedTypeMirror<Q> qtm)
public List<AnnotatedTypeMirror> getAnnotatedTypeList(List<? extends QualifiedTypeMirror<Q>> qtms)
public QualifiedTypeMirror<Q> getQualifiedType(AnnotatedTypeMirror atm)
public List<QualifiedTypeMirror<Q>> getQualifiedTypeList(List<? extends AnnotatedTypeMirror> atms)
public Q getQualifier(AnnotationMirror anno)
public Q getQualifier(AnnotatedTypeMirror atm)
public AnnotationMirror getAnnotation(Q qual)
public boolean isKey(AnnotationMirror anno)
public AnnotationMirror getBlankKeyAnnotation()