|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.metamodel.source.annotations.JandexHelper
public class JandexHelper
Utility methods for working with the jandex annotation index.
Method Summary | ||
---|---|---|
static boolean |
containsSingleAnnotations(Map<org.jboss.jandex.DotName,List<org.jboss.jandex.AnnotationInstance>> annotations,
org.jboss.jandex.DotName annotationName)
|
|
static
|
getEnumValue(org.jboss.jandex.AnnotationInstance annotation,
String element,
Class<T> type)
Retrieves a jandex annotation element value, converting it to the supplied enumerated type. |
|
static Map<org.jboss.jandex.DotName,List<org.jboss.jandex.AnnotationInstance>> |
getMemberAnnotations(org.jboss.jandex.ClassInfo classInfo,
String name)
|
|
static String |
getPropertyName(org.jboss.jandex.AnnotationTarget target)
Expects a method or field annotation target and returns the property name for this target |
|
static org.jboss.jandex.AnnotationInstance |
getSingleAnnotation(org.jboss.jandex.ClassInfo classInfo,
org.jboss.jandex.DotName annotationName)
|
|
static org.jboss.jandex.AnnotationInstance |
getSingleAnnotation(Map<org.jboss.jandex.DotName,List<org.jboss.jandex.AnnotationInstance>> annotations,
org.jboss.jandex.DotName annotationName)
|
|
static
|
getValue(org.jboss.jandex.AnnotationInstance annotation,
String element,
Class<T> type)
Retrieves a jandex annotation element value. |
|
static org.jboss.jandex.Index |
indexForClass(ClassLoaderService classLoaderService,
Class<?>... classes)
Creates a jandex index for the specified classes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <T> T getValue(org.jboss.jandex.AnnotationInstance annotation, String element, Class<T> type) throws AssertionFailure
null
, the default value specified in the
annotation class is retrieved instead.
There are two special cases. Class
parameters should be retrieved as strings (and then can later be
loaded) and enumerated values should be retrieved via getEnumValue(AnnotationInstance, String, Class)
.
annotation
- the annotation containing the element with the supplied nameelement
- the name of the element value to be retrievetype
- the type of element to retrieve. The following types are supported:
null
, else the default value if not
null
, else null
.
AssertionFailure
- in case the specified type
is a class instance or the specified type causes a ClassCastException
when retrieving the value.public static <T extends Enum<T>> T getEnumValue(org.jboss.jandex.AnnotationInstance annotation, String element, Class<T> type)
null
, the default value specified in the annotation class is retrieved instead.
T
- an enumerated typeannotation
- the annotation containing the enumerated element with the supplied nameelement
- the name of the enumerated element value to be retrievetype
- the type to which to convert the value before being returned
null
, else the default value if
not null
, else null
.getValue(AnnotationInstance, String, Class)
public static String getPropertyName(org.jboss.jandex.AnnotationTarget target)
target
- the annotation target
public static org.jboss.jandex.AnnotationInstance getSingleAnnotation(org.jboss.jandex.ClassInfo classInfo, org.jboss.jandex.DotName annotationName) throws AssertionFailure
classInfo
- the class info from which to retrieve the annotation instanceannotationName
- the annotation to retrieve from the class info
null
in case the annotation is not specified at all
AssertionFailure
- in case there is there is more than one annotation of this type.public static org.jboss.jandex.AnnotationInstance getSingleAnnotation(Map<org.jboss.jandex.DotName,List<org.jboss.jandex.AnnotationInstance>> annotations, org.jboss.jandex.DotName annotationName) throws AssertionFailure
annotations
- List of annotation instances keyed against their dot name.annotationName
- the annotation to retrieve from map
null
in case the annotation is not specified at all
AssertionFailure
- in case there is there is more than one annotation of this type.public static boolean containsSingleAnnotations(Map<org.jboss.jandex.DotName,List<org.jboss.jandex.AnnotationInstance>> annotations, org.jboss.jandex.DotName annotationName) throws AssertionFailure
annotations
- List of annotation instances keyed against their dot name.annotationName
- the annotation to check
true
if the map contains only a single instance of specified annotation or false
otherwise.
AssertionFailure
- in case there is there is more than one annotation of this type.public static org.jboss.jandex.Index indexForClass(ClassLoaderService classLoaderService, Class<?>... classes)
classLoaderService
- class loader serviceclasses
- the classes to index
public static Map<org.jboss.jandex.DotName,List<org.jboss.jandex.AnnotationInstance>> getMemberAnnotations(org.jboss.jandex.ClassInfo classInfo, String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |