se.bjurr.violations.lib.ORDERED_BY Maven / Gradle / Ivy
package se.bjurr.violations.lib;
import java.util.Comparator;
import se.bjurr.violations.lib.model.Violation;
public enum ORDERED_BY {
FILE(
new Comparator() {
@Override
public int compare(Violation o1, Violation o2) {
return o1.getFile().compareTo(o2.getFile());
}
}),
SEVERITY(
new Comparator() {
@Override
public int compare(Violation o1, Violation o2) {
return Integer.compare(o1.getSeverity().ordinal(), o2.getSeverity().ordinal());
}
});
private Comparator comparator;
private ORDERED_BY(Comparator comparable) {
this.comparator = comparable;
}
public Comparator getComparator() {
return comparator;
}
}