20230707 java.lang.annotation.RetentionPolicy

介绍

  • java.lang.annotation.RetentionPolicy
  • public enum RetentionPolicy
  • 保留策略
  • 配合 @Retention 元注解使用

API

enum

  • SOURCE
    • 不包括在类文件中的注解
  • CLASS
    • 包括在类文件中的注解,但是虚拟机不需要将它们载入
    • 默认
  • RUNTIME
    • 包括在类文件中的注解,并由虚拟机载入。通过反射 API 可获得它们
posted @ 2023-08-24 10:25  流星<。)#)))≦  阅读(2)  评论(0编辑  收藏  举报