![JAR search and dependency download from the Maven repository](/logo.png)
ru.lanwen.diff.uri.core.UriDiff Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of uri-differ-lib Show documentation
Show all versions of uri-differ-lib Show documentation
Simple lib to find diffs in two URIs with ability to pretty print result
The newest version!
package ru.lanwen.diff.uri.core;
import ru.lanwen.diff.uri.core.view.DefaultUrlDiffView;
import ru.lanwen.diff.uri.core.view.ReportView;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import static jersey.repackaged.com.google.common.base.Joiner.on;
/**
* User: lanwen
*/
public class UriDiff {
private URI original;
private URI revised;
private List changes = new ArrayList();
public UriDiff(URI original, URI revised) {
this.original = original;
this.revised = revised;
}
public List getChanges() {
return changes;
}
public boolean hasChanges() {
return !changes.isEmpty();
}
public UriDiff addChange(Change change) {
if (!change.getDeltas().isEmpty()) {
changes.add(change);
}
return this;
}
public URI getOriginal() {
return original;
}
public URI getRevised() {
return revised;
}
@Override
public String toString() {
return String.format("Url <%s>%nchanged to <%s>:%n%s", original, revised, on("\n").join(changes));
}
public String report(ReportView view) {
return view.report(this);
}
public String report() {
return this.report(DefaultUrlDiffView.withDefaultView());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy