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 JSONArrayConflictStrategygetArrayConflictStrategy()Return the the Conflict Strategy to apply to JSONArray nodesMergeResultgetMergeResultStrategy()Return the specified merge result strategyJSONObjectConflictStrategygetObjectConflictStrategy()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.,JSONArrayJSONObject- 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:MergeProcessReturn the specified merge result strategy- Specified by:
getMergeResultStrategyin interfaceMergeProcess
-
getArrayConflictStrategy
Description copied from interface:MergeProcessReturn the the Conflict Strategy to apply to JSONArray nodes- Specified by:
getArrayConflictStrategyin interfaceMergeProcess
-
getObjectConflictStrategy
Description copied from interface:MergeProcessReturn the Conflict Strategy to apply to JSONObject nodes- Specified by:
getObjectConflictStrategyin interfaceMergeProcess
-
mergeNodes
Description copied from interface:MergeProcessReturn the merged result- Specified by:
mergeNodesin 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
-