-
Notifications
You must be signed in to change notification settings - Fork 78
/
SyntheticBeanDisposer.java
32 lines (30 loc) · 1.43 KB
/
SyntheticBeanDisposer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package jakarta.enterprise.inject.build.compatible.spi;
import jakarta.enterprise.inject.Instance;
/**
* Destruction function for a synthetic bean defined by {@link SyntheticBeanBuilder}.
* CDI container will create an instance of the destruction function every time when it needs
* to destroy an instance of the synthetic bean. Implementations must be {@code public}
* classes with a {@code public} zero-parameter constructor; they must not be beans.
*
* @param <T> the bean class of the synthetic bean
* @since 4.0
*/
public interface SyntheticBeanDisposer<T> {
/**
* Destroys an instance of the synthetic bean.
* <p>
* The {@link Instance} parameter may be used to simulate disposer method parameter injection.
* All {@code @Dependent} bean instances obtained from the {@code Instance} during execution
* are destroyed when execution completes.
* <p>
* Trying to look up {@code InjectionPoint} from the {@code Instance} parameter is invalid.
* <p>
* The parameter map contains the same values that were passed to the {@link SyntheticBeanBuilder}
* that defined the synthetic bean.
*
* @param instance the synthetic bean instance, never {@code null}
* @param lookup an {@link Instance} that can be used to lookup other beans, never {@code null}
* @param params the parameter map, never {@code null}
*/
void dispose(T instance, Instance<Object> lookup, Parameters params);
}