public class ProviderBinder extends Object
Custom providers are classes that implements specific JAX-RS or Jersey
SPI interfaces (e.g. MessageBodyReader
) and are
supplied by the user. These providers will be bound into the injection manager
annotated by a @Custom
qualifier annotation.
Use the @Custom
qualifier annotation to retrieve these providers
from injection manager. You may also use a one of the provider accessor utility
method defined in Providers
class.
Constructor and Description |
---|
ProviderBinder(InjectionManager injectionManager)
Create new provider binder instance.
|
Modifier and Type | Method and Description |
---|---|
void |
bindClasses(Class<?>... classes)
Register/bind custom provider classes.
|
void |
bindClasses(Collection<Class<?>> classes)
Register/bind custom provider classes.
|
void |
bindClasses(Collection<Class<?>> classes,
boolean bindResources)
Register/bind custom provider classes that may also be resources.
|
void |
bindClasses(Iterable<Class<?>> classes)
Register/bind custom provider classes.
|
void |
bindInstances(Collection<Object> instances)
Register/bind custom provider instances.
|
void |
bindInstances(Iterable<Object> instances)
Register/bind custom provider instances.
|
static <T> void |
bindProvider(Class<T> providerClass,
ContractProvider model,
InjectionManager injectionManager)
Bind contract provider model to a provider class using the supplied injection manager.
|
static void |
bindProvider(Object providerInstance,
ContractProvider model,
InjectionManager injectionManager)
Bind contract provider model to a provider instance using the supplied injection manager.
|
static void |
bindProviders(ComponentBag componentBag,
InjectionManager injectionManager)
Bind all providers contained in
providerBag (classes and instances) using injection manager. |
static void |
bindProviders(ComponentBag componentBag,
RuntimeType constrainedTo,
Set<Class<?>> registeredClasses,
InjectionManager injectionManager)
Deprecated.
|
static void |
bindProviders(ComponentBag componentBag,
RuntimeType constrainedTo,
Set<Class<?>> registeredClasses,
InjectionManager injectionManager,
Collection<ComponentProvider> componentProviders)
Bind all providers contained in
providerBag (classes and instances) using injection manager. |
public ProviderBinder(InjectionManager injectionManager)
injectionManager
- the binder will use to bind the providers into.public static <T> void bindProvider(Class<T> providerClass, ContractProvider model, InjectionManager injectionManager)
providerClass
- provider class.model
- contract provider model.public static void bindProvider(Object providerInstance, ContractProvider model, InjectionManager injectionManager)
Scope value specified in the contract provider model
is ignored as instances can only be bound as "singletons".
providerInstance
- provider instance.model
- contract provider model.public static void bindProviders(ComponentBag componentBag, InjectionManager injectionManager)
providerBag
(classes and instances) using injection manager. Configuration is
also committed.componentBag
- bag of provider classes and instances.injectionManager
- injection manager the binder will use to bind the providers into.@Deprecated public static void bindProviders(ComponentBag componentBag, RuntimeType constrainedTo, Set<Class<?>> registeredClasses, InjectionManager injectionManager)
providerBag
(classes and instances) using injection manager. Configuration is
also committed.componentBag
- bag of provider classes and instances.constrainedTo
- current runtime (client or server).registeredClasses
- classes which are manually registered by the user (not found by the classpath scanning).injectionManager
- injection manager the binder will use to bind the providers into.public static void bindProviders(ComponentBag componentBag, RuntimeType constrainedTo, Set<Class<?>> registeredClasses, InjectionManager injectionManager, Collection<ComponentProvider> componentProviders)
providerBag
(classes and instances) using injection manager. Configuration is
also committed.componentBag
- bag of provider classes and instances.constrainedTo
- current runtime (client or server).registeredClasses
- classes which are manually registered by the user (not found by the classpath scanning).injectionManager
- injection manager the binder will use to bind the providers into.componentProviders
- available component providers capable of registering the classespublic void bindInstances(Iterable<Object> instances)
instances
- custom provider instances.public void bindInstances(Collection<Object> instances)
instances
- custom provider instances.public void bindClasses(Class<?>... classes)
PerLookup
.classes
- custom provider classes.public void bindClasses(Iterable<Class<?>> classes)
PerLookup
.classes
- custom provider classes.public void bindClasses(Collection<Class<?>> classes)
PerLookup
.classes
- custom provider classes.public void bindClasses(Collection<Class<?>> classes, boolean bindResources)
PerLookup
.
If bindAsResources
is set to true
, the providers will also be bound
as resources.
classes
- custom provider classes.bindResources
- if true
, the provider classes will also be bound as
resources.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.