Package org.glassfish.jersey.inject.hk2
Class SupplierFactoryBridge<T>
java.lang.Object
org.glassfish.jersey.inject.hk2.SupplierFactoryBridge<T>
- Type Parameters:
T
- type which could be handled bySupplier
and this bridge.
- All Implemented Interfaces:
org.glassfish.hk2.api.Factory<T>
This class is able to find the
Supplier
of the particular type and use this Supplier
to create a new
instance. If the Supplier
is not found then null
is returned.
If the found Supplier
is a type of DisposableSupplier
then this bridge can delegate
Factory.dispose(Object)
invocation to DisposableSupplier.dispose(Object)
.
It's recommended to register the instance of this class as a singleton and then the provide()
is called according to
a provided scope (for the created instance) during the binding process.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private ParameterizedType
private boolean
private Map
<Object, DisposableSupplier<T>> private org.glassfish.hk2.api.ServiceLocator
-
Constructor Summary
ConstructorsConstructorDescriptionSupplierFactoryBridge
(org.glassfish.hk2.api.ServiceLocator locator, Type beanType, String beanName, boolean disposable) Constructor for a new bridge. -
Method Summary
-
Field Details
-
locator
private org.glassfish.hk2.api.ServiceLocator locator -
beanType
-
beanName
-
disposable
private boolean disposable -
disposableSuppliers
-
-
Constructor Details
-
SupplierFactoryBridge
SupplierFactoryBridge(org.glassfish.hk2.api.ServiceLocator locator, Type beanType, String beanName, boolean disposable) Constructor for a new bridge.- Parameters:
locator
- currently used locator, all factory invocations will be delegated to this locator.beanType
- generic type of aSupplier
which is looked for in locator and on which the creation of the new instance is delegated.beanName
- name of the bean that is provided by supplier.disposable
- flag whether the bridge is set up for disposing the created object.
-
-
Method Details