What are the exact default values of two meta annotations (Target and Retention) in a user defined annotation?
public @interface AnnotationWithDefaultProps {
}
@interface is used to create your own (custom) Java annotations. Annotations are defined in their own file, just like a Java class or interface. Here is custom Java annotation example: @interface MyAnnotation { String value(); String name(); int age(); String[] newNames(); }
The @Property annotation is used to denote a Java class field, a setter method, or a constructor parameter that is used to inject an SCA property value.
The @interface element is used to declare an annotation. For example: @interface MyAnnotation{}
According to the source code, none of them has a default value, which means you must provide it, whenever you use the annotation. The meaning of the missing annotation is defined in the javadoc:
For Target
it means
If a Target meta-annotation is not present on an annotation type declaration, the declared type may be used on any program element.
and for Retention
it means
If no Retention annotation is present on an annotation type declaration, the retention policy defaults to RetentionPolicy.CLASS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With