Skip to content

Added getters for JsonPatch and Operations #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/com/github/fge/jsonpatch/DualPathOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public final void serializeWithType(final JsonGenerator jgen,
serialize(jgen, provider);
}

public final JsonPointer getFrom() {
return from;
}

@Override
public final String toString()
{
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/github/fge/jsonpatch/JsonPatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ public JsonNode apply(final JsonNode node)
return ret;
}

public final List<JsonPatchOperation> getOperations() {
return operations;
}

@Override
public String toString()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ protected JsonPatchOperation(final String op, final JsonPointer path)
public abstract JsonNode apply(final JsonNode node)
throws JsonPatchException;

public final String getOp() {
return op;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this protectively copy the string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't have thought this is necessary as String is immutable, if I'm not thinking of something can you please explain?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right.

}

public final JsonPointer getPath() {
return path;
}

@Override
public abstract String toString();
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public final void serializeWithType(final JsonGenerator jgen,
serialize(jgen, provider);
}

public final JsonNode getValue() {
return value.deepCopy();
}

@Override
public final String toString()
{
Expand Down