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
-
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 Annotation
findAnnotation
(Class<? extends Annotation> aAnnotation, Class<?> aClass) Seeks for anAnnotation
of the given type annotating a providedClass
, also reckoning annotations nested inside annotations (recursively).static Annotation
findAnnotation
(Class<? extends Annotation> aAnnotation, Object aObj) Seeks for anAnnotation
of the given type annotating a providedObject
, also reckoning annotations nested inside annotations (recursively).static Annotation
findAnnotation
(Class<? extends Annotation> aAnnotation, Field aField) Seeks for anAnnotation
of the given type annotating a providedField
, also reckoning annotations nested inside annotations (recursively).static Annotation
findAnnotation
(Class<? extends Annotation> aAnnotation, Method aMethod) Seeks for anAnnotation
of the given type annotating a providedMethod
, also reckoning annotations nested inside annotations (recursively).static boolean
hasAnnotation
(Class<? extends Annotation> aAnnotation, Class<?> aClass) Tests if anAnnotation
of the given type annotates a providedClass
, also reckoning annotations nested inside annotations (recursively).static boolean
hasAnnotation
(Class<? extends Annotation> aAnnotation, Object aObj) Tests if anAnnotation
of the given type annotates a providedObject
, also reckoning annotations nested inside annotations (recursively).static boolean
hasAnnotation
(Class<? extends Annotation> aAnnotation, Field aField) Tests if anAnnotation
of the given type annotates a providedField
, also reckoning annotations nested inside annotations (recursively).static boolean
hasAnnotation
(Class<? extends Annotation> aAnnotation, Method aMethod) Tests if anAnnotation
of 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 anAnnotation
of the given type annotating a providedClass
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aClass
- theClass
which's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotation
annotating the givenClass
or null if none was found
-
findAnnotation
Seeks for anAnnotation
of the given type annotating a providedField
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aField
- theField
which's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotation
annotating the givenField
or null if none was found
-
findAnnotation
Seeks for anAnnotation
of the given type annotating a providedMethod
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aMethod
- theMethod
which's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotation
annotating the givenMethod
or null if none was found
-
findAnnotation
Seeks for anAnnotation
of the given type annotating a providedObject
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aObj
- theObject
which's annotations to crawl.- Returns:
- ReflectionUtility.the
Annotation
annotating the givenObject
or null if none was found
-
hasAnnotation
Tests if anAnnotation
of the given type annotates a providedClass
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aClass
- theClass
which's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotation
annotates the givenClass
.
-
hasAnnotation
Tests if anAnnotation
of the given type annotates a providedField
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aField
- theField
which's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotation
annotates the givenField
.
-
hasAnnotation
Tests if anAnnotation
of the given type annotates a providedMethod
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aMethod
- theMethod
which's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotation
annotates the givenMethod
.
-
hasAnnotation
Tests if anAnnotation
of the given type annotates a providedObject
, also reckoning annotations nested inside annotations (recursively).- Parameters:
aAnnotation
- theAnnotation
type for which to seek.aObj
- theObject
which's annotations to crawl.- Returns:
- ReflectionUtility.True in case the
Annotation
annotates the givenObject
.
-