元注解

 1 package cn.itcast.day_04.demo_06;
 2 
 3 import java.lang.annotation.*;
 4 
 5 public class Annoation_test {
 6 
 7     //Target: 表示我们的注解可以用在什么地方
 8     @Target(value = {ElementType.METHOD, ElementType.TYPE})
 9 
10     //Retention: 表示我们的注解在什么地方有效
11     @Retention(value = RetentionPolicy.RUNTIME)
12 
13     //Documented: 表示是否将注解生成到文档中
14     @Documented
15 
16     //Inherited: 表示子类可以继承父类中的该注解
17     @Inherited
18     @interface myAnnotatio{
19         
20     }
21 }

元注解有四种:

  Target

  Retention

  Documented

  Inherited

原文地址:https://www.cnblogs.com/nnnnbbbb1/p/12966776.html