AnnotatedElement


AnnotatedElement java.lang.reflect

Java 5.0

This interface is implemented by the classes representing program elements that can be annotated in Java 5.0: java.lang.Class , java.lang.Package , Method , Constructor , and Field . The methods of this interface allow you to test for the presence of a specific annotation, query an annotation object of a specific type, or query all annotations present on an annotated element. getdeclaredAnnotations( ) differs from getAnnotations( ) in that it does not include inherited annotations. (See the java.lang.annotation.Inherited meta-annotation.) If no annotations are present, getAnnotations( ) and geTDeclaredAnnotations( ) return an array of length zero rather than null . It is safe to modify the arrays returned by these methods.

See also the getParameterAnnotations( ) methods of Method and Constructor , which provide access to annotations on method parameters.

 public interface  AnnotatedElement  {  // Public Instance Methods  <T extends java.lang.annotation.Annotation> T  getAnnotation  (Class<T>  annotationType  );        java.lang.annotation.Annotation[ ]  getAnnotations  ( );        java.lang.annotation.Annotation[ ]  getDeclaredAnnotations  ( );        boolean  isAnnotationPresent  (Class<? extends java.lang.annotation.Annotation>  annotationType  );   } 

Implementations

Class , Package , AccessibleObject



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net