java.lang.Object
org.refcodes.runtime.AnnotationSugar
Declarative syntactic sugar which may be statically imported in order to
allow declarative definitions for
Annotation related functionality.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<Annotation>annotations(Class<?> aClass) Gatherers all annotations annotating a providedClass.static Set<Annotation>annotations(Object aObj) Gatherers all annotations annotating a providedObject.static Set<Annotation>annotations(Field aField) Gatherers all annotations annotating a providedField.static Set<Annotation>annotations(Method aMethod) Gatherers all annotations annotating a providedMethod.static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Class<?> aClass) Seeks for anAnnotationof the given type annotating a providedClass, also reckoning annotations nested inside annotations (recursively).static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Object aObj) Seeks for anAnnotationof the given type annotating a providedObject, also reckoning annotations nested inside annotations (recursively).static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Field aField) Seeks for anAnnotationof the given type annotating a providedField, also reckoning annotations nested inside annotations (recursively).static AnnotationfindAnnotation(Class<? extends Annotation> aAnnotation, Method aMethod) Seeks for anAnnotationof the given type annotating a providedMethod, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Class<?> aClass) Tests if anAnnotationof the given type annotates a providedClass, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Object aObj) Tests if anAnnotationof the given type annotates a providedObject, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Field aField) Tests if anAnnotationof the given type annotates a providedField, also reckoning annotations nested inside annotations (recursively).static booleanhasAnnotation(Class<? extends Annotation> aAnnotation, Method aMethod) Tests if anAnnotationof the given type annotates a providedMethod, also reckoning annotations nested inside annotations (recursively).
-
Constructor Details
-
AnnotationSugar
public AnnotationSugar()
-
-
Method Details
-
annotations
Gatherers all annotations annotating a providedClass. -
annotations
Gatherers all annotations annotating a providedField. -
annotations
Gatherers all annotations annotating a providedMethod. -
annotations
Gatherers all annotations annotating a providedObject. -
findAnnotation
Seeks for anAnnotationof the given type annotating a providedClass, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aClass- theClasswhich's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotationannotating the givenClassor null if none was found
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedField, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aField- theFieldwhich's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotationannotating the givenFieldor null if none was found
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedMethod, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aMethod- theMethodwhich's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotationannotating the givenMethodor null if none was found
-
findAnnotation
Seeks for anAnnotationof the given type annotating a providedObject, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aObj- theObjectwhich's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotationannotating the givenObjector null if none was found
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedClass, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aClass- theClasswhich's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotationannotates the givenClass.
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedField, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aField- theFieldwhich's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotationannotates the givenField.
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedMethod, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aMethod- theMethodwhich's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotationannotates the givenMethod.
-
hasAnnotation
Tests if anAnnotationof the given type annotates a providedObject, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation- theAnnotationtype for which to seek.aObj- theObjectwhich's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotationannotates the givenObject.
-