Top Description Methods
jakarta.enterprise.inject.build.compatible.spi

public @Interface Enhancement

extends Annotation
Annotations
@Target:METHOD
@Retention:RUNTIME
Imports
java.lang.annotation.Annotation, .ElementType, .Retention, .RetentionPolicy, .Target

2nd 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, withSubtypes and withAnnotations members of the @Enhancement annotation. The term discovered types denotes the subset of expected types that were discovered during type discovery.

Methods annotated @Enhancement must declare exactly one parameter of one of these types:

If an @Enhancement method has a parameter of type ClassConfig or ClassInfo, the method is called once for each discovered type.

If an @Enhancement method has a parameter of type MethodConfig or MethodInfo, the method is called once for each constructor or method that is declared on each discovered type, as defined in ClassInfo.constructors and ClassInfo.methods.

If an @Enhancement method has a parameter of type FieldConfig or FieldInfo, the method is called once for each field that is declared on each discovered type, as defined in ClassInfo.fields.

If the @Enhancement method 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 @Enhancement may declare parameters of these types:

Finally, AnnotationBuilder may be used to create instances of AnnotationInfo.

Since
4.0

Method Summary

Modifier and TypeMethod and Description
public Class<?>[]

Returns:

the set of expected types
types
()

Defines the set of expected types.

public Class<? extends Annotation>[]

Returns:

types of annotations that must be present on the expected types
withAnnotations
()

Narrows down the set of expected types, defined by types and withSubtypes, to types that use any of given annotations.

public boolean

Returns:

whether subtypes should be included in the set of expected types
withSubtypes
()

If true, the set of expected types includes all direct and indirect subtypes of given types.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

typesback to summary
public Class<?>[] types()

Defines the set of expected types. If withSubtypes is true, the set of expected types includes all direct and indirect subtypes of these types. If withAnnotations is defined, the set of expected types only includes types that use given annotations.

Returns:Class<?>[]

the set of expected types

withAnnotationsback to summary
public Class<? extends Annotation>[] withAnnotations()

Narrows down the set of expected types, defined by types and withSubtypes, 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.Annotation is 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:Class<? extends Annotation>[]

types of annotations that must be present on the expected types

withSubtypesback to summary
public boolean withSubtypes()

If true, the set of expected types includes all direct and indirect subtypes of given types.

Returns:boolean

whether subtypes should be included in the set of expected types