Package org.hibernate.jpamodelgen.util
Class TypeUtils
- java.lang.Object
-
- org.hibernate.jpamodelgen.util.TypeUtils
-
public final class TypeUtils extends java.lang.ObjectUtility class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_ANNOTATION_PARAMETER_NAME
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancontainsAnnotation(javax.lang.model.element.Element element, java.lang.String... annotations)static voiddetermineAccessTypeForHierarchy(javax.lang.model.element.TypeElement searchedElement, Context context)static AccessTypedetermineAnnotationSpecifiedAccessType(javax.lang.model.element.Element element)static java.lang.StringextractClosestRealTypeAsString(javax.lang.model.type.TypeMirror type, Context context)static javax.lang.model.element.AnnotationMirrorgetAnnotationMirror(javax.lang.model.element.Element element, java.lang.String fqcn)Checks whether theElementhosts the annotation with the given fully qualified class name.static java.lang.ObjectgetAnnotationValue(javax.lang.model.element.AnnotationMirror annotationMirror, java.lang.String parameterValue)static javax.lang.model.type.TypeMirrorgetCollectionElementType(javax.lang.model.type.DeclaredType t, java.lang.String fqNameOfReturnedType, java.lang.String explicitTargetEntityName, Context context)static javax.lang.model.element.ElementKindgetElementKindForAccessType(AccessType accessType)static java.lang.StringgetKeyType(javax.lang.model.type.DeclaredType t, Context context)static javax.lang.model.element.TypeElementgetSuperclassTypeElement(javax.lang.model.element.TypeElement element)static booleanisAnnotationMirrorOfType(javax.lang.model.element.AnnotationMirror annotationMirror, java.lang.String fqcn)Returnstrueif the provided annotation type is of the same type as the provided class,falseotherwise.static java.lang.StringtoArrayTypeString(javax.lang.model.type.ArrayType type, Context context)static java.lang.StringtoTypeString(javax.lang.model.type.TypeMirror type)
-
-
-
Field Detail
-
DEFAULT_ANNOTATION_PARAMETER_NAME
public static final java.lang.String DEFAULT_ANNOTATION_PARAMETER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
toTypeString
public static java.lang.String toTypeString(javax.lang.model.type.TypeMirror type)
-
toArrayTypeString
public static java.lang.String toArrayTypeString(javax.lang.model.type.ArrayType type, Context context)
-
getSuperclassTypeElement
public static javax.lang.model.element.TypeElement getSuperclassTypeElement(javax.lang.model.element.TypeElement element)
-
extractClosestRealTypeAsString
public static java.lang.String extractClosestRealTypeAsString(javax.lang.model.type.TypeMirror type, Context context)
-
containsAnnotation
public static boolean containsAnnotation(javax.lang.model.element.Element element, java.lang.String... annotations)
-
isAnnotationMirrorOfType
public static boolean isAnnotationMirrorOfType(javax.lang.model.element.AnnotationMirror annotationMirror, java.lang.String fqcn)Returnstrueif the provided annotation type is of the same type as the provided class,falseotherwise. This method uses the string class names for comparison. See also getting-class-values-from-annotations.- Parameters:
annotationMirror- The annotation mirrorfqcn- the fully qualified class name to check against- Returns:
trueif the provided annotation type is of the same type as the provided class,falseotherwise.
-
getAnnotationMirror
public static javax.lang.model.element.AnnotationMirror getAnnotationMirror(javax.lang.model.element.Element element, java.lang.String fqcn)Checks whether theElementhosts the annotation with the given fully qualified class name.- Parameters:
element- the element to check for the hosted annotationfqcn- the fully qualified class name of the annotation to check for- Returns:
- the annotation mirror for the specified annotation class from the
Elementornullin case theTypeElementdoes not host the specified annotation.
-
getAnnotationValue
public static java.lang.Object getAnnotationValue(javax.lang.model.element.AnnotationMirror annotationMirror, java.lang.String parameterValue)
-
determineAccessTypeForHierarchy
public static void determineAccessTypeForHierarchy(javax.lang.model.element.TypeElement searchedElement, Context context)
-
getCollectionElementType
public static javax.lang.model.type.TypeMirror getCollectionElementType(javax.lang.model.type.DeclaredType t, java.lang.String fqNameOfReturnedType, java.lang.String explicitTargetEntityName, Context context)
-
determineAnnotationSpecifiedAccessType
public static AccessType determineAnnotationSpecifiedAccessType(javax.lang.model.element.Element element)
-
getElementKindForAccessType
public static javax.lang.model.element.ElementKind getElementKindForAccessType(AccessType accessType)
-
getKeyType
public static java.lang.String getKeyType(javax.lang.model.type.DeclaredType t, Context context)
-
-