说明:
@interface 是说明当前类是一个注解类型,而且在类中可以插入多个自定义注解
定义方法: @interface Annotation名 {定义体}
1.annotations中只有唯一一个成员,则该成员应命名为value:
2.annotaion类型声明是可以标注自己的,这样的annotation被称为“meta-annotations”。
eg: @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Test { }
Method m
m.invoke(null);
m.invoke(param)
AnnotatedElement子类
class
method
Package
constructor
java
@SuppressWarnings("unchecked") 镇压警告
@Override
@Deprecated
Java注解Annotation详解 http://www.cnblogs.com/linjiqin/archive/2011/02/16/1956426.html
meta-annotation http://www.cnblogs.com/mabaishui/archive/2010/07/14/1777087.html
Java annotation入门:http://www.blogjava.net/ericwang/archive/2005/12/13/23743.html
Java annotation 手册: http://www.blogjava.net/mlh123caoer/archive/2007/09/06/143260.html
Java annotation 高级应用: http://www.blogjava.net/wuxufeng8080/articles/93046.html
http://www.matrix.org.cn
http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html
http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html
http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html
http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html
@interface 是说明当前类是一个注解类型,而且在类中可以插入多个自定义注解
定义方法: @interface Annotation名 {定义体}
1.annotations中只有唯一一个成员,则该成员应命名为value:
2.annotaion类型声明是可以标注自己的,这样的annotation被称为“meta-annotations”。
eg: @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Test { }
Method m
m.invoke(null);
m.invoke(param)
AnnotatedElement子类
class
method
Package
constructor
java
@SuppressWarnings("unchecked") 镇压警告
@Override
@Deprecated
Java注解Annotation详解 http://www.cnblogs.com/linjiqin/archive/2011/02/16/1956426.html
meta-annotation http://www.cnblogs.com/mabaishui/archive/2010/07/14/1777087.html
Java annotation入门:http://www.blogjava.net/ericwang/archive/2005/12/13/23743.html
Java annotation 手册: http://www.blogjava.net/mlh123caoer/archive/2007/09/06/143260.html
Java annotation 高级应用: http://www.blogjava.net/wuxufeng8080/articles/93046.html
http://www.matrix.org.cn
http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html
http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html
http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html
http://java.sun.com/j2se/1.5.0/docs/guide/apt/GettingStarted.html