Interface RequestConverterFunction
- All Known Implementing Classes:
ByteArrayRequestConverterFunction
,JacksonRequestConverterFunction
,ProtobufRequestConverterFunction
,StringRequestConverterFunction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RequestConverterFunction
Converts an
AggregatedHttpRequest
to an object. The class implementing this interface would
be specified as a value of a RequestConverter
annotation.- See Also:
RequestConverter
,RequestObject
-
Method Summary
Modifier and Type Method Description Object
convertRequest(ServiceRequestContext ctx, AggregatedHttpRequest request, Class<?> expectedResultType, ParameterizedType expectedParameterizedResultType)
Converts the specifiedrequest
to an object ofexpectedResultType
.static <T> T
fallthrough()
Throws aFallthroughException
in order to try to convert therequest
to an object by the next converter.
-
Method Details
-
convertRequest
@Nullable Object convertRequest(ServiceRequestContext ctx, AggregatedHttpRequest request, Class<?> expectedResultType, @Nullable ParameterizedType expectedParameterizedResultType) throws ExceptionConverts the specifiedrequest
to an object ofexpectedResultType
. Callsfallthrough()
or throws aFallthroughException
if this converter cannot convert therequest
to an object.- Parameters:
ctx
- theServiceRequestContext
ofrequest
.request
- theAggregatedHttpRequest
being handled.expectedResultType
- the desired type of the conversion result.expectedParameterizedResultType
- the desired parameterized type of the conversion result.null
will be given ifexpectedResultType
doesn't have any type parameters.- Throws:
Exception
-
fallthrough
static <T> T fallthrough()Throws aFallthroughException
in order to try to convert therequest
to an object by the next converter.
-