List of usage examples for org.apache.commons.lang.builder CompareToBuilder CompareToBuilder
public CompareToBuilder()
Constructor for CompareToBuilder.
Starts off assuming that the objects are equal.
From source file:com.twitter.hraven.AppKey.java
/** * Compares two AppKey objects on the basis of their cluster, userName, appId and encodedRunId * @param other//www . j a v a 2s.co m * @return 0 if this cluster, userName, appId are equal to the other's * cluster, userName, appId, * 1 if this cluster or userName or appId are less than the other's * cluster, userName, appId, * -1 if this cluster and userName and appId are greater the other's * cluster, userName, appId */ @Override public int compareTo(Object other) { if (other == null) { return -1; } AppKey otherKey = (AppKey) other; return new CompareToBuilder().append(this.cluster, otherKey.getCluster()) .append(this.userName, otherKey.getUserName()).append(this.appId, otherKey.getAppId()) .toComparison(); }
From source file:core.feature.FeatureProfile.java
public int compareTo(Object o) { FeatureProfile rhs = (FeatureProfile) o; return new CompareToBuilder().append(getName(), rhs.getName()).toComparison(); }
From source file:com.tesora.dve.server.statistics.SiteStatKey.java
public int compareTo(SiteStatKey anotherSsk) { return new CompareToBuilder().append(this.type, anotherSsk.type).append(this.name, anotherSsk.name) .append(this.opClass, anotherSsk.opClass).toComparison(); }
From source file:com.hmsinc.epicenter.webapp.remoting.MetadataService.java
/** * Gets all available classifiers.//from w w w.j a v a 2 s. c o m * * Sorts with non-beta first. * * @return */ @Secured("ROLE_USER") @Transactional(readOnly = true) @RemoteMethod public Collection<Classifier> getClassifiers() { final List<Classifier> ret = analysisRepository.getClassifiers(); Collections.sort(ret, new Comparator<Classifier>() { public int compare(Classifier o1, Classifier o2) { return new CompareToBuilder().append(o1.isBeta(), o2.isBeta()).append(o1.getName(), o2.getName()) .toComparison(); } }); return ret; }
From source file:net.sf.sze.model.zeugnis.AvSvBewertung.java
@Override public int compareTo(final AvSvBewertung other) { final CompareToBuilder compareBuilder = new CompareToBuilder(); compareBuilder.append(this.arbeitsUndSozialVerhalten, other.arbeitsUndSozialVerhalten); compareBuilder.append(this.zeugnis, other.zeugnis); compareBuilder.append(this.beurteilung, other.beurteilung); return compareBuilder.toComparison(); }
From source file:com.edmunds.etm.management.api.MavenModule.java
@Override public int compareTo(MavenModule other) { if (other == null) { return 1; }/*from w w w. ja v a 2s . c o m*/ return new CompareToBuilder().append(groupId, other.groupId).append(artifactId, other.artifactId) .append(version, other.version).toComparison(); }
From source file:net.rrm.ehour.domain.TimesheetComment.java
/** * @see java.lang.Comparable#compareTo(Object) *///from www. j a va 2 s .c om public int compareTo(TimesheetComment object) { return new CompareToBuilder().append(this.getComment(), object.getComment()) .append(this.getCommentId(), object.getCommentId()).toComparison(); }
From source file:net.sf.sze.model.zeugnisconfig.SchulamtsBemerkungsBaustein.java
@SuppressWarnings("boxing") @Override// w ww . j a v a 2 s.c om public int compareTo(final SchulamtsBemerkungsBaustein other) { final CompareToBuilder compareBuilder = new CompareToBuilder(); compareBuilder.append(!this.aktiv, !other.aktiv); compareBuilder.append(this.sortierung, other.sortierung); compareBuilder.append(this.name, other.name); compareBuilder.append(this.beschreibenderSatz, other.beschreibenderSatz); return compareBuilder.toComparison(); }
From source file:com.googlesource.gerrit.plugins.verifystatus.server.GetVerifications.java
private void sortJobs(List<PatchSetVerification> jobs, String order) { if (order.equals("REPORTER")) { // sort the jobs list by reporter(A-Z)/Name(A-Z)/Granted(Z-A) Collections.sort(jobs, new Comparator<PatchSetVerification>() { @Override/* w ww . j a v a2 s. c om*/ public int compare(PatchSetVerification a, PatchSetVerification b) { return new CompareToBuilder().append(a.getReporter(), b.getReporter()) .append(a.getName(), b.getName()).append(b.getGranted(), a.getGranted()).toComparison(); } }); } else if (order.equals("NAME")) { // sort the jobs list by Name(A-Z)/Granted(Z-A) Collections.sort(jobs, new Comparator<PatchSetVerification>() { @Override public int compare(PatchSetVerification a, PatchSetVerification b) { return new CompareToBuilder().append(a.getName(), b.getName()) .append(b.getGranted(), a.getGranted()).toComparison(); } }); } else if (order.equals("DATE")) { // sort the jobs list by Granted(Z-A) Collections.sort(jobs, new Comparator<PatchSetVerification>() { @Override public int compare(PatchSetVerification a, PatchSetVerification b) { return new CompareToBuilder().append(b.getGranted(), a.getGranted()).toComparison(); } }); } }
From source file:gemlite.core.internal.index.compare.ComparatorImpl.java
private int compareOther(Object o1, Object o2) { CompareToBuilder cb = new CompareToBuilder(); String value1 = o1.toString(); String value2 = o2.toString(); cb.append(value1, value2);/* w w w .ja va 2s . c o m*/ return cb.toComparison(); }