Class AnnotationUtils
java.lang.Object
ch.systemsx.cisd.common.reflection.AnnotationUtils
General utility methods for working with annotations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAnnotationUtils.Parameter<A extends Annotation> -
Method Summary
Modifier and TypeMethodDescriptiongetAnnotatedFieldList(Class<?> clazz, Class<? extends Annotation> annotationClass) For givenClassreturns a list of fields that are annotated with given annotationClass.getAnnotatedMethodList(Class<?> clazz, Class<? extends Annotation> annotationClass) For givenClassreturns a list of methods that are annotated with given annotationClass.static final <A extends Annotation>
List<AnnotationUtils.Parameter<A>> getAnnotatedParameters(Method method, Class<A> annotationType) Returns a list of method parameters where given annotation could be found.static final <A extends Annotation>
AtryGetAnnotation(Annotation[] annotations, Class<A> annotationType) From the list of given annotations tries to return the one of given type.
-
Method Details
-
getAnnotatedMethodList
public static final List<Method> getAnnotatedMethodList(Class<?> clazz, Class<? extends Annotation> annotationClass) For givenClassreturns a list of methods that are annotated with given annotationClass. -
getAnnotatedFieldList
public static final List<Field> getAnnotatedFieldList(Class<?> clazz, Class<? extends Annotation> annotationClass) For givenClassreturns a list of fields that are annotated with given annotationClass. -
tryGetAnnotation
public static final <A extends Annotation> A tryGetAnnotation(Annotation[] annotations, Class<A> annotationType) From the list of given annotations tries to return the one of given type.- Returns:
nullif not found.
-
getAnnotatedParameters
public static final <A extends Annotation> List<AnnotationUtils.Parameter<A>> getAnnotatedParameters(Method method, Class<A> annotationType) Returns a list of method parameters where given annotation could be found.- Returns:
- never
nullbut could return an empty list.
-