Meta ‘Retention’ Annotation

The retention annotation indicates where and how long annotations with this type are to be retained. There are three values:

  • SOURCE—Annotations with this type will be by retained only at the source level and will be ignored by the compiler.
  • CLASS—Annotations with this type will be by retained by the compiler at compile time, but will be ignored by the VM.
  • RUNTIME—Annotations with this type will be retained by the VM so they can be read only at run-time.






  1. Annotations and Its Benefits in Java
  2. Advantages Of Annotations Over XML
  3. Annotation Programming Basics
  4. Annotation Types
    1. Simple Annotation
    2. Meta Annotation
      1. Meta ‘Target’ Annotation
      2. Meta ‘Retention’ Annotation
      3. Meta ‘Documented’ Annotation
      4. Meta ‘Inherited’ Annotation
  5. Reflection to Extract Annotation Details

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.