io.ebeaninternal.server.el.ElComparatorCompound Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.el;
import java.util.Comparator;
/**
* Comparator based on multiple ordered comparators.
*
* eg. "name, orderDate desc, id"
*
*/
public final class ElComparatorCompound implements Comparator, ElComparator {
private static final long serialVersionUID = -1523163475050929750L;
private final ElComparator[] array;
public ElComparatorCompound(ElComparator[] array) {
this.array = array;
}
@Override
public int compare(T o1, T o2) {
for (ElComparator anArray : array) {
int ret = anArray.compare(o1, o2);
if (ret != 0) {
return ret;
}
}
return 0;
}
@Override
public int compareValue(Object value, T o2) {
for (ElComparator anArray : array) {
int ret = anArray.compareValue(value, o2);
if (ret != 0) {
return ret;
}
}
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy