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

public Interface SyntheticObserverBuilder<T>

Type Parameters
<T>
the observed event type of this synthetic observer
Imports
java.lang.annotation.Annotation, jakarta.enterprise.event.TransactionPhase, jakarta.enterprise.lang.model.AnnotationInfo, jakarta.enterprise.lang.model.declarations.ClassInfo, jakarta.enterprise.lang.model.types.Type

Builder for synthetic observers. Instances are not reusable. For each synthetic observer, new instance must be created by SyntheticComponents#addObserver(Class) or SyntheticComponents#addObserver(Type).
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
async
(boolean
whether this synthetic observer should be asynchronous
isAsync
)

Marks this synthetic observer as asynchronous if desired.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
declaringClass
(Class<?>
bean class that "declares" this synthetic observer, must not be null
declaringClass
)

Sets the bean class that "declares" this synthetic observer.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
declaringClass
(ClassInfo
bean class that "declares" this synthetic observer, must not be null
declaringClass
)

Sets the bean class that "declares" this synthetic observer.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
observeWith
(Class<? extends SyntheticObserver<T>>
the event notification function class, must not be null
observerClass
)

Sets the class of the synthetic observer event notification function.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
priority
(int
the priority of this synthetic observer
priority
)

Sets a priority of this synthetic observer.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
qualifier
(Class<? extends Annotation>
the type of the marker annotation, must not be null
annotationType
)

Adds a marker annotation of given type to the set of qualifiers of this synthetic observer.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
qualifier
(AnnotationInfo
the annotation, must not be null
qualifierAnnotation
)

Adds given annotation to the set of qualifiers of this synthetic observer.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
qualifier
(Annotation
the annotation, must not be null
qualifierAnnotation
)

Adds given annotation to the set of qualifiers of this synthetic observer.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
transactionPhase
(TransactionPhase
the TransactionPhase, must not be null
transactionPhase
)

Sets the TransactionPhase during which this synthetic observer should be notified.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
boolean
the parameter value
value
)

Adds a boolean-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
boolean[]
the parameter value
value
)

Adds a boolean array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
int
the parameter value
value
)

Adds an int-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
int[]
the parameter value
value
)

Adds an int array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
long
the parameter value
value
)

Adds a long-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
long[]
the parameter value
value
)

Adds a long array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
double
the parameter value
value
)

Adds a double-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
double[]
the parameter value
value
)

Adds a double array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
String
the parameter value
value
)

Adds a String-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
String[]
the parameter value
value
)

Adds a String array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
Enum<?>
the parameter value
value
)

Adds an enum-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
Enum<?>[]
the parameter value
value
)

Adds an enum array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
Class<?>
the parameter value
value
)

Adds a Class-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
ClassInfo
the parameter value
value
)

Adds a Class-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
Class<?>[]
the parameter value
value
)

Adds a Class array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
ClassInfo[]
the parameter value
value
)

Adds a Class array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
AnnotationInfo
the parameter value
value
)

Adds an annotation-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
Annotation
the parameter value
value
)

Adds an annotation-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
AnnotationInfo[]
the parameter value
value
)

Adds an annotation array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticObserverBuilder
withParam
(String
the parameter key, must not be null
key
,
Annotation[]
the parameter value
value
)

Adds an annotation array-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticBeanBuilder
withParam
(String
the parameter key, must not be null
key
,
InvokerInfo
the parameter value
value
)

Adds an invoker-valued parameter to the parameter map.

public SyntheticObserverBuilder<T>

Returns:

this SyntheticBeanBuilder
withParam
(String
the parameter key, must not be null
key
,
InvokerInfo[]
the parameter value
value
)

Adds an invoker array-valued parameter to the parameter map.

Method Detail

asyncback to summary
public SyntheticObserverBuilder<T> async(boolean isAsync)

Marks this synthetic observer as asynchronous if desired.

If not called, this synthetic observer will not be asynchronous.

Parameters
isAsync:boolean

whether this synthetic observer should be asynchronous

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

Exceptions
IllegalStateException:
if this method is called multiple times
declaringClassback to summary
public SyntheticObserverBuilder<T> declaringClass(Class<?> declaringClass)

Sets the bean class that "declares" this synthetic observer.

If not called, the class declaring the extension which creates this synthetic observer is used.

Parameters
declaringClass:Class<?>

bean class that "declares" this synthetic observer, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

Exceptions
IllegalStateException:
if this method is called multiple times
declaringClassback to summary
public SyntheticObserverBuilder<T> declaringClass(ClassInfo declaringClass)

Sets the bean class that "declares" this synthetic observer.

If not called, the class declaring the extension which creates this synthetic observer is used.

Parameters
declaringClass:ClassInfo

bean class that "declares" this synthetic observer, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

Exceptions
IllegalStateException:
if this method is called multiple times
observeWithback to summary
public SyntheticObserverBuilder<T> observeWith(Class<? extends SyntheticObserver<T>> observerClass)

Sets the class of the synthetic observer event notification function. CDI container will create an instance of the event notification function every time when it needs to notify the synthetic observer. The class must be public and have a public zero-parameter constructor; it must not be a bean.

If not called, the synthetic observer registration will fail.

Parameters
observerClass:Class<? extends SyntheticObserver<T>>

the event notification function class, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

Exceptions
IllegalStateException:
if this method is called multiple times
priorityback to summary
public SyntheticObserverBuilder<T> priority(int priority)

Sets a priority of this synthetic observer.

If not called, this synthetic observer will have a default priority of Priority.APPLICATION + 500.

Parameters
priority:int

the priority of this synthetic observer

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

Exceptions
IllegalStateException:
if this method is called multiple times
qualifierback to summary
public SyntheticObserverBuilder<T> qualifier(Class<? extends Annotation> annotationType)

Adds a marker annotation of given type to the set of qualifiers of this synthetic observer. This method may be called multiple times to add multiple qualifiers.

If not called, this synthetic observer will have no qualifier.

Parameters
annotationType:Class<? extends Annotation>

the type of the marker annotation, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

qualifierback to summary
public SyntheticObserverBuilder<T> qualifier(AnnotationInfo qualifierAnnotation)

Adds given annotation to the set of qualifiers of this synthetic observer. This method may be called multiple times to add multiple qualifiers.

If not called, this synthetic observer will have no qualifier.

Parameters
qualifierAnnotation:AnnotationInfo

the annotation, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

qualifierback to summary
public SyntheticObserverBuilder<T> qualifier(Annotation qualifierAnnotation)

Adds given annotation to the set of qualifiers of this synthetic observer. This method may be called multiple times to add multiple qualifiers.

If not called, this synthetic observer will have no qualifier.

Parameters
qualifierAnnotation:Annotation

the annotation, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

transactionPhaseback to summary
public SyntheticObserverBuilder<T> transactionPhase(TransactionPhase transactionPhase)

Sets the TransactionPhase during which this synthetic observer should be notified. If anything else than TransactionPhase#IN_PROGRESS is passed, this synthetic observer will be a transactional observer.

If not called, this synthetic observer will not be a transactional observer. In other words, the default is TransactionPhase#IN_PROGRESS.

Note that transactional observers cannot be asynchronous. If this synthetic observer is configured to be both transactional and asynchronous, its registration will fail.

Parameters
transactionPhase:TransactionPhase

the TransactionPhase, must not be null

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

Exceptions
IllegalStateException:
if this method is called multiple times
withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, boolean value)

Adds a boolean-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:boolean

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, boolean[] value)

Adds a boolean array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:boolean[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, int value)

Adds an int-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:int

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, int[] value)

Adds an int array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:int[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, long value)

Adds a long-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:long

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, long[] value)

Adds a long array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:long[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, double value)

Adds a double-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:double

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, double[] value)

Adds a double array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:double[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, String value)

Adds a String-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:String

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, String[] value)

Adds a String array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:String[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, Enum<?> value)

Adds an enum-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:Enum<?>

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, Enum<?>[] value)

Adds an enum array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:Enum<?>[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, Class<?> value)

Adds a Class-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:Class<?>

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, ClassInfo value)

Adds a Class-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

When looked up from the parameter map in the event notification function, the value will be an instance of Class, not a ClassInfo.

Parameters
key:String

the parameter key, must not be null

value:ClassInfo

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, Class<?>[] value)

Adds a Class array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:Class<?>[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, ClassInfo[] value)

Adds a Class array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

When looked up from the parameter map in the event notification function, the values will be instances of Class, not ClassInfo.

Parameters
key:String

the parameter key, must not be null

value:ClassInfo[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, AnnotationInfo value)

Adds an annotation-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

When looked up from the parameter map in the event notification function, the value will be an instance of the annotation type, not an AnnotationInfo.

Parameters
key:String

the parameter key, must not be null

value:AnnotationInfo

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, Annotation value)

Adds an annotation-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:Annotation

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, AnnotationInfo[] value)

Adds an annotation array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

When looked up from the parameter map in the event notification function, the values will be instances of the corresponding annotation types, not AnnotationInfo.

Parameters
key:String

the parameter key, must not be null

value:AnnotationInfo[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, Annotation[] value)

Adds an annotation array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

Parameters
key:String

the parameter key, must not be null

value:Annotation[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticObserverBuilder

withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, InvokerInfo value)

Adds an invoker-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

When looked up from the parameter map in the event notification function, the value will be an instance of Invoker, not an InvokerInfo.

Parameters
key:String

the parameter key, must not be null

value:InvokerInfo

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticBeanBuilder

Since
4.1
withParamback to summary
public SyntheticObserverBuilder<T> withParam(String key, InvokerInfo[] value)

Adds an invoker array-valued parameter to the parameter map. The parameter map is passed to the event notification function when the event is fired.

When looked up from the parameter map in the event notification function, the values will be instances of Invoker, not InvokerInfo.

Parameters
key:String

the parameter key, must not be null

value:InvokerInfo[]

the parameter value

Returns:SyntheticObserverBuilder<T>

this SyntheticBeanBuilder

Since
4.1