@Test public void test_single_add() throws Exception { String patchExpression = "[ { \"op\": \"add\", \"path\": \"/a\", \"value\": 1 } ]"; JsonNode jsonNode = JsonLoader.fromString(patchExpression); JsonPatch actual = JsonPatch.fromJson(jsonNode); assertThat(actual.getOperations().size(), is(1)); AddOperation operation = (AddOperation) actual.getOperations().get(0); assertThat(operation.getOp(), is("add")); assertThat(operation.getPath(), is(new JsonPointer("/a"))); assertThat(operation.getValue(), is(JsonLoader.fromString("1"))); }
public static JsonPatch fromJson(JsonNode node) throws IOException { return JacksonUtils.getReader().forType(JsonPatch.class) .readValue(node); }
JsonPatch implements JsonSerializable { public static JsonPatch fromJson(JsonNode node) throws IOException { return JacksonUtils.getReader().forType(JsonPatch.class) .readValue(node); } }
JsonPatch implements JsonSerializable { public static JsonPatch fromJson(JsonNode node) throws IOException { return JacksonUtils.getReader().forType(JsonPatch.class) .readValue(node); } @JsonCreator  JsonPatch(List<JsonPatchOperation> operations); }
JsonPatch implements JsonSerializable { public static JsonPatch fromJson(JsonNode node) throws IOException { return JacksonUtils.getReader().forType(JsonPatch.class) .readValue(node); } @JsonCreator  JsonPatch(List<JsonPatchOperation> operations); static JsonPatch fromJson(JsonNode node); @Override void serialize(JsonGenerator jgen, SerializerProvider provider); @Override void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer); }
JsonPatch implements JsonSerializable { public static JsonPatch fromJson(JsonNode node) throws IOException { return JacksonUtils.getReader().forType(JsonPatch.class) .readValue(node); } @JsonCreator  JsonPatch(List<JsonPatchOperation> operations); static JsonPatch fromJson(JsonNode node); @Override void serialize(JsonGenerator jgen, SerializerProvider provider); @Override void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer);  }