1 22 package org.jboss.aop.annotation; 23 24 import java.lang.annotation.Annotation ; 25 import java.lang.reflect.Constructor ; 26 import java.lang.reflect.Field ; 27 import java.lang.reflect.Method ; 28 29 37 public class AnnotationElement extends PortableAnnotationElement 38 { 39 47 public static Object getVisibleAnnotation(Method method, Class annotation) 48 { 49 return method.getAnnotation(annotation); 50 } 51 52 60 public static Object getVisibleAnnotation(Constructor con, Class annotation) 61 { 62 return con.getAnnotation(annotation); 63 } 64 65 73 public static Object getVisibleAnnotation(Field field, Class annotation) 74 { 75 return field.getAnnotation(annotation); 76 } 77 78 86 public static Object getVisibleAnnotation(Class clazz, Class annotation) 87 { 88 return clazz.getAnnotation(annotation); 89 } 90 91 public static boolean isVisibleAnnotationPresent(Class clazz, Class annotation) 92 { 93 return clazz.isAnnotationPresent(annotation); 94 } 95 96 public static boolean isVisibleAnnotationPresent(Method m, Class annotation) 97 { 98 return m.isAnnotationPresent(annotation); 99 } 100 101 public static boolean isVisibleAnnotationPresent(Field f, Class annotation) 102 { 103 return f.isAnnotationPresent(annotation); 104 } 105 106 public static boolean isVisibleAnnotationPresent(Constructor con, Class annotation) 107 { 108 return con.isAnnotationPresent(annotation); 109 } 110 111 public static Object [] getVisibleAnnotations(Class clazz) throws Exception 112 { 113 return clazz.getAnnotations(); 114 } 115 116 public static Object [] getVisibleAnnotations(Method m) throws Exception 117 { 118 return m.getAnnotations(); 119 } 120 121 public static Object [] getVisibleAnnotations(Field f) throws Exception 122 { 123 return f.getAnnotations(); 124 } 125 126 public static Object [] getVisibleAnnotations(Constructor c) throws Exception 127 { 128 return c.getAnnotations(); 129 } 130 } 131 | Popular Tags |