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.engine.depgraph.ExceptionWrapper.java

@Override
public boolean equals(final Object o) {
    if (o == this) {
        return true;
    }/*from   ww  w.j  a  v a  2s .c o m*/
    if (!(o instanceof ExceptionWrapper)) {
        return false;
    }
    final ExceptionWrapper other = (ExceptionWrapper) o;
    return ObjectUtils.equals(other._message, _message)
            && ObjectUtils.equals(other._topStackFrame, _topStackFrame)
            && ObjectUtils.equals(other._cause, _cause);
}

From source file:fr.paris.lutece.plugins.mydashboard.service.MyDashboardComponent.java

/**
 *
 * {@inheritDoc}/*from w w w  .  ja  va  2  s . c om*/
 */
@Override
public boolean equals(Object obj) {
    if (obj instanceof IMyDashboardComponent) {
        IMyDashboardComponent other = (IMyDashboardComponent) obj;

        return ObjectUtils.equals(this.getComponentId(), other.getComponentId());
    }

    return false;
}

From source file:com.opengamma.analytics.financial.instrument.payment.PaymentDefinition.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from w  w  w .java  2 s .  com*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final PaymentDefinition other = (PaymentDefinition) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_paymentDate, other._paymentDate)) {
        return false;
    }
    return true;
}

From source file:gov.nih.nci.cabig.caaers.domain.MetastaticDiseaseSite.java

/**
 * Equals.// www  . j  a va2  s . co  m
 *
 * @param codedSite the coded site
 * @param otherSite the other site
 * @return true, if successful
 */
public boolean equals(AnatomicSite codedSite, String otherSite) {
    return StringUtils.equals(this.otherSite, otherSite) && ObjectUtils.equals(codedSite, this.codedSite);
}

From source file:com.opengamma.core.marketdatasnapshot.VolatilityCubeKey.java

/**
 * Checks if this key equals another.// ww  w .  j  av a2 s. c  o  m
 * <p>
 * This checks the currency and name.
 * 
 * @param object  the object to compare to, null returns false
 * @return true if equal
 */
@Override
public boolean equals(Object object) {
    if (object == this) {
        return true;
    }
    if (object instanceof VolatilityCubeKey) {
        VolatilityCubeKey other = (VolatilityCubeKey) object;
        return ObjectUtils.equals(getCurrency(), other.getCurrency())
                && ObjectUtils.equals(getName(), other.getName());
    }
    return false;
}

From source file:ca.sqlpower.wabit.report.selectors.AbstractSelector.java

public boolean setSelectedValue(Object newValue) {

    if ((newValue == null || ObjectUtils.equals(getDefaultValue(), newValue)) && resolver != null) {

        resolver.update(getName(), getDefaultValue());

    } else if (this.resolver != null && this.getName() != null) {

        resolver.update(getName(), newValue);

    }//w  ww  . j a  v  a  2 s.co  m

    fireSelectionChanged();

    return true;
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w ww  . j a  va  2 s. co  m
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final SABRInterestRateDataBundle other = (SABRInterestRateDataBundle) obj;
    return ObjectUtils.equals(_sabrParameter, other._sabrParameter);
}

From source file:com.haulmont.cuba.gui.data.impl.EmbeddedDatasourceImpl.java

protected void initParentDsListeners() {
    //noinspection unchecked
    masterDs.addItemChangeListener(e -> {
        Entity prevValue = getItem(e.getPrevItem());
        Entity newValue = getItem(e.getItem());
        reattachListeners(prevValue, newValue);

        fireItemChanged((T) prevValue);//  w  w  w.  j  a v a 2 s.c om
    });

    //noinspection unchecked
    masterDs.addStateChangeListener(e -> fireStateChanged(e.getPrevState()));

    //noinspection unchecked
    masterDs.addItemPropertyChangeListener(e -> {
        if (e.getProperty().equals(metaProperty.getName())
                && !ObjectUtils.equals(e.getPrevValue(), e.getValue())) {
            reattachListeners((Entity) e.getPrevValue(), (Entity) e.getValue());
            fireItemChanged((T) e.getPrevValue());
        }
    });
}

From source file:com.opengamma.analytics.financial.model.interestrate.definition.HullWhiteOneFactorPiecewiseConstantDataBundle.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   w w  w .  ja  va  2 s  .  c om
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof HullWhiteOneFactorPiecewiseConstantDataBundle)) {
        return false;
    }
    final HullWhiteOneFactorPiecewiseConstantDataBundle other = (HullWhiteOneFactorPiecewiseConstantDataBundle) obj;
    if (!ObjectUtils.equals(_parameters, other._parameters)) {
        return false;
    }
    return true;
}

From source file:com.haulmont.cuba.web.gui.components.WebFrameActionsHolder.java

public Action getAction(String id) {
    for (Action action : getActions()) {
        if (ObjectUtils.equals(action.getId(), id)) {
            return action;
        }//from  www . j a v  a2 s  .co m
    }
    return null;
}