From d55c5a571c5852458d73249b4d6679aeb7072f89 Mon Sep 17 00:00:00 2001 From: Mirjan Merruko Date: Wed, 31 Jan 2018 15:31:57 +0200 Subject: [PATCH] Add getter for the patch operations It might be necessary in projects where an all or nothing approach to patching is not helpful and a more fine-grain approach is needed --- src/main/java/com/github/fge/jsonpatch/JsonPatch.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/github/fge/jsonpatch/JsonPatch.java b/src/main/java/com/github/fge/jsonpatch/JsonPatch.java index 178ab867..ead86115 100644 --- a/src/main/java/com/github/fge/jsonpatch/JsonPatch.java +++ b/src/main/java/com/github/fge/jsonpatch/JsonPatch.java @@ -31,6 +31,7 @@ import com.google.common.collect.ImmutableList; import java.io.IOException; +import java.util.ArrayList; import java.util.List; /** @@ -148,6 +149,15 @@ public JsonNode apply(final JsonNode node) return ret; } + + /** + * Return the operations that are part of this patch + * + * @return the operations of the patch + */ + public List getOperations() { + return new ArrayList(operations); + } @Override public String toString()