Example usage for org.apache.commons.lang.builder CompareToBuilder CompareToBuilder

List of usage examples for org.apache.commons.lang.builder CompareToBuilder CompareToBuilder

Introduction

In this page you can find the example usage for org.apache.commons.lang.builder CompareToBuilder CompareToBuilder.

Prototype

public CompareToBuilder() 

Source Link

Document

Constructor for CompareToBuilder.

Starts off assuming that the objects are equal.

Usage

From source file:com.healthmarketscience.jackcess.impl.RowIdImpl.java

public int compareTo(RowIdImpl other) {
    return new CompareToBuilder().append(getType(), other.getType())
            .append(getPageNumber(), other.getPageNumber()).append(getRowNumber(), other.getRowNumber())
            .toComparison();/*from   w w  w .jav a 2 s. com*/
}

From source file:core.medicaldevice.MedicalDevice.java

public int compareTo(Object o) {
    MedicalDevice rhs = (MedicalDevice) o;
    return new CompareToBuilder().append(serialNumber, rhs.serialNumber).toComparison();
}

From source file:edu.utah.further.fqe.ds.api.domain.AbstractResultContextKey.java

/**
 * Result of comparing two keys. keys are ordered by type, then by intersection index.
 *
 * @param that//from   www.ja  v  a  2s .  c om
 *            the other {@link ResultContextKey} object
 * @return the result of comparison
 */
@Override
public final int compareTo(final ResultContextKey that) {
    return new CompareToBuilder().append(this.getType(), that.getType()).toComparison();
}

From source file:eu.debooy.sedes.domain.LandDto.java

public int compareTo(LandDto landDto) {
    return new CompareToBuilder().append(landId, landDto.landId).toComparison();
}

From source file:com.dp2345.dao.impl.GoodsDaoImpl.java

/**
 * /*from  w w w.j a  v a 2 s.com*/
 * 
 * @param product
 *            ?
 */
private void setValue(Product product) {
    if (product == null) {
        return;
    }
    if (StringUtils.isEmpty(product.getSn())) {
        String sn;
        do {
            sn = snDao.generate(Type.product);
        } while (productDao.snExists(sn));
        product.setSn(sn);
    }
    StringBuffer fullName = new StringBuffer(product.getName());
    if (product.getSpecificationValues() != null && !product.getSpecificationValues().isEmpty()) {
        List<SpecificationValue> specificationValues = new ArrayList<SpecificationValue>(
                product.getSpecificationValues());
        Collections.sort(specificationValues, new Comparator<SpecificationValue>() {
            public int compare(SpecificationValue a1, SpecificationValue a2) {
                return new CompareToBuilder().append(a1.getSpecification(), a2.getSpecification())
                        .toComparison();
            }
        });
        fullName.append(Product.FULL_NAME_SPECIFICATION_PREFIX);
        int i = 0;
        for (Iterator<SpecificationValue> iterator = specificationValues.iterator(); iterator.hasNext(); i++) {
            if (i != 0) {
                fullName.append(Product.FULL_NAME_SPECIFICATION_SEPARATOR);
            }
            fullName.append(iterator.next().getName());
        }
        fullName.append(Product.FULL_NAME_SPECIFICATION_SUFFIX);
    }
    product.setFullName(fullName.toString());
}

From source file:com.hmsinc.epicenter.webapp.dto.GeographyDTO.java

public int compareTo(GeographyDTO g) {
    return new CompareToBuilder().append(name, g.getName()).append(id, g.getId()).toComparison();
}

From source file:com.algoTrader.vo.ib.CurrentTime.java

/**
 * @param object to compare this object against
 * @return int if equal//from w w w. j  a v  a2 s.co  m
 * @see Comparable#compareTo(Object)
 */
public int compareTo(final CurrentTime object) {
    if (object == null) {
        return -1;
    }
    // Check if the same object instance
    if (object == this) {
        return 0;
    }
    return new CompareToBuilder().append(this.getTime(), object.getTime()).toComparison();
}

From source file:com.algoTrader.vo.ExitValueVO.java

/**
 * @param object to compare this object against
 * @return int if equal//  w w w.  j a v  a2s . c  om
 * @see Comparable#compareTo(Object)
 */
public int compareTo(final ExitValueVO object) {
    if (object == null) {
        return -1;
    }
    // Check if the same object instance
    if (object == this) {
        return 0;
    }
    return new CompareToBuilder().append(this.getValue(), object.getValue()).toComparison();
}

From source file:com.algoTrader.vo.ib.ExecDetailsEnd.java

/**
 * @param object to compare this object against
 * @return int if equal/*from ww w . j  a  v  a  2  s . c o m*/
 * @see Comparable#compareTo(Object)
 */
public int compareTo(final ExecDetailsEnd object) {
    if (object == null) {
        return -1;
    }
    // Check if the same object instance
    if (object == this) {
        return 0;
    }
    return new CompareToBuilder().append(this.getReqId(), object.getReqId()).toComparison();
}

From source file:com.algoTrader.vo.ib.ScannerDataEnd.java

/**
 * @param object to compare this object against
 * @return int if equal/* www. j  a  va2s. c  o m*/
 * @see Comparable#compareTo(Object)
 */
public int compareTo(final ScannerDataEnd object) {
    if (object == null) {
        return -1;
    }
    // Check if the same object instance
    if (object == this) {
        return 0;
    }
    return new CompareToBuilder().append(this.getReqId(), object.getReqId()).toComparison();
}