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.financial.simpleinstruments.definition.SimpleFXFutureDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from   w ww . ja v a 2  s .  c om*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final SimpleFXFutureDefinition other = (SimpleFXFutureDefinition) obj;
    if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) {
        return false;
    }
    if (!ObjectUtils.equals(_expiryDate, other._expiryDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_settlementDate, other._settlementDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_payCurrency, other._payCurrency)) {
        return false;
    }
    if (!ObjectUtils.equals(_receiveCurrency, other._receiveCurrency)) {
        return false;
    }
    if (Double.doubleToLongBits(_unitAmount) != Double.doubleToLongBits(other._unitAmount)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.simpleinstruments.definition.SimpleFutureDefinition.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//  w w w . j  a  va 2  s . c om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final SimpleFutureDefinition other = (SimpleFutureDefinition) obj;
    if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) {
        return false;
    }
    if (!ObjectUtils.equals(_expiryDate, other._expiryDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_settlementDate, other._settlementDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (Double.doubleToLongBits(_unitAmount) != Double.doubleToLongBits(other._unitAmount)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.commodity.definition.CommodityFutureOptionDefinition.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//from  w  w w .j a  v  a 2  s .c o  m
    if (!(obj instanceof CommodityFutureOptionDefinition)) {
        return false;
    }
    final CommodityFutureOptionDefinition<?, ?> other = (CommodityFutureOptionDefinition<?, ?>) obj;
    if (!ObjectUtils.equals(_expiryDate, other._expiryDate)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlying, other._underlying)) {
        return false;
    }
    if (!ObjectUtils.equals(_exerciseType, other._exerciseType)) {
        return false;
    }
    if (Double.compare(_strike, other._strike) != 0) {
        return false;
    }
    if (_isCall != other._isCall) {
        return false;
    }
    return true;
}

From source file:com.tesora.dve.tools.analyzer.stats.EquijoinInfo.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//from   ww w  . j  ava 2s.c  o  m
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof EquijoinInfo)) {
        return false;
    }

    final EquijoinInfo other = (EquijoinInfo) obj;
    return (ObjectUtils.equals(this.joinExpressions, other.joinExpressions)
            && ObjectUtils.equals(this.lhs, other.lhs) && ObjectUtils.equals(this.rhs, other.rhs)
            && ObjectUtils.equals(this.type, other.type));
}

From source file:com.opengamma.analytics.math.integration.GaussianQuadratureIntegrator1D.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w  w w.  ja  v a2  s .  com
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final GaussianQuadratureIntegrator1D other = (GaussianQuadratureIntegrator1D) obj;
    if (_n != other._n) {
        return false;
    }
    return ObjectUtils.equals(_generator, other._generator);
}

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

public void mergeWith(ItemWithQuantity other) {
    if (!ObjectUtils.equals(this.type, other)) {
        throw new IllegalArgumentException(
                "Cannot merge items with different types, this=" + type + ",other=" + other.type);
    }/*ww w .jav a2 s  .c om*/
    if (other.quantity < 0) {
        throw new IllegalArgumentException("Other item has negative quantity ?");
    }
    this.quantity += other.quantity;
}

From source file:com.opengamma.analytics.financial.model.option.parameters.BlackSmileShiftCapParameters.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from w w w. jav a 2 s .com*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BlackSmileShiftCapParameters other = (BlackSmileShiftCapParameters) obj;
    if (!ObjectUtils.equals(_index, other._index)) {
        return false;
    }
    if (!ObjectUtils.equals(_volatility, other._volatility)) {
        return false;
    }
    if (!ObjectUtils.equals(_shift, other._shift)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.financial.analytics.ircurve.InterpolatedYieldCurveSpecificationWithSecurities.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//w  w  w  . j ava2s . c  om
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof InterpolatedYieldCurveSpecificationWithSecurities)) {
        return false;
    }
    final InterpolatedYieldCurveSpecificationWithSecurities other = (InterpolatedYieldCurveSpecificationWithSecurities) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_name, other._name)) {
        return false;
    }
    if (!ObjectUtils.equals(_interpolator, other._interpolator)) {
        return false;
    }
    if (!ObjectUtils.equals(_strips, other._strips)) {
        return false;
    }
    if (_interpolateYield != other._interpolateYield) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.model.option.definition.GeneralLogNormalOptionDataBundle.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   ww w .  j  av  a2 s .  c om
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final GeneralLogNormalOptionDataBundle other = (GeneralLogNormalOptionDataBundle) obj;
    return ObjectUtils.equals(_drift, other._drift);
}

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

/**
 * Set the value of WorkItemID//w  w  w .j a v a 2s .  com
 *
 * @param v new value
 */
public void setWorkItemID(Integer v) {

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

}