Found a total of 2 related content
How to declare Java meta-annotation Retention
Article Introduction:1. Annotation declaration: An annotation can be declared through @interface. @Target(ElementType.FIELD)@Retention(RetentionPolicy.RUNTIME)public@interfaceBindView{intvalue();}@Target(ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)public@interfaceGet{Stringvalue()default"";}@ Target
2023-05-03
comment 0
1060
How to use @Retention in java
Article Introduction:Note 1. @Retention defines the length of time that Annotation is retained: some Annotations only appear in the source code, and are discarded by the compiler. Other Annotations compiled in class files may be ignored by the virtual machine, and others are compiled in class files. (Please be careful not to affect the execution of the class, because Annotation and class are separated during use). Use this meta-Annotation to limit the life cycle of Annotation. Function 2: Indicates the level at which the annotation information needs to be saved, and is used to illustrate the life cycle of the annotation, that is, in which range the annotation is valid. Example@Tar
2023-05-25
comment 0
536