public final class TypeUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_ANNOTATION_PARAMETER_NAME |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsAnnotation(javax.lang.model.element.Element element,
java.lang.String... annotations) |
static void |
determineAccessTypeForHierarchy(javax.lang.model.element.TypeElement searchedElement,
Context context) |
static AccessType |
determineAnnotationSpecifiedAccessType(javax.lang.model.element.Element element) |
static java.lang.String |
extractClosestRealTypeAsString(javax.lang.model.type.TypeMirror type,
Context context) |
static javax.lang.model.element.AnnotationMirror |
getAnnotationMirror(javax.lang.model.element.Element element,
java.lang.String fqcn)
Checks whether the
Element hosts the annotation with the given fully qualified class name. |
static java.lang.Object |
getAnnotationValue(javax.lang.model.element.AnnotationMirror annotationMirror,
java.lang.String parameterValue) |
static javax.lang.model.type.TypeMirror |
getCollectionElementType(javax.lang.model.type.DeclaredType t,
java.lang.String fqNameOfReturnedType,
java.lang.String explicitTargetEntityName,
Context context) |
static javax.lang.model.element.ElementKind |
getElementKindForAccessType(AccessType accessType) |
static java.lang.String |
getKeyType(javax.lang.model.type.DeclaredType t,
Context context) |
static javax.lang.model.element.TypeElement |
getSuperclassTypeElement(javax.lang.model.element.TypeElement element) |
static boolean |
isAnnotationMirrorOfType(javax.lang.model.element.AnnotationMirror annotationMirror,
java.lang.String fqcn)
Returns
true if the provided annotation type is of the same type as the provided class, false otherwise. |
static java.lang.String |
toArrayTypeString(javax.lang.model.type.ArrayType type,
Context context) |
static java.lang.String |
toTypeString(javax.lang.model.type.TypeMirror type) |
public static final java.lang.String DEFAULT_ANNOTATION_PARAMETER_NAME
public static java.lang.String toTypeString(javax.lang.model.type.TypeMirror type)
public static java.lang.String toArrayTypeString(javax.lang.model.type.ArrayType type, Context context)
public static javax.lang.model.element.TypeElement getSuperclassTypeElement(javax.lang.model.element.TypeElement element)
public static java.lang.String extractClosestRealTypeAsString(javax.lang.model.type.TypeMirror type, Context context)
public static boolean containsAnnotation(javax.lang.model.element.Element element, java.lang.String... annotations)
public static boolean isAnnotationMirrorOfType(javax.lang.model.element.AnnotationMirror annotationMirror, java.lang.String fqcn)
true
if the provided annotation type is of the same type as the provided class, false
otherwise.
This method uses the string class names for comparison. See also
getting-class-values-from-annotations.annotationMirror
- The annotation mirrorfqcn
- the fully qualified class name to check againsttrue
if the provided annotation type is of the same type as the provided class, false
otherwise.public static javax.lang.model.element.AnnotationMirror getAnnotationMirror(javax.lang.model.element.Element element, java.lang.String fqcn)
Element
hosts the annotation with the given fully qualified class name.element
- the element to check for the hosted annotationfqcn
- the fully qualified class name of the annotation to check forElement
or null
in case
the TypeElement
does not host the specified annotation.public static java.lang.Object getAnnotationValue(javax.lang.model.element.AnnotationMirror annotationMirror, java.lang.String parameterValue)
public static void determineAccessTypeForHierarchy(javax.lang.model.element.TypeElement searchedElement, Context context)
public static javax.lang.model.type.TypeMirror getCollectionElementType(javax.lang.model.type.DeclaredType t, java.lang.String fqNameOfReturnedType, java.lang.String explicitTargetEntityName, Context context)
public static AccessType determineAnnotationSpecifiedAccessType(javax.lang.model.element.Element element)
public static javax.lang.model.element.ElementKind getElementKindForAccessType(AccessType accessType)
public static java.lang.String getKeyType(javax.lang.model.type.DeclaredType t, Context context)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.