Class Injections
java.lang.Object
org.glassfish.jersey.internal.inject.Injections
Injection binding utility methods.
- Author:
- Tom Beerbower, Marek Potociar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InjectionManagerCreates anInjectionManagerwithout parent and initial binder.static InjectionManagercreateInjectionManager(Configuration configuration) Creates anInjectionManagerwithout parent and initial binder.static InjectionManagerCreates anInjectionManagerwithout parent and initial binder.static InjectionManagercreateInjectionManager(Object parent) Creates an unnamed, parentedInjectionManager.static InjectionManagercreateInjectionManager(Object parent, Configuration configuration) Creates an unnamed, parentedInjectionManager.static InjectionManagercreateInjectionManager(Binder binder) Creates aInjectionManagerwith initial binder that is immediately registered.static <T> TgetOrCreate(InjectionManager injectionManager, Class<T> clazz) Get the class by contract or create and inject a new instance.
-
Constructor Details
-
Injections
public Injections()
-
-
Method Details
-
createInjectionManager
Creates anInjectionManagerwithout parent and initial binder.- Returns:
- an injection manager with all the bindings.
-
createInjectionManager
Creates anInjectionManagerwithout parent and initial binder.- Parameters:
type-RuntimeTypetheInjectionManagerFactorymust beConstrainedToif annotated.- Returns:
- an injection manager with all the bindings.
-
createInjectionManager
Creates anInjectionManagerwithout parent and initial binder.- Parameters:
configuration-ConfigurationincludingRuntimeTypetheInjectionManagerFactorymust beConstrainedToif annotated.- Returns:
- an injection manager with all the bindings.
-
createInjectionManager
Creates aInjectionManagerwith initial binder that is immediately registered.- Parameters:
binder- custom thebinder.- Returns:
- an injection manager with all the bindings.
-
createInjectionManager
Creates an unnamed, parentedInjectionManager. In case theparentinjection manager is not specified, the locator will not be parented.- Parameters:
parent- The parent of this injection manager. Services can be found in the parent (and all grand-parents). May benull. An underlying DI provider checks whether the parent is in a proper type.- Returns:
- an injection manager with all the bindings.
-
createInjectionManager
Creates an unnamed, parentedInjectionManager. In case theparentinjection manager is not specified, the locator will not be parented.- Parameters:
parent- The parent of this injection manager. Services can be found in the parent (and all grand-parents). May benull. An underlying DI provider checks whether the parent is in a proper type.configuration-ConfigurationincludingRuntimeTypetheInjectionManagerFactorymust beConstrainedToif annotated.- Returns:
- an injection manager with all the bindings.
-
getOrCreate
Get the class by contract or create and inject a new instance.- Type Parameters:
T- instance type.- Parameters:
injectionManager- DI injection manager.clazz- class of the instance to be provider.- Returns:
- instance of the class either provided as a service or created and injected by HK2.
-