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.haulmont.cuba.gui.app.security.ds.BasicPermissionTreeDatasource.java

private void loadPermissionVariant(BasicPermissionTarget target) {
    Permission permission = null;
    for (Permission p : permissionDs.getItems()) {
        if (ObjectUtils.equals(p.getTarget(), target.getPermissionValue())) {
            permission = p;//from   w  ww .j  av  a 2s .c  o  m
            break;
        }
    }
    if (permission != null) {
        if (permission.getValue() == PermissionValue.ALLOW.getValue())
            target.setPermissionVariant(PermissionVariant.ALLOWED);
        else if (permission.getValue() == PermissionValue.DENY.getValue())
            target.setPermissionVariant(PermissionVariant.DISALLOWED);
    } else {
        target.setPermissionVariant(PermissionVariant.NOTSET);
    }
}

From source file:com.opengamma.analytics.financial.provider.description.interestrate.HullWhiteOneFactorProvider.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from w ww  .j a  v a  2  s . c o m*/
    if (!(obj instanceof HullWhiteOneFactorProvider)) {
        return false;
    }
    final HullWhiteOneFactorProvider other = (HullWhiteOneFactorProvider) obj;
    if (!ObjectUtils.equals(_ccyHW, other._ccyHW)) {
        return false;
    }
    if (!ObjectUtils.equals(_parameters, other._parameters)) {
        return false;
    }
    if (!ObjectUtils.equals(_multicurveProvider, other._multicurveProvider)) {
        return false;
    }
    return true;
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }//w w w.  j av  a2s.c  o m
    if (obj == null) {
        return false;
    }
    if (getClass() != obj.getClass()) {
        return false;
    }
    final BondFuturesTransaction other = (BondFuturesTransaction) obj;
    if (_quantity != other._quantity) {
        return false;
    }
    if (Double.doubleToLongBits(_referencePrice) != Double.doubleToLongBits(other._referencePrice)) {
        return false;
    }
    if (!ObjectUtils.equals(_underlyingFuture, other._underlyingFuture)) {
        return false;
    }
    return true;
}

From source file:com.opengamma.component.factory.master.RemoteMastersComponentFactory.java

/**
 * Initialize the remote component./*  ww w. j a  va 2s. c o  m*/
 * 
 * @param repo  the local repository, not null
 * @param info  the remote information, not null
 */
protected void initComponent(ComponentRepository repo, ComponentInfo info) {
    URI componentUri = info.getUri();

    if (info.getAttributes().containsKey(ComponentInfoAttributes.REMOTE_CLIENT_JAVA)
            && info.getAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA).endsWith("Master")) {
        String remoteTypeStr = info.getAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA);
        Class<?> remoteType = ReflectionUtils.loadClass(remoteTypeStr);
        String jmsBrokerUri = info.getAttributes().get(ComponentInfoAttributes.JMS_BROKER_URI);
        String jmsTopic = info.getAttributes().get(ComponentInfoAttributes.JMS_CHANGE_MANAGER_TOPIC);
        Object target;
        if (_jmsConnector != null && jmsTopic != null
                && ObjectUtils.equals(jmsBrokerUri, _jmsConnector.getClientBrokerUri().toString())) {
            // only sets up JMS if supplied connector matches that needed
            // this approach could be enhanced...
            JmsChangeManager changeManager = new JmsChangeManager(_jmsConnector, jmsTopic);
            repo.registerLifecycle(changeManager);
            Constructor<?> con = ReflectionUtils.findConstructor(remoteType, URI.class, ChangeManager.class);
            target = ReflectionUtils.newInstance(con, componentUri, changeManager);
        } else {
            // do not use JMS
            Constructor<?> con = ReflectionUtils.findConstructor(remoteType, URI.class);
            target = ReflectionUtils.newInstance(con, componentUri);
        }
        repo.registerComponent(info, target);
        if (isPublishRest()) {
            repo.getRestComponents().republish(info);
        }
    }
}

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

/**
 * Set the value of ObjectId/*w  ww  .j av  a  2 s.  c  om*/
 *
 * @param v new value
 */
public void setObjectId(Integer v) {

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

}

From source file:net.logstash.logback.marker.MapEntriesAppendingMarker.java

@Override
public boolean equals(Object obj) {
    if (!super.equals(obj)) {
        return false;
    }/*from  ww w  . ja va  2s. com*/
    if (!(obj instanceof MapEntriesAppendingMarker)) {
        return false;
    }

    MapEntriesAppendingMarker other = (MapEntriesAppendingMarker) obj;
    return ObjectUtils.equals(this.map, other.map);
}

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

/**
 * Set the value of TheClassName/*from www.  j a va  2  s.c o m*/
 *
 * @param v new value
 */
public void setTheClassName(String v) {

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

}

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

/**
 * Set the value of ObjectID/*from w ww . ja v  a2s .  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 TCardField
    if (collTCardFields != null) {
        for (int i = 0; i < collTCardFields.size(); i++) {
            ((TCardField) collTCardFields.get(i)).setCardPanel(v);
        }
    }
}

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

/**
 * Set the value of ParamName/*  ww w  . j  a va2 s. c  o  m*/
 *
 * @param v new value
 */
public void setParamName(String v) {

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

}

From source file:com.opengamma.analytics.financial.model.volatility.surface.BlackVolatilitySurfaceLogMoneyness.java

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*ww w  .j a  v a 2s  .  c o  m*/
    if (!super.equals(obj)) {
        return false;
    }
    if (!(obj instanceof BlackVolatilitySurfaceLogMoneyness)) {
        return false;
    }
    final BlackVolatilitySurfaceLogMoneyness other = (BlackVolatilitySurfaceLogMoneyness) obj;
    if (!ObjectUtils.equals(_fc, other._fc)) {
        return false;
    }
    return true;
}