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:jef.tools.Assert.java

/**
 * /*w ww  .j a va2s  .co  m*/
 * @param obj1
 * @param obj2
 */
public static void notEquals(Object obj1, Object obj2) {
    if (ObjectUtils.equals(obj1, obj2))
        throw new RuntimeException();
}

From source file:de.iai.ilcd.webgui.controller.admin.StockListHandler.java

/**
 * {@inheritDoc}/*ww  w.  j  a  v a2s.  c  o m*/
 */
@Override
public void deleteSelected() {
    final AbstractDataStock[] selected = this.getSelectedItems();
    if (selected == null) {
        return;
    }

    StockAccessRightDao sarDao = new StockAccessRightDao();
    for (AbstractDataStock rds : selected) {
        // Default root stock not deletable
        if (ObjectUtils.equals(rds.getId(), SodaUtil.DEFAULT_ROOTSTOCK_ID)) {
            continue; // not selectable in facelet and not deletable (double check)
        }
        List<StockAccessRight> sars = sarDao.get(rds);
        try {
            sarDao.remove(sars);
            this.dao.remove(rds);
            this.addI18NFacesMessage("facesMsg.removeSuccess", FacesMessage.SEVERITY_INFO,
                    rds.getLongTitle().getDefaultValue() + " (" + rds.getName() + ")");
        } catch (Exception e) {
            this.addI18NFacesMessage("facesMsg.removeError", FacesMessage.SEVERITY_ERROR,
                    rds.getLongTitle().getDefaultValue() + " (" + rds.getName() + ")");
        }
    }
    this.dirty.stockModified();
    this.clearSelection();
}

From source file:com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from  w  w  w . j  av  a 2  s . c  om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final InterestRateFutureOptionMarginTransaction other = (InterestRateFutureOptionMarginTransaction) obj;
    if (_quantity != other._quantity) {
        return false;
    }
    if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlyingOption, other._underlyingOption)) {
        return false;
    }
    return true;
}

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

/**
 * Set the value of ObjectID//from   w  w  w  . jav  a2  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 TAttributeType
    if (collTAttributeTypes != null) {
        for (int i = 0; i < collTAttributeTypes.size(); i++) {
            ((TAttributeType) collTAttributeTypes.get(i)).setAttributeClass(v);
        }
    }
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   w  w  w.  j  a v a 2  s. c o m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final Forex other = (Forex) obj;
    if (!ObjectUtils.equals(_paymentCurrency1, other._paymentCurrency1)) {
        return false;
    }
    if (!ObjectUtils.equals(_paymentCurrency2, other._paymentCurrency2)) {
        return false;
    }
    return true;
}

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

/**
 * Set the value of ProcessedDate/*w  w  w  . ja  va2 s  .c om*/
 *
 * @param v new value
 */
public void setProcessedDate(Date v) {

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

}

From source file:com.opengamma.analytics.financial.model.interestrate.curve.PriceIndexCurveAddPriceIndexFixedCurve.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*  ww w .j  a v  a  2 s .c  om*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final PriceIndexCurveAddPriceIndexFixedCurve other = (PriceIndexCurveAddPriceIndexFixedCurve) obj;
    if (!ObjectUtils.equals(_curve, other._curve)) {
        return false;
    }
    if (!ObjectUtils.equals(_curveFixed, other._curveFixed)) {
        return false;
    }
    if (Double.doubleToLongBits(_sign) != Double.doubleToLongBits(other._sign)) {
        return false;
    }
    return true;
}

From source file:dz.alkhwarizmix.winrak.java.model.vo.WinrakPosition.java

@Override
public boolean equals(final Object other) {
    final boolean result = super.equals(other) && (getObjectAsThisClass(other) != null)
            && ObjectUtils.equals(Lat, getObjectAsThisClass(other).Lat)
            && ObjectUtils.equals(Lon, getObjectAsThisClass(other).Lon)
            && ObjectUtils.equals(address, getObjectAsThisClass(other).address);
    return result;
}

From source file:edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionSetupTest.java

private String checkForced() {
    Locale actual = null;//from   w  ww  .ja  v  a2s. c om
    Object o = ctx.getAttribute(ATTRIBUTE_NAME);
    if (o instanceof ContextSelectedLocale) {
        actual = ((ContextSelectedLocale) o).getForcedLocale();
    }

    Locale expected = expectedForcedLocale;
    if (ObjectUtils.equals(expected, actual)) {
        return "";
    } else {
        return "expected forced locale of " + expectedForcedLocale + ", but was " + actual + "; ";
    }
}

From source file:com.vmware.identity.idm.IdentityStoreObjectMapping.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*from  ww w . j a va  2 s  . c o  m*/
    if (obj == null || this.getClass() != obj.getClass()) {
        return false;
    }

    IdentityStoreObjectMapping other = (IdentityStoreObjectMapping) obj;
    return ObjectUtils.equals(_objectId, other._objectId)
            && ObjectUtils.equals(_objectClass, other._objectClass)
            && ObjectUtils.equals(_storeAttributes, other._storeAttributes);
}