Skip to content

Commit 08009be

Browse files
vincentCapstan
vincent
authored andcommitted
Common interfaces for patches
1 parent 6249eab commit 08009be

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Diff for: src/main/java/com/github/fge/jsonpatch/JsonPatch.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
* constructor for this class ({@link JsonPatch#fromJson(JsonNode)} is used.</p>
9191
*/
9292
public final class JsonPatch
93-
implements JsonSerializable
93+
implements JsonSerializable, Patch
9494
{
9595
private static final MessageBundle BUNDLE
9696
= MessageBundles.getBundle(JsonPatchMessages.class);

Diff for: src/main/java/com/github/fge/jsonpatch/Patch.java

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.github.fge.jsonpatch;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
5+
public interface Patch {
6+
7+
JsonNode apply(JsonNode node) throws JsonPatchException;
8+
}

Diff for: src/main/java/com/github/fge/jsonpatch/mergepatch/JsonMergePatch.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.github.fge.jsonpatch.JsonPatch;
2828
import com.github.fge.jsonpatch.JsonPatchException;
2929
import com.github.fge.jsonpatch.JsonPatchMessages;
30+
import com.github.fge.jsonpatch.Patch;
3031
import com.github.fge.msgsimple.bundle.MessageBundle;
3132
import com.github.fge.msgsimple.load.MessageBundles;
3233

@@ -64,7 +65,7 @@
6465
@ParametersAreNonnullByDefault
6566
@JsonDeserialize(using = JsonMergePatchDeserializer.class)
6667
public abstract class JsonMergePatch
67-
implements JsonSerializable
68+
implements JsonSerializable, Patch
6869
{
6970
private static final ObjectMapper MAPPER = JacksonUtils.newMapper();
7071
protected static final MessageBundle BUNDLE

0 commit comments

Comments
 (0)