- java.lang.Object
-
- org.refcodes.runtime.AnnotationSugar
-
public class AnnotationSugar extends Object
Declarative syntactic sugar which may be statically imported in order to allow declarative definitions forAnnotationrelated functionality.
-
-
Constructor Summary
Constructors Constructor Description AnnotationSugar()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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).
-
-
-
Method Detail
-
annotations
public static Set<Annotation> annotations(Class<?> aClass)
Gatherers all annotations annotating a providedClass.
-
annotations
public static Set<Annotation> annotations(Field aField)
Gatherers all annotations annotating a providedField.
-
annotations
public static Set<Annotation> annotations(Method aMethod)
Gatherers all annotations annotating a providedMethod.
-
annotations
public static Set<Annotation> annotations(Object aObj)
Gatherers all annotations annotating a providedObject.
-
findAnnotation
public static Annotation findAnnotation(Class<? extends Annotation> aAnnotation, Class<?> aClass)
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
public static Annotation findAnnotation(Class<? extends Annotation> aAnnotation, Field aField)
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
public static Annotation findAnnotation(Class<? extends Annotation> aAnnotation, Method aMethod)
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
public static Annotation findAnnotation(Class<? extends Annotation> aAnnotation, Object aObj)
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
public static boolean hasAnnotation(Class<? extends Annotation> aAnnotation, Class<?> aClass)
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
public static boolean hasAnnotation(Class<? extends Annotation> aAnnotation, Field aField)
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
public static boolean hasAnnotation(Class<? extends Annotation> aAnnotation, Method aMethod)
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
public static boolean hasAnnotation(Class<? extends Annotation> aAnnotation, Object aObj)
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.
-
-