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:ca.sqlpower.wabit.swingui.report.selectors.FancyComboBoxSelector.java

public FancyComboBoxSelector(ComboBoxSelector selector, Runnable refreshRoutine) {

    this.selector = selector;
    this.refreshRoutine = refreshRoutine;

    this.selector.addSPListener(selectorListener);
    this.selector.addSelectorListener(selectionListener);

    addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (ignoreEvents.get())
                return;
            if (!ObjectUtils.equals(getSelectedItem(), FancyComboBoxSelector.this.selector.getCurrentValue())) {
                FancyComboBoxSelector.this.selector.setSelectedValue(getSelectedItem());
            }//from   w  w w . java 2s .  c o m
        }
    });

    refresh();
}

From source file:com.opengamma.financial.analytics.ircurve.strips.PointsCurveNodeWithIdentifier.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w ww .j av  a2 s  .  c  o m
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof PointsCurveNodeWithIdentifier)) {
        return false;
    }
    final PointsCurveNodeWithIdentifier other = (PointsCurveNodeWithIdentifier) obj;
    return ObjectUtils.equals(_underlyingIdentifier, other._underlyingIdentifier)
            && ObjectUtils.equals(_underlyingDataField, other._underlyingDataField);
}

From source file:io.viewserver.operators.transpose.TransposeOperator.java

@Override
protected ITransposeConfig mergePendingConfig(ITransposeConfig pendingConfig, ITransposeConfig newConfig) {
    if (!ObjectUtils.equals(pendingConfig.getKeyColumns(), newConfig.getKeyColumns())) {
        throw new IllegalStateException("Cannot merge configs with conflicting key columns");
    }/* ww  w.j  a  v  a2  s  .  com*/
    if (!ObjectUtils.equals(pendingConfig.getPivotColumn(), newConfig.getPivotColumn())) {
        throw new IllegalStateException("Cannot merge configs with conflicting pivot columns");
    }
    if ((pendingConfig.getPivotValues() != null || newConfig.getPivotValues() != null)
            && !Arrays.equals(pendingConfig.getPivotValues(), newConfig.getPivotValues())) {
        throw new IllegalStateException("Cannot merge configs with conflicting pivot values");
    }
    return pendingConfig;
}

From source file:edu.sampleu.travel.bo.FiscalOfficer.java

public final boolean equals(Object o) {
    if (o == null)
        return false;
    if (!(o instanceof FiscalOfficer))
        return false;
    FiscalOfficer f = (FiscalOfficer) o;
    return StringUtils.equals(userName, f.getUserName()) && ObjectUtils.equals(id, f.getId());
}

From source file:com.opengamma.analytics.financial.model.tree.RecombiningTree.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }// w w w.  j  a v a2s  .  c om
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final RecombiningTree<?> other = (RecombiningTree<?>) obj;
    if (ObjectUtils.equals(_tree, other._tree)) {
        return true;
    }
    final int length = _tree.length;
    if (length != other._tree.length) {
        return false;
    }
    for (int i = 0; i < length; i++) {
        final int width = _tree[i].length;
        if (width != other._tree[i].length) {
            return false;
        }
        for (int j = 0; j < width; j++) {
            if (!ObjectUtils.equals(_tree[i][j], other._tree[i][j])) {
                return false;
            }
        }
    }
    return true;
}

From source file:com.opengamma.analytics.financial.var.conditional.EmpiricalDistributionConditionalVaRCalculator.java

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

From source file:com.healthmarketscience.jackcess.util.RowFilter.java

/**
 * Creates a filter based on a single value row pattern.
 *
 * @param columnPattern column to be matched
 * @param valuePattern value to be matched.
 *                     A table row will match the target if
 *                     {@code ObjectUtils.equals(valuePattern, row.get(columnPattern.getName()))}.
 * @return a filter which matches table rows which match the value in the
 *         row pattern/*ww  w .j a v a  2  s .c  o m*/
 */
public static RowFilter matchPattern(final Column columnPattern, final Object valuePattern) {
    return new RowFilter() {
        @Override
        public boolean matches(Row row) {
            return ObjectUtils.equals(valuePattern, columnPattern.getRowValue(row));
        }
    };
}

From source file:com.opengamma.financial.analytics.volatility.fittedresults.SABRFittedSurfaces.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*  ww w  .  j ava 2 s.  c o  m*/
    if (!(obj instanceof SABRFittedSurfaces)) {
        return false;
    }
    final SABRFittedSurfaces other = (SABRFittedSurfaces) obj;
    if (!ObjectUtils.equals(_alphaSurface, other._alphaSurface)) {
        return false;
    }
    if (!ObjectUtils.equals(_betaSurface, other._betaSurface)) {
        return false;
    }
    if (!ObjectUtils.equals(_nuSurface, other._nuSurface)) {
        return false;
    }
    if (!ObjectUtils.equals(_rhoSurface, other._rhoSurface)) {
        return false;
    }
    if (!ObjectUtils.equals(_inverseJacobian, other._inverseJacobian)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.analytics.financial.model.volatility.curve.FXVannaVolgaVolatilityCurveDataBundle.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from  w  w  w.j  a  va2s  . com*/
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final FXVannaVolgaVolatilityCurveDataBundle other = (FXVannaVolgaVolatilityCurveDataBundle) obj;
    if (Double.doubleToLongBits(_atm) != Double.doubleToLongBits(other._atm)) {
        return false;
    }
    if (Double.doubleToLongBits(_delta) != Double.doubleToLongBits(other._delta)) {
        return false;
    }
    if (!ObjectUtils.equals(_maturity, other._maturity)) {
        return false;
    }
    if (Double.doubleToLongBits(_riskReversal) != Double.doubleToLongBits(other._riskReversal)) {
        return false;
    }
    if (Double.doubleToLongBits(_vegaWeightedButterfly) != Double
            .doubleToLongBits(other._vegaWeightedButterfly)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.engine.view.NumberDeltaComparer.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*from  w  ww .  j a va2  s  .c om*/
    if (!(obj instanceof NumberDeltaComparer)) {
        return false;
    }
    NumberDeltaComparer other = (NumberDeltaComparer) obj;
    return ObjectUtils.equals(_decimalPlaces, other._decimalPlaces);
}