Class DelegatedInjectionValueParamProvider
- java.lang.Object
-
- org.glassfish.jersey.server.internal.inject.DelegatedInjectionValueParamProvider
-
- All Implemented Interfaces:
ValueParamProvider
@Singleton class DelegatedInjectionValueParamProvider extends java.lang.Object implements ValueParamProvider
Value factory provider that delegates the injection target lookup to the underlying injection provider.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.jersey.server.spi.internal.ValueParamProvider
ValueParamProvider.Priority, ValueParamProvider.PriorityType
-
-
Field Summary
Fields Modifier and Type Field Description private Cache<Parameter,ForeignDescriptor>descriptorCacheWe do not want to create a new descriptor instance for every and each method invocation.private java.util.function.Function<Binding,ForeignDescriptor>foreignDescriptorFactoryprivate LazyValue<ContextInjectionResolver>resolver
-
Constructor Summary
Constructors Constructor Description DelegatedInjectionValueParamProvider(LazyValue<ContextInjectionResolver> resolver, java.util.function.Function<Binding,ForeignDescriptor> foreignDescriptorFactory)Injection constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ForeignDescriptorcreateDescriptor(java.lang.Class<?> clazz)Method is able to create form incoming class andjersey descriptoraForeignDescriptorwhich is provided by underlying DI provider.private InjecteegetInjectee(Parameter parameter)Creates a new objectInjecteecorresponding to the injecting point.ValueParamProvider.PriorityTypegetPriority()Gets the priority of this provider.java.util.function.Function<ContainerRequest,?>getValueProvider(Parameter parameter)Get an injected value provider for the parameter.
-
-
-
Field Detail
-
resolver
private final LazyValue<ContextInjectionResolver> resolver
-
foreignDescriptorFactory
private final java.util.function.Function<Binding,ForeignDescriptor> foreignDescriptorFactory
-
descriptorCache
private final Cache<Parameter,ForeignDescriptor> descriptorCache
We do not want to create a new descriptor instance for every and each method invocation. If the underlying DI descriptorForeignDescriptoris already created for the givenParameterthen used the already created descriptor.
-
-
Constructor Detail
-
DelegatedInjectionValueParamProvider
public DelegatedInjectionValueParamProvider(LazyValue<ContextInjectionResolver> resolver, java.util.function.Function<Binding,ForeignDescriptor> foreignDescriptorFactory)
Injection constructor.- Parameters:
resolver- context injection resolver.foreignDescriptorFactory- function that is able to create a new foreign descriptor.
-
-
Method Detail
-
getValueProvider
public java.util.function.Function<ContainerRequest,?> getValueProvider(Parameter parameter)
Description copied from interface:ValueParamProviderGet an injected value provider for the parameter. May returnnullin case the parameter is not supported by the value provider.- Specified by:
getValueProviderin interfaceValueParamProvider- Parameters:
parameter- parameter requesting the value provider instance.- Returns:
- injected parameter value provider. Returns
nullif parameter is not supported.
-
getPriority
public ValueParamProvider.PriorityType getPriority()
Description copied from interface:ValueParamProviderGets the priority of this provider.- Specified by:
getPriorityin interfaceValueParamProvider- Returns:
- the priority of this provider.
- See Also:
ValueParamProvider.PriorityType,ValueParamProvider.Priority
-
getInjectee
private Injectee getInjectee(Parameter parameter)
Creates a new objectInjecteecorresponding to the injecting point. The injectee contains basic information about the injection point types andForeignDescriptorof the underlying DI provider to make delegated injection resolver as simple as possible.- Parameters:
parameter- jersey-like parameter corresponding to one resource-method's parameter.- Returns:
- injectee instance as a source of the information about the injecting point.
-
createDescriptor
private ForeignDescriptor createDescriptor(java.lang.Class<?> clazz)
Method is able to create form incoming class andjersey descriptoraForeignDescriptorwhich is provided by underlying DI provider.- Parameters:
clazz- class from which jersey-like descriptor is created.- Returns:
- foreign descriptor of the underlying DI provider.
-
-