|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.jersey.internal.inject.Injections
public class Injections
HK2 injection binding utility methods.
| Constructor Summary | |
|---|---|
Injections()
|
|
| Method Summary | ||
|---|---|---|
static void |
addBinding(BindingBuilder<?> builder,
DynamicConfiguration configuration)
Add a binding represented by the binding builder to the HK2 dynamic configuration. |
|
static void |
addBinding(BindingBuilder<?> builder,
DynamicConfiguration configuration,
HK2Loader defaultLoader)
Add a binding represented by the binding builder to the HK2 dynamic configuration. |
|
static ServiceLocator |
createLocator(Binder... binders)
Create an unnamed ServiceLocator. |
|
static ServiceLocator |
createLocator(ServiceLocator parent,
Binder... binders)
Create an unnamed, parented ServiceLocator. |
|
static ServiceLocator |
createLocator(String name,
Binder... binders)
Create a ServiceLocator. |
|
static ServiceLocator |
createLocator(String name,
ServiceLocator parent,
Binder... binders)
Create a ServiceLocator. |
|
static DynamicConfiguration |
getConfiguration(ServiceLocator locator)
Get service locator dynamic configuration. |
|
static
|
getOrCreate(ServiceLocator serviceLocator,
Class<T> clazz)
Get the class by contract or create and inject a new instance. |
|
static
|
newBinder(Class<T> serviceType)
Get a new class-based service binding builder. |
|
static
|
newBinder(T service)
Get a new instance-based service binding builder. |
|
static
|
newFactoryBinder(Class<? extends Factory<T>> factoryType)
Get a new factory class-based service binding builder. |
|
static
|
newFactoryBinder(Class<? extends Factory<T>> factoryType,
Class<? extends Annotation> factoryScope)
Get a new factory class-based service binding builder. |
|
static
|
newFactoryBinder(Factory<T> factory)
Get a new factory instance-based service binding builder. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Injections()
| Method Detail |
|---|
public static DynamicConfiguration getConfiguration(ServiceLocator locator)
dynamic configuration.
locator - HK2 service locator.
public static ServiceLocator createLocator(String name,
ServiceLocator parent,
Binder... binders)
ServiceLocator. In case the name is not specified, the locator
will be unnamed.
name - The name of this service locator. Passing a null
name will result in a newly created service locator with a
generated name.parent - The parent of this ServiceLocator. Services can be found in
the parent (and all grand-parents). May be null.
if the returned ServiceLocator should not be parented.binders - custom the HK2 binders.
public static ServiceLocator createLocator(String name,
Binder... binders)
ServiceLocator. In case the name is not specified, the locator
will be unnamed.
name - The name of this service locator. Passing a null
name will result in a newly created service locator with a
generated name.binders - custom the HK2 binders.
public static ServiceLocator createLocator(ServiceLocator parent,
Binder... binders)
ServiceLocator. In case the parent service locator
is not specified, the locator will not be parented.
parent - The parent of this ServiceLocator. Services can be found in
the parent (and all grand-parents). May be null.
if the returned ServiceLocator should not be parented.binders - custom the HK2 binders.
public static ServiceLocator createLocator(Binder... binders)
ServiceLocator.
binders - custom the HK2 binders.
public static <T> T getOrCreate(ServiceLocator serviceLocator,
Class<T> clazz)
T - instance type.serviceLocator - HK2 service locator.clazz - class of the instance to be provider.
public static void addBinding(BindingBuilder<?> builder,
DynamicConfiguration configuration)
builder - binding builder.configuration - HK2 dynamic configuration.
public static void addBinding(BindingBuilder<?> builder,
DynamicConfiguration configuration,
HK2Loader defaultLoader)
builder - binding builder.configuration - HK2 dynamic configuration.defaultLoader - default HK2 service loader that should be used to load the service class
in case a custom loader has not been set.
public static <T> ServiceBindingBuilder<T> newFactoryBinder(Class<? extends Factory<T>> factoryType,
Class<? extends Annotation> factoryScope)
T - service type.factoryType - service factory class.factoryScope - factory scope.
public static <T> ServiceBindingBuilder<T> newFactoryBinder(Class<? extends Factory<T>> factoryType)
per-lookup scope.
T - service type.factoryType - service factory class.
public static <T> ServiceBindingBuilder<T> newFactoryBinder(Factory<T> factory)
T - service type.factory - service instance.
public static <T> ServiceBindingBuilder<T> newBinder(Class<T> serviceType)
T - service type.serviceType - service class.
public static <T> ScopedBindingBuilder<T> newBinder(T service)
singleton-scoped.
Does NOT bind the service type itself as a contract type.
T - service type.service - service instance.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||