Class DiffRowGenerator.Builder

  • Enclosing class:
    DiffRowGenerator

    public static class DiffRowGenerator.Builder
    extends Object
    This class used for building the DiffRowGenerator.
    Author:
    dmitry
    • Method Detail

      • showInlineDiffs

        public DiffRowGenerator.Builder showInlineDiffs​(boolean val)
        Show inline diffs in generating diff rows or not.
        Parameters:
        val - the value to set. Default: false.
        Returns:
        builder with configured showInlineDiff parameter
      • ignoreWhiteSpaces

        public DiffRowGenerator.Builder ignoreWhiteSpaces​(boolean val)
        Ignore white spaces in generating diff rows or not.
        Parameters:
        val - the value to set. Default: true.
        Returns:
        builder with configured ignoreWhiteSpaces parameter
      • reportLinesUnchanged

        public DiffRowGenerator.Builder reportLinesUnchanged​(boolean val)
        Give the originial old and new text lines to Diffrow without any additional processing and without any tags to highlight the change.
        Parameters:
        val - the value to set. Default: false.
        Returns:
        builder with configured reportLinesUnWrapped parameter
      • processDiffs

        public DiffRowGenerator.Builder processDiffs​(Function<String,​String> processDiffs)
        Processor for diffed text parts. Here e.g. whitecharacters could be replaced by something visible.
        Parameters:
        processDiffs -
        Returns:
      • columnWidth

        public DiffRowGenerator.Builder columnWidth​(int width)
        Set the column width of generated lines of original and revised texts.
        Parameters:
        width - the width to set. Making it < 0 doesn't make any sense. Default 80.
        Returns:
        builder with config of column width
      • build

        public DiffRowGenerator build()
        Build the DiffRowGenerator. If some parameters is not set, the default values are used.
        Returns:
        the customized DiffRowGenerator
      • mergeOriginalRevised

        public DiffRowGenerator.Builder mergeOriginalRevised​(boolean mergeOriginalRevised)
        Merge the complete result within the original text. This makes sense for one line display.
        Parameters:
        mergeOriginalRevised -
        Returns:
      • inlineDiffByWord

        public DiffRowGenerator.Builder inlineDiffByWord​(boolean inlineDiffByWord)
        Per default each character is separatly processed. This variant introduces processing by word, which does not deliver in word changes. Therefore the whole word will be tagged as changed:
         false:    (aBa : aba) --  changed: a(B)a : a(b)a
         true:     (aBa : aba) --  changed: (aBa) : (aba)
         
      • inlineDiffBySplitter

        public DiffRowGenerator.Builder inlineDiffBySplitter​(Function<String,​List<String>> inlineDiffSplitter)
        To provide some customized splitting a splitter can be provided. Here someone could think about sentence splitter, comma splitter or stuff like that.
        Parameters:
        inlineDiffSplitter -
        Returns:
      • lineNormalizer

        public DiffRowGenerator.Builder lineNormalizer​(Function<String,​String> lineNormalizer)
        By default DiffRowGenerator preprocesses lines for HTML output. Tabs and special HTML characters like "<" are replaced with its encoded value. To change this you can provide a customized line normalizer here.
        Parameters:
        lineNormalizer -
        Returns:
      • equalizer

        public DiffRowGenerator.Builder equalizer​(BiPredicate<String,​String> equalizer)
        Provide an equalizer for diff processing.
        Parameters:
        equalizer - equalizer for diff processing.
        Returns:
        builder with configured equalizer parameter
      • replaceOriginalLinefeedInChangesWithSpaces

        public DiffRowGenerator.Builder replaceOriginalLinefeedInChangesWithSpaces​(boolean replace)
        Sometimes it happens that a change contains multiple lines. If there is no correspondence in old and new. To keep the merged line more readable the linefeeds could be replaced by spaces.
        Parameters:
        replace -
        Returns: