T
- type which could be handled by Supplier
and this bridge.public class InstanceSupplierFactoryBridge<T>
extends java.lang.Object
implements org.glassfish.hk2.api.Factory<T>
HK2 Factory
and JDK Supplier
. Using this class Supplier
is able to behave as a factory in service locator. The bridge just delegates all invocations to provided ServiceLocator
and therefore all operation should be in proper scope and context.
This bridge is dedicated to instance binding therefore underlying supplier
is always only single instance.
Modifier and Type | Field and Description |
---|---|
private boolean |
disposable |
private java.util.function.Supplier<T> |
supplier |
Constructor and Description |
---|
InstanceSupplierFactoryBridge(java.util.function.Supplier<T> supplier,
boolean disposable)
Constructor for a new bridge.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose(T instance) |
T |
provide() |
private java.util.function.Supplier<T> supplier
private boolean disposable
InstanceSupplierFactoryBridge(java.util.function.Supplier<T> supplier, boolean disposable)
supplier
- type which will be looked for in locator.disposable
- flag whether the bridge is set up for disposing the created object.