Class MergeProcessor

java.lang.Object
org.ghotibeaun.json.merge.MergeProcessor
All Implemented Interfaces:
MergeProcess

public final class MergeProcessor
extends Object
implements MergeProcess
  • 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 source
      secondary - The secondary instance
      arrayStrategies - The Array Conflict strategy
      objectStrategy - The Object Conflict strategy
      mergeResultStrategy - 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 instance
      secondary - the secondary instance
      mergeResultStrategy - The merge result strategy
      Returns:
    • merge

      public static <T extends JSONNode> T merge​(T primary, T secondary, ArrayConflict array, ObjectConflict object)
    • merge

      public static <T extends JSONNode> T merge​(T primary, T secondary, ArrayConflict array)
    • merge

      public static <T extends JSONNode> T merge​(T primary, T secondary, ObjectConflict object)
    • merge

      public static <T extends JSONNode> T merge​(T primary, T secondary)
    • getMergeResultStrategy

      public MergeResult getMergeResultStrategy()
      Description copied from interface: MergeProcess
      Return the specified merge result strategy
      Specified by:
      getMergeResultStrategy in interface MergeProcess
    • getArrayConflictStrategy

      public JSONArrayConflictStrategy getArrayConflictStrategy()
      Description copied from interface: MergeProcess
      Return the the Conflict Strategy to apply to JSONArray nodes
      Specified by:
      getArrayConflictStrategy in interface MergeProcess
    • getObjectConflictStrategy

      public JSONObjectConflictStrategy getObjectConflictStrategy()
      Description copied from interface: MergeProcess
      Return the Conflict Strategy to apply to JSONObject nodes
      Specified by:
      getObjectConflictStrategy in interface MergeProcess
    • mergeNodes

      public <T extends JSONNode> T mergeNodes​(T primary, T secondary)
      Description copied from interface: MergeProcess
      Return the merged result
      Specified by:
      mergeNodes in interface MergeProcess
      Type Parameters:
      T - The JSON node type
      Parameters:
      primary - the primary node in the merge operation
      secondary - the secondary node in the merge operation
      Returns:
      the merged node