Skip to content

Commit

Permalink
Fix review findings
Browse files Browse the repository at this point in the history
Signed-off-by: Yannic Klem <Yannic.Klem@bosch.io>
  • Loading branch information
Yannic92 committed Mar 22, 2022
1 parent 68478c2 commit f4a0b56
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions json/src/main/java/org/eclipse/ditto/json/JsonMergePatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,23 @@
/**
* Can be used to get the diff in form of a JSON merge Patch according to
* <a href="https://datatracker.ietf.org/doc/html/rfc7386">RFC 7386</a> between two {@link JsonValue json values}.
*
* @since 2.4.0
*/
public final class JsonMergePatch {

private JsonMergePatch() {
throw new AssertionError();
}

/**
* This method computes the change from the given {@code oldValue} to the given {@code newValue}.
* The result is a JSON merge patch according to <a href="https://datatracker.ietf.org/doc/html/rfc7386">RFC 7386</a>.
*
* @param oldValue the original value
* @param newValue the new changed value
* @return a JSON merge patch according to <a href="https://datatracker.ietf.org/doc/html/rfc7386">RFC 7386</a> or empty if values are equal.
* @since 2.4.0
*/
public static Optional<JsonValue> compute(final JsonValue oldValue, final JsonValue newValue) {
@Nullable final JsonValue diff;
Expand All @@ -51,6 +58,7 @@ public static Optional<JsonValue> compute(final JsonValue oldValue, final JsonVa
* @param oldJsonObject the original JSON object
* @param newJsonObject the new changed JSON object
* @return a JSON merge patch according to <a href="https://datatracker.ietf.org/doc/html/rfc7386">RFC 7386</a> or empty if values are equal.
* @since 2.4.0
*/
public static Optional<JsonObject> compute(final JsonObject oldJsonObject, final JsonObject newJsonObject) {
final JsonObjectBuilder builder = JsonObject.newBuilder();
Expand Down

0 comments on commit f4a0b56

Please sign in to comment.