Addendum contains several built-in annotation, which are meant to be used on other annotations. These define constraints of annotations usage.
Disallow annotation if some other annotation exists. This is to avoid using conflicting annotations.
This annotation can only be used on other annotation classes. Only annotation name should be used here, not annotation class name.
Do not use class literals here. Only annotation name as string is recommended.
Assume we are defining
MyAnnotation annotation, and want to forbid
using this annotation with
To achieve this use
Use this annotation to completely ignore method or property metadata. This should be used on components. This can also be used to explicitly mark that entity should be not ignored.
Ignore field or method.
Explicitly mark method or property as not ignored. This might be useful to inform other developers that method or property must be annotated.
Annotation target annotation This allow limiting annotation use for properties, class, method or concrete type Valid values are
class- limit annotation for class only
method- limit annotation for method only
property- limit annotation for property only
nested- set this to allow use of annotation only as nested annotation
- Any existing class name - to restrict use of annotation only on concrete class or its descendants
Allow only on selected class and subclasses
When use statement for
Some\Target\ClassName is provided, it could be shortened:
Several targets can be specified. Only on this class and subclasses - on properties:
Only on this class and subclasses - on methods:
On methods and properties: