Class DefaultRequestBodyMarshaler
java.lang.Object
com.soklet.core.impl.DefaultRequestBodyMarshaler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmarshalRequestBody(Request request, ResourceMethod resourceMethod, Parameter parameter, Type requestBodyType) Given a request, the Resource Method that will handle it, and aRequestBody-annotated parameter + its type, convert the request body bytes into an instance of typerequestBodyType.static DefaultRequestBodyMarshaler
-
Constructor Details
-
DefaultRequestBodyMarshaler
public DefaultRequestBodyMarshaler() -
DefaultRequestBodyMarshaler
-
-
Method Details
-
marshalRequestBody
@Nonnull public Optional<Object> marshalRequestBody(@Nonnull Request request, @Nonnull ResourceMethod resourceMethod, @Nonnull Parameter parameter, @Nonnull Type requestBodyType) Description copied from interface:RequestBodyMarshalerGiven a request, the Resource Method that will handle it, and aRequestBody-annotated parameter + its type, convert the request body bytes into an instance of typerequestBodyType.This instance will be injected by Soklet when it invokes the Resource Method to handle the request.
- Specified by:
marshalRequestBodyin interfaceRequestBodyMarshaler- Parameters:
request- the request whose body should be converted into a Java typeresourceMethod- the Resource Method that is configured to handle the requestparameter- the Resource Method parameter into which the returned instance will be injectedrequestBodyType- the type of the Resource Method parameter (provided for convenience)- Returns:
- the Java instance that corresponds to the request body bytes suitable for assignment to the Resource Method parameter, or
Optional.empty()if no instance should be marshaled