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

public Interface MetaAnnotations

Imports
java.lang.annotation.Annotation, jakarta.enterprise.context.spi.AlterableContext

Allows registering custom CDI meta-annotations: qualifiers, interceptor bindings, stereotypes, and scopes. When registering a custom scope, a context class must also be provided.
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public void
addContext(Class<? extends Annotation>
the scope annotation type, must not be null
scopeAnnotation
,
Class<? extends AlterableContext>
the context class, must not be null
contextClass
)

Registers custom context for given scopeAnnotation and given contextClass.

public void
addContext(Class<? extends Annotation>
the scope annotation type, must not be null
scopeAnnotation
,
boolean
whether the scope is normal
isNormal
,
Class<? extends AlterableContext>
the context class, must not be null
contextClass
)

Registers custom context for given scopeAnnotation and given contextClass.

public ClassConfig

Returns:

the class configurator, never null
addInterceptorBinding
(Class<? extends Annotation>
annotation type
annotation
)

Registers annotation as an interceptor binding annotation.

public ClassConfig

Returns:

the class configurator, never null
addQualifier
(Class<? extends Annotation>
annotation type
annotation
)

Registers annotation as a qualifier annotation.

public ClassConfig

Returns:

the class configurator, never null
addStereotype
(Class<? extends Annotation>
annotation type
annotation
)

Registers annotation as a stereotype annotation.

Method Detail

addContextback to summary
public void addContext(Class<? extends Annotation> scopeAnnotation, Class<? extends AlterableContext> contextClass)

Registers custom context for given scopeAnnotation and given contextClass. CDI container will create an instance of the context class once to obtain the context object. The context class must be public and have a public zero-parameter constructor; it must not be a bean.

Whether the scope is normal is discovered from the scope annotation. This means that the scope annotation must be meta-annotated either @NormalScope or @Scope.

Parameters
scopeAnnotation:Class<? extends Annotation>

the scope annotation type, must not be null

contextClass:Class<? extends AlterableContext>

the context class, must not be null

Exceptions
IllegalArgumentException:
if the scopeAnnotation is not meta-annotated @NormalScope or @Scope
addContextback to summary
public void addContext(Class<? extends Annotation> scopeAnnotation, boolean isNormal, Class<? extends AlterableContext> contextClass)

Registers custom context for given scopeAnnotation and given contextClass. CDI container will create an instance of the context class once to obtain the context object. The context class must be public and have a public zero-parameter constructor; it must not be a bean.

The isNormal parameter determines whether the scope is a normal scope or a pseudo-scope.

Parameters
scopeAnnotation:Class<? extends Annotation>

the scope annotation type, must not be null

isNormal:boolean

whether the scope is normal

contextClass:Class<? extends AlterableContext>

the context class, must not be null

addInterceptorBindingback to summary
public ClassConfig addInterceptorBinding(Class<? extends Annotation> annotation)

Registers annotation as an interceptor binding annotation. Only makes sense if the annotation is not meta-annotated @InterceptorBinding.

Returns a class configurator object that allows transforming meta-annotations on the annotation.

Parameters
annotation:Class<? extends Annotation>

annotation type

Returns:ClassConfig

the class configurator, never null

addQualifierback to summary
public ClassConfig addQualifier(Class<? extends Annotation> annotation)

Registers annotation as a qualifier annotation. Only makes sense if the annotation is not meta-annotated @Qualifier.

Returns a class configurator object that allows transforming meta-annotations on the annotation.

Parameters
annotation:Class<? extends Annotation>

annotation type

Returns:ClassConfig

the class configurator, never null

addStereotypeback to summary
public ClassConfig addStereotype(Class<? extends Annotation> annotation)

Registers annotation as a stereotype annotation. Only makes sense if the annotation is not meta-annotated @Stereotype.

Returns a class configurator object that allows transforming meta-annotations on the annotation.

Parameters
annotation:Class<? extends Annotation>

annotation type

Returns:ClassConfig

the class configurator, never null