Package org.apache.commons.lang3.builder

Examples of org.apache.commons.lang3.builder.CompareToBuilder


    @Override
    public int compareTo(
        @NotNull(message = "other can't be NULL") final RepoCommit other
    ) {
        return new CompareToBuilder().append(
            this.repo().coordinates(),
            other.repo().coordinates()
        ).append(this.sha(), other.sha()).build();
    }
View Full Code Here


    @Override
    public int compareTo(
        @NotNull(message = "cont should not be NULL") final Content cont
    ) {
        return new CompareToBuilder()
            .append(this.path(), cont.path())
                .append(this.repo().coordinates(), cont.repo().coordinates())
            .build();
    }
View Full Code Here

        @Override
        public int compareTo(
            @NotNull(message = "label can't be NULL") final Label label
        ) {
            return new CompareToBuilder()
                .append(this.repo().coordinates(), label.repo().coordinates())
                .append(this.obj, label.name())
                .build();
        }
View Full Code Here

        }
        @Override
        public int compareTo(
            @NotNull(message = "other can't be NULL") final Coordinates other
        ) {
            return new CompareToBuilder()
                .append(this.usr, other.user())
                .append(this.rpo, other.repo())
                .build();
        }
View Full Code Here

     */
    @Override
    public int compareTo(Object object)
    {
        ReportableListObject myClass = (ReportableListObject) object;
        return new CompareToBuilder()
            .append(this.project, myClass.project)
            .append(this.amount, myClass.amount)
            .append(this.city, myClass.city)
            .append(this.task, myClass.task)
            .toComparison();
View Full Code Here

     * @param other  the other triple, not null
     * @return negative if this is less, zero if equal, positive if greater
     */
    @Override
    public int compareTo(final Triple<L, M, R> other) {
      return new CompareToBuilder().append(getLeft(), other.getLeft())
          .append(getMiddle(), other.getMiddle())
          .append(getRight(), other.getRight()).toComparison();
    }
View Full Code Here

     * @param other  the other pair, not null
     * @return negative if this is less, zero if equal, positive if greater
     */
    @Override
    public int compareTo(final Pair<L, R> other) {
      return new CompareToBuilder().append(getLeft(), other.getLeft())
              .append(getRight(), other.getRight()).toComparison();
    }
View Full Code Here

        List<Field> myFields = new ArrayList<Field>();
        myFields.addAll(fields);
        Collections.sort(myFields, new Comparator<Field>() {
            @Override
            public int compare(Field o1, Field o2) {
                return new CompareToBuilder()
                    .append(o1.getOrder(), o2.getOrder())
                    .append(o1.getFriendlyName(), o2.getFriendlyName())
                    .append(o1.getName(), o2.getName())
                    .toComparison();
            }
        });
        if (!alternateOrderedFields.isEmpty()) {
            List<Field> mapFieldsList = new ArrayList<Field>(alternateOrderedFields);
            Collections.sort(mapFieldsList, new Comparator<Field>() {
                @Override
                public int compare(Field o1, Field o2) {
                    return new CompareToBuilder()
                        .append(o1.getOrder(), o2.getOrder())
                        .append(o1.getFriendlyName(), o2.getFriendlyName())
                        .append(o1.getName(), o2.getName())
                        .toComparison();
                }
View Full Code Here

            if (StringUtils.isNotEmpty(sorts)) {
                Collections.sort(contentItems, new Comparator<StructuredContentDTO>() {
                    @Override
                    public int compare(StructuredContentDTO o1, StructuredContentDTO o2) {
                        AssignationSequence sortAssignments = AssignationUtils.parseAssignationSequence(arguments.getConfiguration(), arguments, sorts, false);
                        CompareToBuilder compareBuilder = new CompareToBuilder();
                        for (Assignation sortAssignment : sortAssignments) {
                            String property = sortAssignment.getLeft().getStringRepresentation();
                           
                            Object val1 = o1.getPropertyValue(property);
                            Object val2 = o2.getPropertyValue(property);
                           
                            if (sortAssignment.getRight().execute(arguments.getConfiguration(), arguments).equals("ASCENDING")) {
                                compareBuilder.append(val1, val2);
                            } else {
                                compareBuilder.append(val2, val1);
                            }
                        }
                        return compareBuilder.toComparison();
                    }
                });
            }
           
            List<Map<String, Object>> contentItemFields = new ArrayList<Map<String, Object>>();         
View Full Code Here

                String friendlyName2 = o2.getMetadata().getFriendlyName() == null ? "zzzz" : o2.getMetadata().getFriendlyName();

                String name1 = o1.getName() == null ? "zzzzz" : o1.getName();
                String name2 = o2.getName() == null ? "zzzzz" : o2.getName();

                return new CompareToBuilder()
                        .append(tabOrder1, tabOrder2)
                        .append(groupOrder1, groupOrder2)
                        .append(fieldOrder1, fieldOrder2)
                        .append(friendlyName1, friendlyName2)
                        .append(name1, name2)
View Full Code Here

TOP

Related Classes of org.apache.commons.lang3.builder.CompareToBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.