http://www.jb51.net/article/55371.htmhttp://www.cnblogs.com/peida/archive/2013/04/24/3036689.html Retention annotations retention (reserved) Note that this type of annotation is retained at that stage. There are three values: 1.retentionpolicy.source--This type of annotations is only preserved at the source level and is ignored at compile time by 2. retentionpolicy.class--This type of annotations is preserved at compile time and exists in the CLASS file, but the JVM will ignore 3.retentionpolicy.runtime-- This type of annotations will be retained by the JVM, so they can be read and used by the JVM or other code that uses the reflection mechanism at runtime. Example of java Annotations 1: Code is as follows: @Retention ( Retentionpolicy.runtime) public @interface test_retention { String dotestretention (); } In this example, the @Retention (retentionpolicy.runtime) Note indicates that the test_retention annotation will be retained by the virtual machine so that it can be read by reflection at run time. documented annotations documented annotations indicate that this annotation should be recorded by the Javadoc tool. By default, Javadoc is not included in annotations. However, if a @Documented is specified when the annotation is declared, it is processed by a tool such as Javadoc, so the annotation type information is also included in the generated document. Example 6 illustrates a further example of using the @Documented: java annotations 2: Copy code code as follows: @Documented public @ Interface test_documented { String dotestdocument () Next, modify the Testannotations class as follows: The code is: public Class TesTannotations { public static void Main (String arg[]) { new testannotations (). Dosome Testretention (); new testannotations (). dosometestdocumented (); } @ Test_retention (dotestretention= "Retain annotation information test") public void dosometestretention () { System.out.printf ("Test note type ' Retention '); } @Test_Documented (dotestdocument=" Hello document ") public void dosometestdocumented () { system.out.printf (" Test note type ' documented ' ") ; } } Now, if you use the Javadoc command to generate a testannotations.html file from what you can see, there is no dosometestretention () method in the document Annotation-type information () method. However, the documentation for the Dosometestdocumented () method provides descriptive information about the annotations. This is because the @Documented tag is added to the test_documented annotation. The previous note, test_retention, does not specify @Documented tag (tag). http://blog.csdn.net/snow_crazy/article/details/ The 39381695Inherited function is to use a custom annotation that is declared with this annotation, and when this custom annotation is used, if the annotation is on top of the class, the subclass automatically inherits the annotation, otherwise the subclass does not inherit the annotation. Here mustRemember that annotations that are declared with inherited are valid only when used on a class, and are not valid for methods, properties, and so on. Http://www.cnblogs.com/peida/archive/2013/04/24/3036689.html
@Target:
@Target illustrates the range of objects that annotation modifies: annotation can be used for packages, types (classes, interfaces, enumerations, annotation types), type members (methods, constructor methods, member variables, enumeration values), Method parameters and local variables (such as loop variables, catch parameters). Target can be more clearly decorated by using target in the declaration of the annotation type.
function: Used to describe the scope of use of annotations (i.e., where the annotations described can be used)
Java meta annotations