public abstract class JsonMergePatch extends Object implements JsonSerializable
Unlike JSON Patch, JSON Merge Patch only applies to JSON Objects or JSON arrays.
| Modifier and Type | Field and Description |
|---|---|
protected static MessageBundle |
BUNDLE |
protected static JsonNodeFactory |
FACTORY |
protected JsonNode |
origPatch |
| Modifier | Constructor and Description |
|---|---|
protected |
JsonMergePatch(JsonNode node)
Protected constructor
|
| Modifier and Type | Method and Description |
|---|---|
abstract JsonNode |
apply(JsonNode input) |
protected static JsonNode |
clearNulls(JsonNode node)
Clear "null values" from a JSON value
|
static JsonMergePatch |
fromJson(JsonNode input) |
void |
serialize(JsonGenerator jgen,
SerializerProvider provider) |
void |
serializeWithType(JsonGenerator jgen,
SerializerProvider provider,
TypeSerializer typeSer) |
protected static final JsonNodeFactory FACTORY
protected static final MessageBundle BUNDLE
protected final JsonNode origPatch
protected JsonMergePatch(JsonNode node)
Only necessary for serialization purposes. The patching process itself never requires the full node to operate.
node - the original patch nodepublic abstract JsonNode apply(JsonNode input) throws JsonPatchException
JsonPatchExceptionpublic static JsonMergePatch fromJson(JsonNode input) throws JsonPatchException
JsonPatchExceptionprotected static JsonNode clearNulls(JsonNode node)
Non container values are unchanged. For arrays, null elements are removed. From objects, members whose values are null are removed.
This method is recursive, therefore arrays within objects, or objects within arrays, or arrays within arrays etc are also affected.
node - the original JSON valuepublic final void serialize(JsonGenerator jgen, SerializerProvider provider) throws IOException
serialize in interface JsonSerializableIOExceptionpublic final void serializeWithType(JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException
serializeWithType in interface JsonSerializableIOException