Class JSONMerger

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

    public class JSONMerger
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      JSONMerger​(java.lang.String type, boolean patchOverrides)
      Creates a new JSONMerger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getType()  
      java.lang.String merge​(java.io.File base, java.lang.String patch, java.lang.String targetCharset)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSONMerger

        public JSONMerger​(java.lang.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 java.lang.String getType()
        Specified by:
        getType in interface com.devonfw.cobigen.api.extension.Merger
      • merge

        public java.lang.String merge​(java.io.File base,
                                      java.lang.String patch,
                                      java.lang.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