private boolean isAnnotationPresent( Annotation[] annotations, Class<? extends Annotation> annotationClass) { for (Annotation annotation : annotations) { if (annotationClass.isInstance(annotation)) { return true; } } return false; }
private String getValue(Annotation[] annotations, Class<? extends Annotation> annotationClass) { for (Annotation annotation : annotations) { if (annotationClass.isInstance(annotation)) { Method valueMethod = ReflectionUtils.findMethod(annotationClass, "value"); if (valueMethod != null) { return (String) ReflectionUtils.invokeMethod(valueMethod, annotation); } else { return null; } } } return null; }