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:de.codesourcery.jasm16.ast.SymbolReferenceNode.java

@Override
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }//from w ww.j av  a 2 s. c o m
    if (obj instanceof SymbolReferenceNode) {
        return ObjectUtils.equals(this.identifier, ((SymbolReferenceNode) obj).identifier);
    }
    return false;
}

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

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

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

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

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from w w w . j a v a2s . c  o  m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final StandardDiscountBondModelDataBundle other = (StandardDiscountBondModelDataBundle) obj;
    return ObjectUtils.equals(_date, other._date)
            && ObjectUtils.equals(_shortRateVolatilityCurve, other._shortRateVolatilityCurve)
            && ObjectUtils.equals(_shortRateCurve, other._shortRateCurve);
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//from   w w  w. ja v a 2 s  . co m
    if (!super.equals(obj)) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final YieldCurveWithBlackSwaptionBundle other = (YieldCurveWithBlackSwaptionBundle) obj;
    if (!ObjectUtils.equals(_parameters, other._parameters)) {
        return false;
    }
    return true;
}

From source file:com.haulmont.cuba.web.app.ui.jmxcontrol.inspect.attribute.AttributeEditWindow.java

private boolean assignValue() {
    ManagedBeanAttribute mba = getItem();

    Object oldValue = mba.getValue();
    try {//from   w w w  . j a  v a2s .  com
        Object newValue = valueHolder != null ? valueHolder.getAttributeValue(false) : null;
        if (newValue != null) {
            if (!ObjectUtils.equals(mba.getValue(), newValue)) {
                mba.setValue(newValue);
                jmxControlAPI.saveAttributeValue(mba);
            }
            return true;
        }
    } catch (Exception e) {
        getDialogOptions().setWidth(themeConstants.getInt("cuba.web.AttributeEditWindow.messageDialog.width"));

        showMessageDialog(String.format(getMessage("editAttribute.exception"), mba.getName()),
                e.getClass().getCanonicalName() + " " + e.getMessage() + "\n", MessageType.WARNING);
        mba.setValue(oldValue);
        return false;
    }
    showNotification(getMessage("editAttribute.conversionError"), NotificationType.HUMANIZED);
    return false;
}

From source file:com.vaadin.addon.jpacontainer.demo.domain.Address.java

@Override
public boolean equals(Object obj) {
    if (obj.getClass() == getClass()) {
        Address o = (Address) obj;//from   w w  w  . j a va2s .c  o  m
        return ObjectUtils.equals(streetOrBox, o.streetOrBox) && ObjectUtils.equals(postalCode, o.postalCode)
                && ObjectUtils.equals(postOffice, o.postOffice) && ObjectUtils.equals(country, o.country);
    }
    return false;
}

From source file:com.github.lukaszkusek.xml.comparator.comparators.order.XMLCheckChildrenOrderComparator.java

@Override
public DifferenceDetails compare(Node node1, Node node2) {
    List<String> xPaths1 = getSortedChildrenXPaths(node1);
    List<String> xPaths2 = getSortedChildrenXPaths(node2);

    Set<String> commonXPaths = intersection(xPaths1, xPaths2);

    List<String> commonXPaths1 = filter(xPaths1, commonXPaths);
    List<String> commonXPaths2 = filter(xPaths2, commonXPaths);

    List<XPathPair> xPaths = zip(commonXPaths1, commonXPaths2);

    return xPaths.stream().map(xPathPair -> {
        if (!ObjectUtils.equals(xPathPair.xPath1, xPathPair.xPath2)) {
            return DifferenceDetails.of(firstChildWithGivenXPath(node1, xPathPair.xPath1),
                    firstChildWithGivenXPath(node2, xPathPair.xPath2), DifferenceCode.INCORRECT_ORDER);
        }// ww w . j av a 2s. c  o m

        return DifferenceDetails.empty();
    }).reduce(new DifferenceDetails(), DifferenceDetails::putAll);
}

From source file:com.opengamma.engine.view.calc.DependencyNodeJobExecutionResult.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*w w  w .  j  av  a2  s .  c  om*/
    if (obj == null) {
        return false;
    }
    if (!(obj instanceof DependencyNodeJobExecutionResult)) {
        return false;
    }
    DependencyNodeJobExecutionResult other = (DependencyNodeJobExecutionResult) obj;
    return ObjectUtils.equals(_computeNodeId, other._computeNodeId)
            && ObjectUtils.equals(_jobResultItem, other._jobResultItem);
}

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

/**
 * Checks if this key equals another./*from  ww  w.  j ava 2s  .  c  om*/
 * <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 YieldCurveKey) {
        YieldCurveKey other = (YieldCurveKey) object;
        return ObjectUtils.equals(getCurrency(), other.getCurrency())
                && ObjectUtils.equals(getName(), other.getName());
    }
    return false;
}