Class JSONMerger

  • All Implemented Interfaces:
    com.devonfw.cobigen.api.extension.Merger

    public class JSONMerger
    extends Object
    implements com.devonfw.cobigen.api.extension.Merger
    The JSONMerger merges a patch and the base file of the same JSON file. The merger is a recursive method that goes through all children of each JsonElement merging them if necessary
    • Constructor Detail

      • JSONMerger

        public JSONMerger​(String type,
                          boolean patchOverrides)
        Creates a new JSONMerger
        Parameters:
        type - merger type
        patchOverrides - if true, conflicts will be resolved by using the patch contents
        if false, conflicts will be resolved by using the base contents
    • Method Detail

      • getType

        public String getType()
        Specified by:
        getType in interface com.devonfw.cobigen.api.extension.Merger
      • merge

        public String merge​(File base,
                            String patch,
                            String targetCharset)
                     throws com.devonfw.cobigen.api.exception.MergeException
        Specified by:
        merge in interface com.devonfw.cobigen.api.extension.Merger
        Throws:
        com.devonfw.cobigen.api.exception.MergeException