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.healthmarketscience.jackcess.util.RowFilter.java

/**
 * Creates a filter based on a row pattern.
 * /*from  w w  w  . j av a  2s.c  o  m*/
 * @param rowPattern Map from column names to the values to be matched.
 *                   A table row will match the target if
 *                   {@code ObjectUtils.equals(rowPattern.get(s), row.get(s))}
 *                   for all column names in the pattern map.
 * @return a filter which matches table rows which match the values in the
 *         row pattern
 */
public static RowFilter matchPattern(final Map<String, ?> rowPattern) {
    return new RowFilter() {
        @Override
        public boolean matches(Row row) {
            for (Map.Entry<String, ?> e : rowPattern.entrySet()) {
                if (!ObjectUtils.equals(e.getValue(), row.get(e.getKey()))) {
                    return false;
                }
            }
            return true;
        }
    };
}

From source file:com.haulmont.cuba.gui.components.validators.DoubleValidator.java

private boolean checkDoubleOnPositive(Double value) {
    return !ObjectUtils.equals("true", onlyPositive) || value >= 0;
}

From source file:com.opengamma.util.log.SimpleLogEvent.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//w w w. j av  a 2  s  .  c om
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof SimpleLogEvent)) {
        return false;
    }
    SimpleLogEvent other = (SimpleLogEvent) obj;
    return ObjectUtils.equals(_level, other._level) && ObjectUtils.equals(_message, other._message);
}

From source file:com.opengamma.analytics.financial.instrument.index.IndexDeposit.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/* w  w  w  .java2  s .  c om*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final IndexDeposit other = (IndexDeposit) obj;
    if (!ObjectUtils.equals(_currency, other._currency)) {
        return false;
    }
    if (!ObjectUtils.equals(_name, other._name)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.instrument.index.IndexPrice.java

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

From source file:com.tesora.dve.sql.node.expression.CharFunctionCall.java

@Override
protected boolean schemaSelfEqual(LanguageNode other) {
    if (!super.schemaSelfEqual(other))
        return false;
    CharFunctionCall otherFunctionCall = (CharFunctionCall) other;
    return ObjectUtils.equals(this.outputEncoding, otherFunctionCall.outputEncoding);
}

From source file:com.bcpv.webapp.displaytag.decorators.TotalWrapperTemplate.java

/**
 * After every row completes we evaluate to see if we should be drawing a new total line and summing the results
 * from the previous group./*from w ww .  j  a  v a2  s  .c o m*/
 * @return String
 */
public final String finishRow() {
    int listindex = ((List) getDecoratedObject()).indexOf(this.getCurrentRowObject());
    ReportableListObject reportableObject = (ReportableListObject) this.getCurrentRowObject();
    String nextCity = null;

    this.cityTotal += reportableObject.getAmount();
    this.grandTotal += reportableObject.getAmount();

    if (listindex != ((List) getDecoratedObject()).size() - 1) {
        nextCity = ((ReportableListObject) ((List) getDecoratedObject()).get(listindex + 1)).getCity();
    }

    this.buffer = new StringBuffer(1000);

    // City subtotals...
    if (!ObjectUtils.equals(nextCity, reportableObject.getCity())) {
        writeCityTotal(reportableObject.getCity(), this.cityTotal);
        this.cityTotal = 0;
    }

    // Grand totals...
    if (getViewIndex() == ((List) getDecoratedObject()).size() - 1) {
        writeGrandTotal(this.grandTotal);
    }

    return buffer.toString();
}

From source file:com.opengamma.masterdb.security.hibernate.EnumUserType.java

@Override
public boolean equals(Object x, Object y) throws HibernateException {
    // Check for either being null for database null semantics which ObjectUtils won't give us
    if ((x == null) || (y == null)) {
        return false;
    }/*from   w w w  .j  a v  a  2  s .  c o m*/
    return ObjectUtils.equals(x, y);
}

From source file:com.opengamma.analytics.financial.model.volatility.local.ImpliedTreeResult.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*  ww w.  j a v a2 s. c  o  m*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final ImpliedTreeResult other = (ImpliedTreeResult) obj;
    return ObjectUtils.equals(_localVolatilities, other._localVolatilities)
            && ObjectUtils.equals(_spotPrices, other._spotPrices);
}

From source file:com.vaadin.addon.jpacontainer.testdata.Address.java

@Override
public boolean equals(Object obj) {
    if (obj instanceof Address) {
        Address o = (Address) obj;//from www . jav a2  s.c o  m
        return ObjectUtils.equals(street, o.street) && ObjectUtils.equals(postalCode, o.postalCode)
                && ObjectUtils.equals(postOffice, o.postOffice);
    }
    return super.equals(obj);
}