public final class TypeUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ANNOTATION_PARAMETER_NAME |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsAnnotation(Element element,
String... annotations) |
static void |
determineAccessTypeForHierarchy(TypeElement searchedElement,
Context context) |
static AccessType |
determineAnnotationSpecifiedAccessType(Element element) |
static String |
extractClosestRealTypeAsString(TypeMirror type,
Context context) |
static AnnotationMirror |
getAnnotationMirror(Element element,
String fqcn)
Checks whether the
Element hosts the annotation with the given fully qualified class name. |
static Object |
getAnnotationValue(AnnotationMirror annotationMirror,
String parameterValue) |
static TypeMirror |
getCollectionElementType(DeclaredType t,
String fqNameOfReturnedType,
String explicitTargetEntityName,
Context context) |
static ElementKind |
getElementKindForAccessType(AccessType accessType) |
static String |
getKeyType(DeclaredType t,
Context context) |
static TypeElement |
getSuperclassTypeElement(TypeElement element) |
static boolean |
isAnnotationMirrorOfType(AnnotationMirror annotationMirror,
String fqcn)
Returns
true if the provided annotation type is of the same type as the provided class, false otherwise. |
static String |
toTypeString(TypeMirror type) |
public static final String DEFAULT_ANNOTATION_PARAMETER_NAME
public static String toTypeString(TypeMirror type)
public static TypeElement getSuperclassTypeElement(TypeElement element)
public static String extractClosestRealTypeAsString(TypeMirror type, Context context)
public static boolean isAnnotationMirrorOfType(AnnotationMirror annotationMirror, 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 AnnotationMirror getAnnotationMirror(Element element, 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 Object getAnnotationValue(AnnotationMirror annotationMirror, String parameterValue)
public static void determineAccessTypeForHierarchy(TypeElement searchedElement, Context context)
public static TypeMirror getCollectionElementType(DeclaredType t, String fqNameOfReturnedType, String explicitTargetEntityName, Context context)
public static AccessType determineAnnotationSpecifiedAccessType(Element element)
public static ElementKind getElementKindForAccessType(AccessType accessType)
public static String getKeyType(DeclaredType t, Context context)
Copyright © 2001-2017 Red Hat, Inc. All Rights Reserved.