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:hudson.plugins.filesfoundtrigger.FilesFoundTriggerCause.java

/**
 * {@inheritDoc}//from  www.j av  a  2  s  .  c  o  m
 */
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (obj instanceof FilesFoundTriggerCause) {
        FilesFoundTriggerCause other = (FilesFoundTriggerCause) obj;
        return ObjectUtils.equals(directory, other.directory) && ObjectUtils.equals(files, other.files)
                && ObjectUtils.equals(ignoredFiles, other.ignoredFiles);
    }
    return false;
}

From source file:fr.paris.lutece.portal.service.dashboard.DashboardComponent.java

/**
 *
 * {@inheritDoc}//from  w  w w  . j a v a 2  s. co  m
 */
@Override
public boolean equals(Object obj) {
    if (obj instanceof IDashboardComponent) {
        IDashboardComponent other = (IDashboardComponent) obj;

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

    return false;
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from  w ww . ja  va  2  s .c  o  m*/
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ForexOptionDataBundle<?> other = (ForexOptionDataBundle<?>) obj;
    if (!ObjectUtils.equals(_currencyPair, other._currencyPair)) {
        return false;
    }
    if (!ObjectUtils.equals(_volatilityModel, other._volatilityModel)) {
        return false;
    }
    return true;
}

From source file:com.kaaprotech.satu.runtime.java.SatuUtil.java

public static <K, V> void applyKeyValuePairDeltas(final RichIterable<KeyValuePairDelta<K, V>> deltas,
        final MutableMap<K, V> pairs) {
    deltas.forEach(new Procedure<KeyValuePairDelta<K, V>>() {
        @Override//www  . j a  va 2s.  co  m
        public void value(final KeyValuePairDelta<K, V> delta) {
            switch (delta.getDeltaType()) {
            case ADD:
            case UPDATE:
                V value = pairs.get(delta.getKey());
                if (value != null) {
                    if (!ObjectUtils.equals(value, delta.getValue())) {
                        pairs.put(delta.getKey(), delta.getValue());
                    }
                } else {
                    pairs.put(delta.getKey(), delta.getValue());
                }
                break;

            case DELETE:
                if (pairs.containsKey(delta.getKey())) {
                    pairs.removeKey(delta.getKey());
                }
                break;
            }
        }
    });
}

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

/**
 * Set the value of ExchangeDirection//from  w w w  .  jav a  2  s .co m
 *
 * @param v new value
 */
public void setExchangeDirection(Integer v) {

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

}

From source file:com.haulmont.cuba.gui.data.DsBuilder.java

public DsBuilder setViewName(String viewName) {
    if (!ObjectUtils.equals(viewName, this.viewName)) {
        this.viewName = viewName;
        this.view = null;
    }// www .j a  v  a  2s  .  c o m
    return this;
}

From source file:de.fu_berlin.inf.dpp.activities.business.TextEditActivity.java

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (!super.equals(obj))
        return false;
    if (!(obj instanceof TextEditActivity))
        return false;

    TextEditActivity other = (TextEditActivity) obj;

    if (offset != other.offset)
        return false;

    if (!ObjectUtils.equals(this.path, other.path))
        return false;

    if (!ObjectUtils.equals(this.replacedText, other.replacedText))
        return false;

    if (!ObjectUtils.equals(this.text, other.text))
        return false;

    return true;//from  w  ww . ja va  2s.com
}

From source file:com.opengamma.analytics.financial.greeks.GreekResultCollection.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w w w .  ja v  a  2s .  co m
    if (!(obj instanceof GreekResultCollection)) {
        return false;
    }
    final GreekResultCollection other = (GreekResultCollection) obj;
    // This is really bad and we'll want to change it when we're less reliant on just the backing map.
    return ObjectUtils.equals(_backingMap, other._backingMap);
}

From source file:com.opengamma.analytics.financial.model.option.pricing.fourier.TimeChangedCharacteristicExponent.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/* w w w  .  j  a v  a2 s  .c  om*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final TimeChangedCharacteristicExponent other = (TimeChangedCharacteristicExponent) obj;
    if (!ObjectUtils.equals(_base, other._base)) {
        return false;
    }
    return ObjectUtils.equals(_timeChange, other._timeChange);
}

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

/**
 * Set the value of Role/* w  w w. j a  va  2s . c  o m*/
 *
 * @param v new value
 */
public void setRole(Integer v) throws TorqueException {

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

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

}