@Todo("Just articleware") public @interface Todo{ public enum Priority { LOW, MEDIUM, HIGH } String value(); String[] owners() default ""; Priority priority() default Priority.MEDIUM; }
@Todo( value="Class scope", priority=Unfinished.Priority.LOW ) public class TodoDemo { @Todo("Constructor scope")//通过快捷方式,设置value的值 public TodoDemo() { } @Todo(owner="Jason", value="Method scope") public void foo() { } }
package com.robin; import java.lang.annotation.*; @Todo("Just articleware") @Documented public @interface Todo{ ...
package com.robin; import java.lang.annotation.*; @Todo("Just articleware") @Documented @Retention(RetentionPolicy.RUNTIME) public @interface Todo{ ...
package com.robin; import java.lang.annotation.*; @Todo("Just articleware") @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE,ElementType.METHOD, ElementType.CONSTRUCTOR,ElementType.ANNOTATION_TYPE, ElementType.PACKAGE}) public @interface Todo{ ...
package com.robin; import java.lang.annotation.*; @Todo("Just articleware") @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE,ElementType.METHOD, ElementType.CONSTRUCTOR,ElementType.ANNOTATION_TYPE, ElementType.PACKAGE}) @Inherited public @interface Todo{ public enum Priority { LOW, MEDIUM, HIGH } String value(); String[] owners() default ""; Priority priority() default Priority.MEDIUM; }
@interface java注解,布布扣,bubuko.com
原文:http://www.cnblogs.com/rosepotato/p/3578244.html