Example usage for org.apache.commons.lang ObjectUtils equals

List of usage examples for org.apache.commons.lang ObjectUtils equals

Introduction

In this page you can find the example usage for org.apache.commons.lang ObjectUtils equals.

Prototype

public static boolean equals(Object object1, Object object2) 

Source Link

Document

Compares two objects for equality, where either one or both objects may be null.

 ObjectUtils.equals(null, null)                  = true ObjectUtils.equals(null, "")                    = false ObjectUtils.equals("", null)                    = false ObjectUtils.equals("", "")                      = true ObjectUtils.equals(Boolean.TRUE, null)          = false ObjectUtils.equals(Boolean.TRUE, "true")        = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE)  = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false 

Usage

From source file:com.aurel.track.persist.BaseTCardPanel.java

/**
 * Set the value of RowsNo/*from www . j a  v a  2 s . co m*/
 *
 * @param v new value
 */
public void setRowsNo(Integer v) {

    if (!ObjectUtils.equals(this.rowsNo, v)) {
        this.rowsNo = v;
        setModified(true);
    }

}

From source file:com.aurel.track.persist.BaseTPlistType.java

/**
 * Set the value of Category//  www  . java 2 s  .  c o  m
 *
 * @param v new value
 */
public void setCategory(Integer v) throws TorqueException {

    if (!ObjectUtils.equals(this.category, v)) {
        this.category = v;
        setModified(true);
    }

    if (aTListType != null && !ObjectUtils.equals(aTListType.getObjectID(), v)) {
        aTListType = null;
    }

}

From source file:de.codesourcery.eve.skills.datamodel.Asset.java

public Asset merge(Asset other, long itemId) {

    if (!ObjectUtils.equals(getType(), other.getType())) {
        throw new IllegalArgumentException("Won't merge assets with different types");
    }/*from w ww  .  j  a v a2s. c om*/

    final Asset result = new Asset(this.getCharacterIds(), itemId);
    result.ownedByCharacterIds.addAll(other.getCharacterIds());

    result.setType(this.getType());
    result.setQuantity(this.getQuantity() + other.getQuantity());

    if (this.flags != other.flags) {
        result.flags = EveFlags.NONE;
    } else {
        result.flags = this.flags;
    }

    if (this.packaged != other.packaged) {
        result.packaged = false;
    } else {
        result.packaged = this.packaged;
    }

    if (this.container != null || other.container != null) {
        if (this.container != other.container) {
            result.container = null;
        } else {
            result.container = this.container;
        }
    }

    result.addLocations(this.getLocations());
    result.addLocations(other.getLocations());

    return result;
}

From source file:com.healthmarketscience.jackcess.CursorBuilder.java

/**
 * Sets an index to use for the cursor by searching the table for an index
 * with exactly the given columns./* w  ww  .j  a  va2 s  .co  m*/
 * @throws IllegalArgumentException if no index can be found on the table
 *         with the given name
 */
public CursorBuilder setIndexByColumns(Column... columns) {
    List<Column> searchColumns = Arrays.asList(columns);
    boolean found = false;
    for (Index index : _table.getIndexes()) {

        Collection<Index.ColumnDescriptor> indexColumns = index.getColumns();
        if (indexColumns.size() != searchColumns.size()) {
            continue;
        }
        Iterator<Column> sIter = searchColumns.iterator();
        Iterator<Index.ColumnDescriptor> iIter = indexColumns.iterator();
        boolean matches = true;
        while (sIter.hasNext()) {
            Column sCol = sIter.next();
            Index.ColumnDescriptor iCol = iIter.next();
            if (!ObjectUtils.equals(sCol.getName(), iCol.getName())) {
                matches = false;
                break;
            }
        }

        if (matches) {
            _index = index;
            found = true;
            break;
        }
    }
    if (!found) {
        throw new IllegalArgumentException(
                "Index with columns " + searchColumns + " does not exist in table " + _table);
    }
    return this;
}

From source file:com.aurel.track.persist.BaseTAction.java

/**
 * Set the value of ObjectID/*ww  w . j  a v  a  2 s  . com*/
 *
 * @param v new value
 */
public void setObjectID(Integer v) throws TorqueException {

    if (!ObjectUtils.equals(this.objectID, v)) {
        this.objectID = v;
        setModified(true);
    }

    // update associated TScreenConfig
    if (collTScreenConfigs != null) {
        for (int i = 0; i < collTScreenConfigs.size(); i++) {
            ((TScreenConfig) collTScreenConfigs.get(i)).setAction(v);
        }
    }

    // update associated TWorkflowTransition
    if (collTWorkflowTransitions != null) {
        for (int i = 0; i < collTWorkflowTransitions.size(); i++) {
            ((TWorkflowTransition) collTWorkflowTransitions.get(i)).setActionKey(v);
        }
    }
}

From source file:com.aurel.track.persist.BaseTComputedValues.java

/**
 * Set the value of WorkitemKey//from  ww w  .j  a  v a  2s  . c  om
 *
 * @param v new value
 */
public void setWorkitemKey(Integer v) throws TorqueException {

    if (!ObjectUtils.equals(this.workitemKey, v)) {
        this.workitemKey = v;
        setModified(true);
    }

    if (aTWorkItem != null && !ObjectUtils.equals(aTWorkItem.getObjectID(), v)) {
        aTWorkItem = null;
    }

}

From source file:com.opengamma.analytics.math.statistics.leastsquare.LeastSquareResults.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from   w w  w  . j  ava 2  s  .c o  m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final LeastSquareResults other = (LeastSquareResults) obj;
    if (Double.doubleToLongBits(_chiSq) != Double.doubleToLongBits(other._chiSq)) {
        return false;
    }
    if (!ObjectUtils.equals(_covariance, other._covariance)) {
        return false;
    }
    if (!ObjectUtils.equals(_inverseJacobian, other._inverseJacobian)) {
        return false;
    }
    return ObjectUtils.equals(_parameters, other._parameters);
}

From source file:com.aurel.track.persist.BaseTAttributeType.java

/**
 * Set the value of AttributeClass/*from  w  ww  .j  av  a2s . c  o m*/
 *
 * @param v new value
 */
public void setAttributeClass(Integer v) throws TorqueException {

    if (!ObjectUtils.equals(this.attributeClass, v)) {
        this.attributeClass = v;
        setModified(true);
    }

    if (aTAttributeClass != null && !ObjectUtils.equals(aTAttributeClass.getObjectID(), v)) {
        aTAttributeClass = null;
    }

}

From source file:com.opengamma.analytics.financial.interestrate.future.derivative.BondFutureOptionPremiumSecurity.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*w  ww  .  j a v a 2s  .c o  m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BondFutureOptionPremiumSecurity other = (BondFutureOptionPremiumSecurity) obj;
    if (!ObjectUtils.equals(_discountingCurveName, other._discountingCurveName)) {
        return false;
    }
    if (Double.doubleToLongBits(_expirationTime) != Double.doubleToLongBits(other._expirationTime)) {
        return false;
    }
    if (_isCall != other._isCall) {
        return false;
    }
    if (Double.doubleToLongBits(_strike) != Double.doubleToLongBits(other._strike)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlyingFuture, other._underlyingFuture)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.interestrate.payments.derivative.Payment.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/* w  ww. j av a  2  s  .  c o m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Payment other = (Payment) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_fundingCurveName, other._fundingCurveName)) {
        return false;
    }
    if (Double.doubleToLongBits(_paymentTime) != Double.doubleToLongBits(other._paymentTime)) {
        return false;
    }
    return true;
}