Package org.hibernate.processor.util
Class TypeUtils
java.lang.Object
org.hibernate.processor.util.TypeUtils
Utility class.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsAnnotation
(Element element, String... annotations) static void
determineAccessTypeForHierarchy
(TypeElement searchedElement, Context context) static @Nullable AccessType
static boolean
extendsClass
(TypeElement type, String className) static @Nullable TypeMirror
extractClosestRealType
(TypeMirror type, Context context, Set<TypeVariable> beingVisited) static String
extractClosestRealTypeAsString
(TypeMirror type, Context context) static @Nullable Element
findMappedSuperElement
(Metamodel entity, Context context) static @Nullable AnnotationMirror
getAnnotationMirror
(Element element, String qualifiedName) Checks whether theElement
hosts the annotation with the given fully qualified class name.static @Nullable AnnotationValue
getAnnotationValue
(AnnotationMirror annotationMirror, String member) static TypeMirror
getCollectionElementType
(DeclaredType type, String returnTypeName, @Nullable String explicitTargetEntityName, Context context) static ElementKind
getElementKindForAccessType
(AccessType accessType) static @Nullable String
getFullyQualifiedClassNameOfTargetEntity
(AnnotationMirror mirror, String member) static String
getKeyType
(DeclaredType type, Context context) static @Nullable TypeElement
getSuperclassTypeElement
(TypeElement element) static @Nullable String
getTargetEntity
(List<? extends AnnotationMirror> annotations) static boolean
hasAnnotation
(Element element, String qualifiedName) static boolean
hasAnnotation
(Element element, String... qualifiedNames) static boolean
implementsInterface
(TypeElement type, String interfaceName) static boolean
isAnnotationMirrorOfType
(AnnotationMirror annotationMirror, String qualifiedName) Returnstrue
if the provided annotation type is of the same type as the provided class,false
otherwise.static boolean
isBasicAttribute
(Element element, Element returnedElement, Context context) static boolean
isClassOrRecordType
(Element element) static boolean
isMemberType
(Element element) static boolean
isPrimitive
(String paramType) static boolean
isPropertyGetter
(ExecutableType executable, Element element) static boolean
primitiveClassMatchesKind
(Class<?> itemType, TypeKind kind) static String
propertyName
(AnnotationMetaEntity parent, Element element) static String
toArrayTypeString
(ArrayType type, Context context) static String
toTypeString
(TypeMirror type)
-
Field Details
-
DEFAULT_ANNOTATION_PARAMETER_NAME
- See Also:
-
PRIMITIVE_TYPES
-
-
Method Details
-
toTypeString
-
toArrayTypeString
-
getSuperclassTypeElement
-
extractClosestRealTypeAsString
-
extractClosestRealType
public static @Nullable TypeMirror extractClosestRealType(TypeMirror type, Context context, Set<TypeVariable> beingVisited) -
containsAnnotation
-
isAnnotationMirrorOfType
public static boolean isAnnotationMirrorOfType(AnnotationMirror annotationMirror, String qualifiedName) Returnstrue
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.- Parameters:
annotationMirror
- The annotation mirrorqualifiedName
- the fully qualified class name to check against- Returns:
true
if the provided annotation type is of the same type as the provided class,false
otherwise.
-
getAnnotationMirror
Checks whether theElement
hosts the annotation with the given fully qualified class name.- Parameters:
element
- the element to check for the hosted annotationqualifiedName
- the fully qualified class name of the annotation to check for- Returns:
- the annotation mirror for the specified annotation class from the
Element
ornull
in case theTypeElement
does not host the specified annotation.
-
hasAnnotation
-
hasAnnotation
-
getAnnotationValue
public static @Nullable AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror, String member) -
determineAccessTypeForHierarchy
-
getCollectionElementType
public static TypeMirror getCollectionElementType(DeclaredType type, String returnTypeName, @Nullable String explicitTargetEntityName, Context context) -
determineAnnotationSpecifiedAccessType
-
getElementKindForAccessType
-
getKeyType
-
isClassOrRecordType
-
primitiveClassMatchesKind
-
isPropertyGetter
-
isBasicAttribute
-
getFullyQualifiedClassNameOfTargetEntity
public static @Nullable String getFullyQualifiedClassNameOfTargetEntity(AnnotationMirror mirror, String member) -
getTargetEntity
- Parameters:
annotations
- list of annotation mirrors.- Returns:
- target entity class name as string or
null
if no targetEntity is here or if equals to void
-
propertyName
-
findMappedSuperElement
-
implementsInterface
-
extendsClass
-
isMemberType
-
isPrimitive
-