File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Agile Java - what is retention ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Agile Java - what is retention ?" Watch "Agile Java - what is retention ?" New topic

Agile Java - what is retention ?

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, as mentioned in table of content, what is retention actually ?

thank you
Jeff Langr
Ranch Hand

Joined: May 14, 2003
Posts: 799
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.


Books: Pragmatic Unit Testing in Java, Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
I agree. Here's the link:
subject: Agile Java - what is retention ?
jQuery in Action, 3rd edition