首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

@Retention诠注功能使用

2012-10-27 
@Retention注解功能使用Retention提供了java.lang.annotation.RetentionPolicy的列举package testimport

@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 ""; //字段属性名称}

热点排行