RetentionPolicy


RetentionPolicy java.lang.annotation

Java 5.0 serializable comparable enum

The constants declared by the enumerated type specify the possible retention values for an @Retention meta-annotation. Annotations with SOURCE retention appear in Java source code only and are discarded by the compiler. Annotations with CLASS retention are compiled into the class file and are visible to tools that read class files but are not loaded by the Java VM at runtime. (This is the default retention for annotation types that do not have an @Retention meta-annotation.) Finally, annotations with RUNTIME retention are stored in the class file and loaded by the Java interpreter at runtime. These annotations are available for reflective access through java.lang.reflect.AnnotatedElement .

Figure 10-81. java.lang.annotation.RetentionPolicy

 public enum  RetentionPolicy  {  // Enumerated Constants   SOURCE  ,  CLASS  ,  RUNTIME  ;  // Public Class Methods  public static RetentionPolicy  valueOf  (String  name  );        public static final RetentionPolicy[ ]  values  ( );   } 

Returned By

Retention.value( )



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