• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Agile Java - what is retention ?

 
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, as mentioned in table of content, what is retention actually ?

thank you
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings Alvin,

Thanks for the query. "Retention" is discussed in the chapter on annotations. When creating your own custom annotations, you can specify how long they should be retained (kept around). This retention period can be one of three enum values: RetentionPolicy.SOURCE, RetentionPolicy.CLASS (which is the default), or RetentionPolicy.RUNTIME.

You might use RetentionPolicy.SOURCE if you've created an annotation that only an IDE needs to use. For example, you might have an @Todo annotation that marks sections of code as needing more work. This annotation information gets discarded when the code is compiled.

RetentionPolicy.CLASS means the annotation is stored in the class file, but the VM can choose to discard it at runtime.

RetentionPolicy.RUNTIME means that the annotation sticks around in the class file and is available at runtime. Sun modified the reflection API to allow extracting this annotation information at runtime.

-Jeff-
 
Slime does not pay. Always keep your tiny ad dry.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic