File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
src/main/java/com/github/difflib/unifieddiff Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 2323 *
2424 * @author Tobias Warneke (t.warneke@gmx.net)
2525 */
26- public class UnifiedDiff {
26+ public final class UnifiedDiff {
2727
2828 private String header ;
2929 private String tail ;
@@ -52,4 +52,14 @@ void setTailTxt(String tailTxt) {
5252 public String getTail () {
5353 return tail ;
5454 }
55+
56+ public static UnifiedDiff from (String header , String tail , UnifiedDiffFile ... files ) {
57+ UnifiedDiff diff = new UnifiedDiff ();
58+ diff .setHeader (header );
59+ diff .setTailTxt (tail );
60+ for (UnifiedDiffFile file : files ) {
61+ diff .addFile (file );
62+ }
63+ return diff ;
64+ }
5565}
Original file line number Diff line number Diff line change 2121 *
2222 * @author Tobias Warneke (t.warneke@gmx.net)
2323 */
24- public class UnifiedDiffFile {
24+ public final class UnifiedDiffFile {
2525
2626 private String diffCommand ;
2727 private String fromFile ;
@@ -64,4 +64,12 @@ public String getIndex() {
6464 public Patch <String > getPatch () {
6565 return patch ;
6666 }
67+
68+ public static UnifiedDiffFile from (String fromFile , String toFile , Patch <String > patch ) {
69+ UnifiedDiffFile file = new UnifiedDiffFile ();
70+ file .setFromFile (fromFile );
71+ file .setToFile (toFile );
72+ file .patch = patch ;
73+ return file ;
74+ }
6775}
You can’t perform that action at this time.
0 commit comments