Top Description Methods
jakarta.enterprise.inject.spi.configurator

public Interface ProducerConfigurator<T>

Type Parameters
<T>
The return type of the producer method or the type of the producer field
Imports
java.util.function.Consumer, .Function, jakarta.enterprise.context.spi.CreationalContext, jakarta.enterprise.inject.spi.ProcessProducer, .Producer

A ProducerConfigurator can configure a Producer. The container must provide an implementation of this interface.

This configurator is not thread safe and shall not be used concurrently.

CDI Lite implementations are not required to provide support for Portable Extensions.

Author
Martin Kouba
Since
2.0
See Also
ProcessProducer#configureProducer()

Method Summary

Modifier and TypeMethod and Description
public ProducerConfigurator<T>

Returns:

self
disposeWith
(Consumer<T>
a Consumer defining the callback to set
callback
)

Set a callback to destroy the produced instance.

public <
instance type
U extends T
>
ProducerConfigurator<T>

Returns:

self
produceWith
(Function<CreationalContext<U>, U>
a Function defining the callback to set
callback
)

Set a callback to produce a new instance.

Method Detail

disposeWithback to summary
public ProducerConfigurator<T> disposeWith(Consumer<T> callback)

Set a callback to destroy the produced instance.

Parameters
callback:Consumer<T>

a Consumer defining the callback to set

Returns:ProducerConfigurator<T>

self

See Also
Producer#dispose(Object)
produceWithback to summary
public <U extends T> ProducerConfigurator<T> produceWith(Function<CreationalContext<U>, U> callback)

Set a callback to produce a new instance.

Parameters
<U>
instance type
callback:Function<CreationalContext<U>, U>

a Function defining the callback to set

Returns:ProducerConfigurator<T>

self

See Also
Producer#produce(CreationalContext)