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.opengamma.analytics.math.interpolation.data.RadialBasisFunctionInterpolatorDataBundle.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from ww  w. j  a  v  a2 s  .  com
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof RadialBasisFunctionInterpolatorDataBundle)) {
        return false;
    }
    final RadialBasisFunctionInterpolatorDataBundle other = (RadialBasisFunctionInterpolatorDataBundle) obj;
    if (_useNormalized != other._useNormalized) {
        return false;
    }
    if (!Arrays.equals(_weights, other._weights)) {
        return false;
    }
    if (!ObjectUtils.equals(_basisFunction, other._basisFunction)) {
        return false;
    }
    if (!ObjectUtils.equals(_decomp, other._decomp)) {
        return false;
    }
    if (!ObjectUtils.equals(_decompRes, other._decompRes)) {
        return false;
    }
    return true;
}

From source file:mitm.common.security.crlstore.dao.X509CRLStoreDAOHibernate.java

@Override
public void replace(X509CRL oldCRL, X509CRL newCRL) throws CRLStoreException {
    try {//from   w  w  w.j a va2  s.c  o  m
        if (ObjectUtils.equals(X509CRLInspector.getThumbprint(oldCRL),
                X509CRLInspector.getThumbprint(newCRL))) {
            logger.warn("oldCRL is equal to newCRL so won't replace.");

            return;
        }
    } catch (NoSuchAlgorithmException e) {
        throw new CRLStoreException(e);
    } catch (CRLException e) {
        throw new CRLStoreException(e);
    } catch (NoSuchProviderException e) {
        throw new NoSuchProviderRuntimeException(e);
    }

    /*
     * We need to add the new one before removing the old one otherwise there is a small
     * time-gap ('race condition') where there is no CRL.
     * 
     * We need to check if the newCRL is not already in the store. This can happen when
     * a CRL is added by a user (ie not automatically downloaded) because if it was added
     * by a user it did not yet replace the old one because replacing is done by CRL store
     * maintainer.
     */
    if (!contains(newCRL)) {
        logger.debug("newCRL is already in the CRL store.");

        addCRL(newCRL);
    }

    remove(oldCRL);
}

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

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

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

    // update associated TIssueAttributeValue
    if (collTIssueAttributeValues != null) {
        for (int i = 0; i < collTIssueAttributeValues.size(); i++) {
            ((TIssueAttributeValue) collTIssueAttributeValues.get(i)).setAttributeID(v);
        }
    }

    // update associated TAttributeOption
    if (collTAttributeOptions != null) {
        for (int i = 0; i < collTAttributeOptions.size(); i++) {
            ((TAttributeOption) collTAttributeOptions.get(i)).setAttributeID(v);
        }
    }
}

From source file:edu.umd.cfar.lamp.viper.gui.chronology.VDescriptorTimeLine.java

public void setUserRange(InstantRange userRange) {
    if (!ObjectUtils.equals(userRange, this.userRange)) {
        TemporalRange oldRange = getMyRange();
        this.userRange = userRange;
        ViperChronicleModel vm = getViewModel();
        if (vm != null && vm.indexOf(this) >= 0 && !ObjectUtils.equals(userRange, oldRange)) {
            vm.fireDataChanged(null);// w w w. j a  v  a2  s  .c  o  m
        }
    }
}

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

/**
 * Set the value of OwnerID/*www.j  a v a 2 s.  c om*/
 *
 * @param v new value
 */
public void setOwnerID(Integer v) throws TorqueException {

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

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

}

From source file:com.opengamma.analytics.financial.interestrate.bond.definition.BillTransaction.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from ww  w .  j  a  va2  s. c o m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BillTransaction other = (BillTransaction) obj;
    if (!ObjectUtils.equals(_billPurchased, other._billPurchased)) {
        return false;
    }
    if (!ObjectUtils.equals(_billStandard, other._billStandard)) {
        return false;
    }
    if (Double.doubleToLongBits(_quantity) != Double.doubleToLongBits(other._quantity)) {
        return false;
    }
    if (Double.doubleToLongBits(_settlementAmount) != Double.doubleToLongBits(other._settlementAmount)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.forex.derivative.ForexOptionSingleBarrier.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from   ww  w . ja  v a 2  s .c o m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ForexOptionSingleBarrier other = (ForexOptionSingleBarrier) obj;
    if (_barrier != other._barrier) {
        return false;
    }
    if (Double.doubleToLongBits(_rebate) != Double.doubleToLongBits(other._rebate)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlyingOption, other._underlyingOption)) {
        return false;
    }
    return true;
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractActionsHolderComponent.java

@Override
@Nullable//from ww w .  jav  a  2  s.c o m
public Action getAction(String id) {
    for (Action action : getActions()) {
        if (ObjectUtils.equals(action.getId(), id)) {
            return action;
        }
    }
    return null;
}

From source file:be.fedict.eid.pkira.portal.framework.DataModelBase.java

public void setCertificateDomainId(Integer certificateDomainId) {
    if (!ObjectUtils.equals(certificateDomainId, this.certificateDomainId)) {
        this.certificateDomainId = certificateDomainId;
        getDataProvider().invalidateFilter();
    }/*from www . j a  va 2s .c o m*/
}

From source file:com.opengamma.engine.view.calcnode.MutableExecutionLog.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//from www.ja v  a 2 s  . com
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof MutableExecutionLog)) {
        return false;
    }
    MutableExecutionLog other = (MutableExecutionLog) obj;
    return ObjectUtils.equals(_events, other._events)
            && ObjectUtils.equals(_exceptionClass, other._exceptionClass)
            && ObjectUtils.equals(_exceptionMessage, other._exceptionMessage)
            && ObjectUtils.equals(_exceptionStackTrace, other._exceptionStackTrace)
            && ObjectUtils.equals(_levels, other._levels) && ObjectUtils.equals(_logMode, other._logMode);
}