自定义Annotation概念篇
来看一个最简单的annotation
package com.cts.elt.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
importjava.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface MyAnnotation1 {
String value();
}
1. Annotation需要声明为@interface这样的东西
2. @Target(ElementType.TYPE)
代码这个annota