Пример #1
0
 // Ang's suggestion on getting annotation values
 public static String getClassAnnotationValue(
     Class classType, Class annotationType, String attributeName) {
   String value = null;
   Annotation annotation = classType.getAnnotation(annotationType);
   if (annotation != null) {
     try {
       value = (String) annotation.annotationType().getMethod(attributeName).invoke(annotation);
     } catch (Exception ex) {
       System.out.println("Failed loading class annotations");
     }
   }
   return value;
 }