Package org.ghotibeaun.json.merge
Class MergeProcessor
java.lang.Object
org.ghotibeaun.json.merge.MergeProcessor
- All Implemented Interfaces:
MergeProcess
public final class MergeProcessor extends Object implements MergeProcess
-
Method Summary
Modifier and Type Method Description JSONArrayConflictStrategy
getArrayConflictStrategy()
Return the the Conflict Strategy to apply to JSONArray nodesMergeResult
getMergeResultStrategy()
Return the specified merge result strategyJSONObjectConflictStrategy
getObjectConflictStrategy()
Return the Conflict Strategy to apply to JSONObject nodesstatic <T extends JSONNode>
Tmerge(T primary, T secondary)
static <T extends JSONNode>
Tmerge(T primary, T secondary, MergeResult mergeResultStrategy)
Merge two JSON instancesstatic <T extends JSONNode>
Tmerge(T primary, T secondary, ArrayConflict array)
static <T extends JSONNode>
Tmerge(T primary, T secondary, ArrayConflict array, ObjectConflict object)
static <T extends JSONNode>
Tmerge(T primary, T secondary, ArrayConflict arrayStrategies, ObjectConflict objectStrategy, MergeResult mergeResultStrategy)
Invoke and return a merge JSON instancestatic <T extends JSONNode>
Tmerge(T primary, T secondary, ObjectConflict object)
<T extends JSONNode>
TmergeNodes(T primary, T secondary)
Return the merged result
-
Method Details
-
merge
public static <T extends JSONNode> T merge(T primary, T secondary, ArrayConflict arrayStrategies, ObjectConflict objectStrategy, MergeResult mergeResultStrategy)Invoke and return a merge JSON instance- Type Parameters:
T
- The JSONNode type- Parameters:
primary
- the Primary sourcesecondary
- The secondary instancearrayStrategies
- The Array Conflict strategyobjectStrategy
- The Object Conflict strategymergeResultStrategy
- the merge result strategy.- Returns:
- a merged JSON instance.
-
merge
public static <T extends JSONNode> T merge(T primary, T secondary, MergeResult mergeResultStrategy)Merge two JSON instances- Type Parameters:
T
- The JSON Node type e.g.,JSONArray
JSONObject
- Parameters:
primary
- The primary instancesecondary
- the secondary instancemergeResultStrategy
- The merge result strategy- Returns:
-
merge
public static <T extends JSONNode> T merge(T primary, T secondary, ArrayConflict array, ObjectConflict object) -
merge
-
merge
-
merge
-
getMergeResultStrategy
Description copied from interface:MergeProcess
Return the specified merge result strategy- Specified by:
getMergeResultStrategy
in interfaceMergeProcess
-
getArrayConflictStrategy
Description copied from interface:MergeProcess
Return the the Conflict Strategy to apply to JSONArray nodes- Specified by:
getArrayConflictStrategy
in interfaceMergeProcess
-
getObjectConflictStrategy
Description copied from interface:MergeProcess
Return the Conflict Strategy to apply to JSONObject nodes- Specified by:
getObjectConflictStrategy
in interfaceMergeProcess
-
mergeNodes
Description copied from interface:MergeProcess
Return the merged result- Specified by:
mergeNodes
in interfaceMergeProcess
- Type Parameters:
T
- The JSON node type- Parameters:
primary
- the primary node in the merge operationsecondary
- the secondary node in the merge operation- Returns:
- the merged node
-