Example usage for org.springframework.data.rest.webmvc.config JsonPatchHandler applyPut

List of usage examples for org.springframework.data.rest.webmvc.config JsonPatchHandler applyPut

Introduction

In this page you can find the example usage for org.springframework.data.rest.webmvc.config JsonPatchHandler applyPut.

Prototype

<T> T applyPut(ObjectNode source, T existingObject) 

Source Link

Usage

From source file:org.springframework.data.rest.webmvc.config.PersistentEntityResourceHandlerMethodArgumentResolver.java

private Object readPutForUpdate(IncomingRequest request, ObjectMapper mapper, Object existingObject) {

    try {//from  ww  w  .j  a  va2 s  . c  o m

        JsonPatchHandler handler = new JsonPatchHandler(mapper, reader);
        JsonNode jsonNode = mapper.readTree(request.getBody());

        return handler.applyPut((ObjectNode) jsonNode, existingObject);

    } catch (Exception o_O) {
        throw new HttpMessageNotReadableException(String.format(ERROR_MESSAGE, existingObject.getClass()), o_O);
    }
}