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.aurel.track.persist.BaseTConfigOptionsRole.java

/**
 * Set the value of ConfigKey/* w ww.java  2  s .  c  o m*/
 *
 * @param v new value
 */
public void setConfigKey(Integer v) throws TorqueException {

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

    if (aTFieldConfig != null && !ObjectUtils.equals(aTFieldConfig.getObjectID(), v)) {
        aTFieldConfig = null;
    }

}

From source file:com.opengamma.engine.test.MockFunction.java

@Override
public boolean canApplyTo(FunctionCompilationContext context, ComputationTarget target) {
    return ObjectUtils.equals(target.getUniqueId(), _target.getUniqueId());
}

From source file:com.vmware.identity.idm.server.config.directory.TenantAttributes.java

@Override
public boolean equals(Object other) {
    boolean result = false;

    if (this == other) {
        result = true;/* w w  w . j a va  2s .c  o  m*/
    } else if (other != null && other instanceof TenantAttributes) {
        TenantAttributes peer = (TenantAttributes) other;

        result = (peer._tokenPolicy == _tokenPolicy)
                && (ObjectUtils.equals(_signatureAlgorithm, peer._signatureAlgorithm))
                && (ObjectUtils.equals(_brandName, peer._brandName))
                && (ObjectUtils.equals(_logonBannerTitle, peer._logonBannerTitle))
                && (ObjectUtils.equals(_logonBannerContent, peer._logonBannerContent))
                && (ObjectUtils.equals(_entityId, peer._entityId))
                && (ObjectUtils.equals(_entityAlias, peer._entityAlias))
                && (ArrayUtils.isEquals(_authnTypes, peer._authnTypes));
    }

    return result;
}

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

@Override
public boolean equals(final Object obj) {
    if (this == obj) {
        return true;
    }/*from   w  w  w.  j  a  va  2s  . com*/
    if (!super.equals(obj)) {
        return false;
    }
    final ForexOptionVanilla other = (ForexOptionVanilla) obj;
    if (_isLong != other._isLong) {
        return false;
    }
    if (!ObjectUtils.equals(_underlyingForex, other._underlyingForex)) {
        return false;
    }
    return true;
}

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

/**
 * Set the value of AttributeClassName//from   w  w  w .j a  v a  2  s.  c  om
 *
 * @param v new value
 */
public void setAttributeClassName(String v) {

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

}

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

/**
 * Set the value of Department/*from   ww w.  j a va  2 s .  c o  m*/
 *
 * @param v new value
 */
public void setDepartment(Integer v) throws TorqueException {

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

    if (aTDepartment != null && !ObjectUtils.equals(aTDepartment.getObjectID(), v)) {
        aTDepartment = null;
    }

}

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

private String checkSelectable() {
    List<Locale> actual = Collections.emptyList();
    Object o = ctx.getAttribute(ATTRIBUTE_NAME);
    if (o instanceof ContextSelectedLocale) {
        actual = ((ContextSelectedLocale) o).getSelectableLocales();
    }//from  ww  w  .j  a v a  2s .  c  om

    List<Locale> expected = expectedSelectableLocales;
    if (expected == null) {
        expected = Collections.emptyList();
    }

    if (ObjectUtils.equals(expected, actual)) {
        return "";
    } else {
        return "expected selectable locales of " + expected + ", but was " + actual + "; ";
    }
}

From source file:com.neelo.glue.st.SelectTool.java

@SuppressWarnings({ "unchecked", "rawtypes" })
private StringBuilder map(Map<String, Object> def, Map<String, Object> options, HttpServletRequest request)
        throws Exception {
    String listProperty = options.get("map").toString();

    Lifecycle wrapper = (Lifecycle) request.getAttribute(Lifecycle.class.getName());
    if (wrapper == null)
        return skip(def);

    Map<String, Object> context = Literals.map("this", wrapper.getBean());

    Object map = PropertyUtils.getProperty(context, listProperty);

    if (!(map instanceof Map))
        return skip(def);

    Iterable<Entry<String, Object>> it = ((Map) map).entrySet();

    StringBuilder sb = new StringBuilder();
    start(def, sb);/*from   www. j  a  v  a  2s  . c  om*/

    Object prompt = options.get("prompt");

    if (prompt != null)
        sb.append("<option value=\"\">").append(prompt).append("</option>\n");

    Object defaults = options.get("default");

    String name = def.get("name").toString();

    // TODO: selected object may be a list for multi-select
    Object selected = PropertyUtils.getProperty(wrapper.getBean(), name);

    for (Entry<String, Object> option : it) {
        sb.append("<option value=\"").append(option.getKey()).append("\"");

        if (selected != null) {
            if (ObjectUtils.equals(option.getKey(), selected.toString())) {
                sb.append(" selected=\"selected\"");
            }
        } else if (defaults != null) {
            if (ObjectUtils.equals(option.getKey(), defaults.toString())) {
                sb.append(" selected=\"selected\"");
            }
        }

        sb.append(">");
        sb.append(option.getValue()).append("</option>\n");
    }

    end(def, sb);
    return sb;

}

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

/**
 * Set the value of RoleID//from w w w.  ja  va 2  s . com
 *
 * @param v new value
 */
public void setRoleID(Integer v) throws TorqueException {

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

    if (aTRole != null && !ObjectUtils.equals(aTRole.getObjectID(), v)) {
        aTRole = null;
    }

}

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

/**
 * Set the value of ObjectID//from  w  w  w  .  ja  va2 s  .co  m
 *
 * @param v new value
 */
public void setObjectID(Integer v) {

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

}