package com.sean.annotation;
import com.sun.deploy.net.proxy.ProxyType;
import java.lang.annotation.*;
/**
* 测试元注解
* @create 2021-03-04 12:46
*/
public class Demo02 {
@MyAnnotation
public void test(){
}
}
//定义一个注解
//Target 表示我们的注解可以用在哪些地方
@Target(value ={ ElementType.METHOD,ElementType.TYPE})
//Retention 表示我们的注解在什么地方还有效
//runtime>class>source
@Retention(value = RetentionPolicy.RUNTIME)
//Documented 表示是否将我们的注解生成在Javadoc中
@Documented
//Inherited 子类可以继承父类的注解
@Inherited
@interface MyAnnotation{
}
元注解
最新推荐文章于 2024-07-25 13:40:37 发布