Annotation Type Enhancement
-
@Target(METHOD) @Retention(RUNTIME) public @interface Enhancement2nd phase of build compatible extension execution. Allows transforming annotations.In the following text, the term expected types denotes the set of types defined by the
types,withSubtypesandwithAnnotationsmembers of the@Enhancementannotation. The term discovered types denotes the subset of expected types that were discovered during type discovery.Methods annotated
If an@Enhancementmust declare exactly one parameter of one of these types:@Enhancementmethod has a parameter of typeClassConfigorClassInfo, the method is called once for each discovered type.If an
@Enhancementmethod has a parameter of typeMethodConfigorMethodInfo, the method is called once for each constructor or method that is declared on each discovered type, as defined inClassInfo.constructorsandClassInfo.methods.If an
@Enhancementmethod has a parameter of typeFieldConfigorFieldInfo, the method is called once for each field that is declared on each discovered type, as defined inClassInfo.fields.If the
@Enhancementmethod doesn't declare any parameter of one of these types, or if it declares more than one, the container treats it as a definition error.Additionally, methods annotated
@Enhancementmay declare parameters of these types:Finally,
AnnotationBuildermay be used to create instances ofAnnotationInfo.- Since:
- 4.0
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.Class<?>[]typesDefines the set of expected types.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.Class<? extends java.lang.annotation.Annotation>[]withAnnotationsNarrows down the set of expected types, defined bytypesandwithSubtypes, to types that use any of given annotations.booleanwithSubtypesIftrue, the set of expected types includes all direct and indirect subtypes of giventypes.
-
-
-
Element Detail
-
types
java.lang.Class<?>[] types
Defines the set of expected types. IfwithSubtypesistrue, the set of expected types includes all direct and indirect subtypes of these types. IfwithAnnotationsis defined, the set of expected types only includes types that use given annotations.- Returns:
- the set of expected types
-
-
-
withSubtypes
boolean withSubtypes
Iftrue, the set of expected types includes all direct and indirect subtypes of giventypes.- Returns:
- whether subtypes should be included in the set of expected types
- Default:
- false
-
-
-
withAnnotations
java.lang.Class<? extends java.lang.annotation.Annotation>[] withAnnotations
Narrows down the set of expected types, defined bytypesandwithSubtypes, to types that use any of given annotations. The annotation can appear on the type, or on any member of the type, or on any parameter of any member of the type, or as a meta-annotation on any annotation that is considered by these rules.If empty, the set of expected types is not narrowed down in any way. If
java.lang.Annotationis present, the set of expected types is narrowed down to types that use any annotation.Defaults to an empty array, so that the set of expected types is not narrowed down in any way.
- Returns:
- types of annotations that must be present on the expected types
- Default:
- {}
-
-