Meta-annotations
@Target
- CONSTRUCTOR: Constructor declaration
- FIELD: Field declaration (includes enum constants)
- LOCAL_VARIABLE: Local variable declaration METHOD: Method declaration
- PACKAGE: Package declaration
- PARAMETER: Parameter declaration
- TYPE: Class, interface (including annotation type),or enum declaration
@Retention
- SOURCE: Annotations are discarded by thecompiler.
- CLASS: Annotations are available in the class file by the compiler but can be discarded by the VM.
- RUNTIME: Annotations are retained by the VM at run time, so they may be read reflectively.
@Documented
- Include this annotation in the Javadocs.
@Inherited
- Allow subclasses to inherit parent annotations.
时间: 2024-11-06 07:21:09