@Singleton class DelegatedInjectionValueParamProvider extends java.lang.Object implements ValueParamProvider
ValueParamProvider.Priority, ValueParamProvider.PriorityType
Modifier and Type | Field and Description |
---|---|
private Cache<Parameter,ForeignDescriptor> |
descriptorCache
We do not want to create a new descriptor instance for every and each method invocation.
|
private java.util.function.Function<Binding,ForeignDescriptor> |
foreignDescriptorFactory |
private LazyValue<ContextInjectionResolver> |
resolver |
Constructor and Description |
---|
DelegatedInjectionValueParamProvider(LazyValue<ContextInjectionResolver> resolver,
java.util.function.Function<Binding,ForeignDescriptor> foreignDescriptorFactory)
Injection constructor.
|
Modifier and Type | Method and Description |
---|---|
private ForeignDescriptor |
createDescriptor(java.lang.Class<?> clazz)
Method is able to create form incoming class and
jersey descriptor a ForeignDescriptor which is
provided by underlying DI provider. |
private Injectee |
getInjectee(Parameter parameter)
Creates a new object
Injectee corresponding to the injecting point. |
ValueParamProvider.PriorityType |
getPriority()
Gets the priority of this provider.
|
java.util.function.Function<ContainerRequest,?> |
getValueProvider(Parameter parameter)
Get an injected value provider for the parameter.
|
private final LazyValue<ContextInjectionResolver> resolver
private final java.util.function.Function<Binding,ForeignDescriptor> foreignDescriptorFactory
private final Cache<Parameter,ForeignDescriptor> descriptorCache
ForeignDescriptor
is already created for the given Parameter
then
used the already created descriptor.public DelegatedInjectionValueParamProvider(LazyValue<ContextInjectionResolver> resolver, java.util.function.Function<Binding,ForeignDescriptor> foreignDescriptorFactory)
resolver
- context injection resolver.foreignDescriptorFactory
- function that is able to create a new foreign descriptor.public java.util.function.Function<ContainerRequest,?> getValueProvider(Parameter parameter)
ValueParamProvider
null
in case the parameter is not supported by the value provider.getValueProvider
in interface ValueParamProvider
parameter
- parameter requesting the value provider instance.null
if parameter is not supported.public ValueParamProvider.PriorityType getPriority()
ValueParamProvider
getPriority
in interface ValueParamProvider
ValueParamProvider.PriorityType
,
ValueParamProvider.Priority
private Injectee getInjectee(Parameter parameter)
Injectee
corresponding to the injecting point. The injectee contains basic information
about the injection point types and ForeignDescriptor
of the underlying DI provider to make delegated injection
resolver as simple as possible.parameter
- jersey-like parameter corresponding to one resource-method's parameter.private ForeignDescriptor createDescriptor(java.lang.Class<?> clazz)
jersey descriptor
a ForeignDescriptor
which is
provided by underlying DI provider.clazz
- class from which jersey-like descriptor is created.