Interface ResourceMethodParameterProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Contract for determining parameter values to inject when invoking Resource Methods.
Standard implementations can also be acquired via these factory methods:
withDefaults()
(sufficient for most applications)with(InstanceProvider, ValueConverterRegistry, RequestBodyMarshaler)
However, should a custom implementation be necessary for your application, documentation is available at https://www.soklet.com/docs/request-handling#resource-method-parameter-injection.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionparameterValuesForResourceMethod
(Request request, ResourceMethod resourceMethod) For the givenrequest
andresourceMethod
, vends the list of parameters to use when invoking the underlying Java method located atResourceMethod.getMethod()
.with
(InstanceProvider instanceProvider, ValueConverterRegistry valueConverterRegistry, RequestBodyMarshaler requestBodyMarshaler) Acquires a basicResourceMethodParameterProvider
with sensible defaults.Acquires a basicResourceMethodParameterProvider
with sensible defaults.
-
Method Details
-
parameterValuesForResourceMethod
@Nonnull List<Object> parameterValuesForResourceMethod(@Nonnull Request request, @Nonnull ResourceMethod resourceMethod) For the givenrequest
andresourceMethod
, vends the list of parameters to use when invoking the underlying Java method located atResourceMethod.getMethod()
.The size of the returned list of parameters must exactly match the number of parameters required by the Java method signature.
- Parameters:
request
- the HTTP requestresourceMethod
- the Resource Method associated with the HTTP request- Returns:
- the list of parameters to use when performing Java method invocation, or the empty list if no parameters are necessary
-
withDefaults
Acquires a basicResourceMethodParameterProvider
with sensible defaults.Callers should not rely on reference identity; this method may return a new or cached instance.
- Returns:
- a
ResourceMethodParameterProvider
with default settings
-
with
@Nonnull static ResourceMethodParameterProvider with(@Nonnull InstanceProvider instanceProvider, @Nonnull ValueConverterRegistry valueConverterRegistry, @Nonnull RequestBodyMarshaler requestBodyMarshaler) Acquires a basicResourceMethodParameterProvider
with sensible defaults.Callers should not rely on reference identity; this method may return a new or cached instance.
- Parameters:
instanceProvider
- controls how the parameter provider creates instances of objectsvalueConverterRegistry
- controls how the parameter provider converts values from strings to Java types expected by the Resource MethodrequestBodyMarshaler
- controls how parameters annotated withRequestBody
are converted to the Java type expected by the Resource Method- Returns:
- a
ResourceMethodParameterProvider
with default settings
-