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 bySupplierand this bridge.
- All Implemented Interfaces:
org.glassfish.hk2.api.Factory<T>
public class SupplierFactoryBridge<T> extends java.lang.Object implements org.glassfish.hk2.api.Factory<T>This class is able to find theSupplierof the particular type and use thisSupplierto create a new instance. If theSupplieris not found thennullis returned. If the foundSupplieris a type ofDisposableSupplierthen this bridge can delegateFactory.dispose(Object)invocation toDisposableSupplier.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
Fields Modifier and Type Field Description private java.lang.StringbeanNameprivate java.lang.reflect.ParameterizedTypebeanTypeprivate booleandisposableprivate java.util.Map<java.lang.Object,DisposableSupplier<T>>disposableSuppliersprivate org.glassfish.hk2.api.ServiceLocatorlocator
-
Constructor Summary
Constructors Constructor Description SupplierFactoryBridge(org.glassfish.hk2.api.ServiceLocator locator, java.lang.reflect.Type beanType, java.lang.String beanName, boolean disposable)Constructor for a new bridge.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose(T instance)Tprovide()
-
-
-
Field Detail
-
locator
private org.glassfish.hk2.api.ServiceLocator locator
-
beanType
private java.lang.reflect.ParameterizedType beanType
-
beanName
private java.lang.String beanName
-
disposable
private boolean disposable
-
disposableSuppliers
private java.util.Map<java.lang.Object,DisposableSupplier<T>> disposableSuppliers
-
-
Constructor Detail
-
SupplierFactoryBridge
SupplierFactoryBridge(org.glassfish.hk2.api.ServiceLocator locator, java.lang.reflect.Type beanType, java.lang.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 aSupplierwhich 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.
-
-