org.hibernate.jpamodelgen.util
Class TypeUtils

java.lang.Object
  extended by org.hibernate.jpamodelgen.util.TypeUtils

public final class TypeUtils
extends Object

Utility class.

Author:
Max Andersen, Hardy Ferentschik, Emmanuel Bernard

Field Summary
static String DEFAULT_ANNOTATION_PARAMETER_NAME
           
 
Method Summary
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ANNOTATION_PARAMETER_NAME

public static final String DEFAULT_ANNOTATION_PARAMETER_NAME
See Also:
Constant Field Values
Method Detail

toTypeString

public static String toTypeString(TypeMirror type)

getSuperclassTypeElement

public static TypeElement getSuperclassTypeElement(TypeElement element)

extractClosestRealTypeAsString

public static String extractClosestRealTypeAsString(TypeMirror type,
                                                    Context context)

containsAnnotation

public static boolean containsAnnotation(Element element,
                                         String... annotations)

isAnnotationMirrorOfType

public 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. This method uses the string class names for comparison. See also getting-class-values-from-annotations.

Parameters:
annotationMirror - The annotation mirror
fqcn - 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

public static AnnotationMirror getAnnotationMirror(Element element,
                                                   String fqcn)
Checks whether the Element hosts the annotation with the given fully qualified class name.

Parameters:
element - the element to check for the hosted annotation
fqcn - the fully qualified class name of the annotation to check for
Returns:
the annotation mirror for the specified annotation class from the Element or null in case the TypeElement does not host the specified annotation.

getAnnotationValue

public static Object getAnnotationValue(AnnotationMirror annotationMirror,
                                        String parameterValue)

determineAccessTypeForHierarchy

public static void determineAccessTypeForHierarchy(TypeElement searchedElement,
                                                   Context context)

getCollectionElementType

public static TypeMirror getCollectionElementType(DeclaredType t,
                                                  String fqNameOfReturnedType,
                                                  String explicitTargetEntityName,
                                                  Context context)

determineAnnotationSpecifiedAccessType

public static AccessType determineAnnotationSpecifiedAccessType(Element element)

getElementKindForAccessType

public static ElementKind getElementKindForAccessType(AccessType accessType)

getKeyType

public static String getKeyType(DeclaredType t,
                                Context context)


Copyright © 2009-2012. All Rights Reserved.