@Retention注解功能使用
Retention提供了java.lang.annotation.RetentionPolicy的列举
package test;import java.lang.annotation.*;@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER}) //用于字段,方法,参数@Retention(RetentionPolicy.RUNTIME) //在运行时加载到Annotation到JVM中public @interface Field_Method_Parameter_Annotation { Class type() default void.class; //定义一个具有默认值的Class型成员 String describ(); //定义一个没有默认值的String成员 String name() default ""; //字段属性名称}