我们扯淡到java的知识,最好是先参考别人的文章,或者看官方的 自己能力有限,所以只是简单扯扯,有兴趣,最好自己看官方的解释
我们先看一下java官方的api http://docs.oracle.com/javase/8/docs/api/index.html
对应的注解,在lang包下
因为重点是Eventbus,所以简单了解下使用即可 (有时间看自己的能力,再能不能写注解和反射的分析)
这里面,先看几个接口:(都是带@的, 比较好玩)
public enum ElementType {
/** Class, interface (including annotation type), or enum declaration */
TYPE,
/** Field declaration (includes enum constants) */
FIELD,
/** Method declaration */
METHOD,
/** Formal parameter declaration */
PARAMETER,
/** Constructor declaration */
CONSTRUCTOR,
/** Local variable declaration */
LOCAL_VARIABLE,
/** Annotation type declaration */
ANNOTATION_TYPE,
/** Package declaration */
PACKAGE,
/**
* Type parameter declaration
*
* @since 1.8
*/
TYPE_PARAMETER,
/**
* Use of a type
*
* @since 1.8
*/
TYPE_USE
}
public enum RetentionPolicy {
/**
* Annotations are to be discarded by the compiler.
*/
SOURCE,
/**
* Annotations are to be recorded in the class file by the compiler
* but need not be retained by the VM at run time. This is the default
* behavior.
*/
CLASS,
/**
* Annotations are to be recorded in the class file by the compiler and
* retained by the VM at run time, so they may be read reflectively.
*
* @see java.lang.reflect.AnnotatedElement
*/
RUNTIME
}
前面4个是java5开始的,后面2个是java8才有的, 自己也没有怎么试用过(这2个不扯淡了)