forked from java-json-tools/json-patch
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathJsonPatchModule.java
More file actions
31 lines (28 loc) · 1.27 KB
/
JsonPatchModule.java
File metadata and controls
31 lines (28 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.github.fge.jsonpatch;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.github.fge.jsonpatch.operation.AddOperation;
import com.github.fge.jsonpatch.operation.CopyOperation;
import com.github.fge.jsonpatch.operation.MoveOperation;
import com.github.fge.jsonpatch.operation.RemoveOperation;
import com.github.fge.jsonpatch.operation.ReplaceOperation;
import com.github.fge.jsonpatch.operation.TestOperation;
/**
* This module registers the standard JSON-PATCH operations with Jackson.
*/
public class JsonPatchModule extends SimpleModule {
private static final long serialVersionUID = 1L;
/**
* Constructor
*/
public JsonPatchModule() {
registerSubtypes(
new NamedType(AddOperation.class, AddOperation.OPERATION_NAME),
new NamedType(CopyOperation.class, CopyOperation.OPERATION_NAME),
new NamedType(MoveOperation.class, MoveOperation.OPERATION_NAME),
new NamedType(RemoveOperation.class, RemoveOperation.OPERATION_NAME),
new NamedType(ReplaceOperation.class, ReplaceOperation.OPERATION_NAME),
new NamedType(TestOperation.class, TestOperation.OPERATION_NAME)
);
}
}