-
public final class Validate.BodyValidator<T extends Object>Creates a new BodyValidator to validate a request of type bodyType using objectMapperFactory.
-
-
Field Summary
Fields Modifier and Type Field Description private final ServerRequestrequestprivate final Class<T>bodyTypeprivate final Function0<ObjectMapper>objectMapperFactory
-
Constructor Summary
Constructors Constructor Description BodyValidator(ServerRequest request, Class<T> bodyType, Function0<ObjectMapper> objectMapperFactory)
-
Method Summary
Modifier and Type Method Description final Mono<ServerResponse>validate(Function1<T, Mono<ServerResponse>> handler, Function1<String, T> readValue)Validates the body and calls handler if the validation succeeds final ServerResponsevalidateAndAwait(SuspendFunction1<T, ServerResponse> handler, Function1<String, T> readValue)Validates the body and calls handler if the validation succeeds. final ServerRequestgetRequest()final Class<T>getBodyType()final Function0<ObjectMapper>getObjectMapperFactory()-
-
Method Detail
-
validate
final Mono<ServerResponse> validate(Function1<T, Mono<ServerResponse>> handler, Function1<String, T> readValue)
Validates the body and calls handler if the validation succeeds
-
validateAndAwait
final ServerResponse validateAndAwait(SuspendFunction1<T, ServerResponse> handler, Function1<String, T> readValue)
Validates the body and calls handler if the validation succeeds. It's a suspended alternative to a validate method.
-
getRequest
final ServerRequest getRequest()
-
getBodyType
final Class<T> getBodyType()
-
getObjectMapperFactory
final Function0<ObjectMapper> getObjectMapperFactory()
-
-
-
-