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.model.interestrate.curve.YieldCurve.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from   w  w  w  .  j  a  v  a2s.  co  m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final YieldCurve other = (YieldCurve) obj;
    return ObjectUtils.equals(_curve, other._curve);
}

From source file:info.magnolia.ui.framework.i18n.DefaultI18NAuthoringSupport.java

@Override
public boolean isDefaultLocale(Locale locale, Item item) {
    return ObjectUtils.equals(getDefaultLocale(item), locale);
}

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

/**
 * Set the value of ObjectID/*from   www.j  a  va2s .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 TDepartment
    if (collTDepartments != null) {
        for (int i = 0; i < collTDepartments.size(); i++) {
            ((TDepartment) collTDepartments.get(i)).setDomain(v);
        }
    }

    // update associated TProject
    if (collTProjects != null) {
        for (int i = 0; i < collTProjects.size(); i++) {
            ((TProject) collTProjects.get(i)).setDomain(v);
        }
    }

    // update associated TPersonInDomain
    if (collTPersonInDomains != null) {
        for (int i = 0; i < collTPersonInDomains.size(); i++) {
            ((TPersonInDomain) collTPersonInDomains.get(i)).setDomain(v);
        }
    }
}

From source file:com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceMoneynessFcnBackedByGrid.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   ww w . jav  a  2 s .  com
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof BlackVolatilitySurfaceMoneynessFcnBackedByGrid)) {
        return false;
    }
    final BlackVolatilitySurfaceMoneynessFcnBackedByGrid other = (BlackVolatilitySurfaceMoneynessFcnBackedByGrid) obj;
    if (!ObjectUtils.equals(_interpolator, other._interpolator)) {
        return false;
    }
    if (!ObjectUtils.equals(_gridData, other._gridData)) {
        return false;
    }
    return true;
}

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

/**
 * Set the value of State/*from   ww  w  .  ja v a 2s.  co  m*/
 *
 * @param v new value
 */
public void setState(Integer v) throws TorqueException {

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

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

}

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

/**
 * Set the value of RevisionKey//  w w  w  .j  av  a  2  s .c  om
 *
 * @param v new value
 */
public void setRevisionKey(Integer v) throws TorqueException {

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

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

}

From source file:com.opengamma.financial.view.ViewEvaluationTarget.java

/**
 * Creates a target which is the union of this and another. The other target must have compatible valuation parameters.
 * // w  ww . j  a va  2  s .  co  m
 * @param other the other target, not null
 * @return null if the other target is not compatible, otherwise a new instance containing a view definition that is the union of the two participant view definitions
 */
public ViewEvaluationTarget union(ViewEvaluationTarget other) {
    // Check the valuation parameters are compatible
    if (!getExecutionSequence().equals(other.getExecutionSequence())) {
        return null;
    }
    // Check the basic view definitions are compatible
    final ViewDefinition myView = getViewDefinition();
    final ViewDefinition otherView = other.getViewDefinition();
    if (!ObjectUtils.equals(myView.getDefaultCurrency(), otherView.getDefaultCurrency())
            || !ObjectUtils.equals(myView.getMarketDataUser(), otherView.getMarketDataUser())
            || !ObjectUtils.equals(myView.getMaxDeltaCalculationPeriod(),
                    otherView.getMaxDeltaCalculationPeriod())
            || !ObjectUtils.equals(myView.getMaxFullCalculationPeriod(),
                    otherView.getMaxFullCalculationPeriod())
            || !ObjectUtils.equals(myView.getMinDeltaCalculationPeriod(),
                    otherView.getMinDeltaCalculationPeriod())
            || !ObjectUtils.equals(myView.getMinFullCalculationPeriod(),
                    otherView.getMinFullCalculationPeriod())
            || !ObjectUtils.equals(myView.getName(), otherView.getName())
            || !ObjectUtils.equals(myView.getPortfolioId(), otherView.getPortfolioId())
            || !ObjectUtils.equals(myView.getResultModelDefinition(), otherView.getResultModelDefinition())) {
        return null;
    }
    // Check the calc configs are compatible
    for (final ViewCalculationConfiguration myConfig : myView.getAllCalculationConfigurations()) {
        final ViewCalculationConfiguration otherConfig = otherView
                .getCalculationConfiguration(myConfig.getName());
        if (!ObjectUtils.equals(myConfig.getDefaultProperties(), otherConfig.getDefaultProperties())
                || !ObjectUtils.equals(myConfig.getDeltaDefinition(), otherConfig.getDeltaDefinition())
                || !ObjectUtils.equals(myConfig.getResolutionRuleTransform(),
                        otherConfig.getResolutionRuleTransform())) {
            // Configs aren't compatible
            return null;
        }
    }
    // Create a new view definition that is the union of all calc configs
    final ViewDefinition newView = myView.copyWith(myView.getName(), myView.getPortfolioId(),
            myView.getMarketDataUser());
    for (final ViewCalculationConfiguration otherConfig : otherView.getAllCalculationConfigurations()) {
        final ViewCalculationConfiguration newConfig = newView
                .getCalculationConfiguration(otherConfig.getName());
        if (newConfig == null) {
            myView.addViewCalculationConfiguration(newConfig);
        } else {
            newConfig.addSpecificRequirements(otherConfig.getSpecificRequirements());
        }
    }
    return createUnion(newView);
}

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

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

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

    // update associated TRevisionWorkitems
    if (collTRevisionWorkitemss != null) {
        for (int i = 0; i < collTRevisionWorkitemss.size(); i++) {
            ((TRevisionWorkitems) collTRevisionWorkitemss.get(i)).setRevisionKey(v);
        }
    }
}

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

/**
 * Set the value of GroupingField/*from   ww  w.java2  s .com*/
 *
 * @param v new value
 */
public void setGroupingField(Integer v) throws TorqueException {

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

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

}

From source file:com.opengamma.analytics.financial.equity.StaticReplicationDataBundle.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   ww w .j av a 2s .co  m
    if (!(obj instanceof StaticReplicationDataBundle)) {
        return false;
    }
    final StaticReplicationDataBundle other = (StaticReplicationDataBundle) obj;
    if (!ObjectUtils.equals(_discountCurve, other._discountCurve)) {
        return false;
    }
    if (!ObjectUtils.equals(_forwardCurve, other._forwardCurve)) {
        return false;
    }
    if (!ObjectUtils.equals(_volatilitySurface, other._volatilitySurface)) {
        return false;
    }
    return true;
}