Example usage for org.springframework.util ObjectUtils nullSafeEquals

List of usage examples for org.springframework.util ObjectUtils nullSafeEquals

Introduction

In this page you can find the example usage for org.springframework.util ObjectUtils nullSafeEquals.

Prototype

public static boolean nullSafeEquals(@Nullable Object o1, @Nullable Object o2) 

Source Link

Document

Determine if the given objects are equal, returning true if both are null or false if only one is null .

Usage

From source file:org.springmodules.cache.interceptor.caching.Cached.java

/**
 * @see Object#equals(Object)/*from   w w w.  j av a2  s.  com*/
 */
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof Cached)) {
        return false;
    }

    Cached cached = (Cached) obj;

    if (!ObjectUtils.nullSafeEquals(modelId, cached.modelId)) {
        return false;
    }

    return true;
}

From source file:ei.ne.ke.cassandra.cql3.template.Term.java

/**
 * {@inheritDoc}/*  ww  w.  j a  va  2 s  .  c  om*/
 */
@Override
public boolean equals(Object rhs) {
    if (this == rhs) {
        return true;
    } else if (!(rhs instanceof Term)) {
        return false;
    } else {
        Term that = (Term) rhs;
        return ObjectUtils.nullSafeEquals(this.value, that.value);
    }
}

From source file:org.spring.beans.TestBean.java

@Override
public boolean equals(final Object obj) {
    if (obj == this) {
        return true;
    }/*w ww  .jav  a  2  s  .com*/

    if (!(obj instanceof TestBean)) {
        return false;
    }

    final TestBean that = (TestBean) obj;

    return ObjectUtils.nullSafeEquals(this.getName(), that.getName());
}

From source file:org.springmodules.cache.interceptor.flush.FlushCache.java

/**
 * @see Object#equals(Object)/* w  ww .  j a va2  s  .  c  om*/
 */
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof FlushCache)) {
        return false;
    }
    FlushCache flushCache = (FlushCache) obj;

    if (!ObjectUtils.nullSafeEquals(modelId, flushCache.modelId)) {
        return false;
    }

    return true;
}

From source file:ei.ne.ke.cassandra.cql3.template.Identifier.java

/**
 * {@inheritDoc}// w ww.j av a  2  s. c  o m
 */
@Override
public boolean equals(Object rhs) {
    if (this == rhs) {
        return true;
    } else if (!(rhs instanceof Identifier)) {
        return false;
    } else {
        Identifier that = (Identifier) rhs;
        return ObjectUtils.nullSafeEquals(this.value, that.value);
    }
}

From source file:org.wallride.web.support.BlogLanguageRewriteRule.java

@Override
public RewriteMatch matches(HttpServletRequest request, HttpServletResponse response) {
    UrlPathHelper urlPathHelper = new UrlPathHelper();

    String servletPath = urlPathHelper.getOriginatingServletPath(request);
    if (ObjectUtils.nullSafeEquals(servletPath, WallRideServletConfiguration.ADMIN_SERVLET_PATH)) {
        return null;
    }/*www .  ja v  a 2  s . c  o  m*/

    String lookupPath = urlPathHelper.getLookupPathForRequest(request);

    Blog blog = blogService.getBlogById(Blog.DEFAULT_ID);
    if (blog == null) {
        return null;
    }

    BlogLanguage matchedBlogLanguage = null;
    for (BlogLanguage blogLanguage : blog.getLanguages()) {
        if (lookupPath.startsWith("/" + blogLanguage.getLanguage() + "/")) {
            matchedBlogLanguage = blogLanguage;
            break;
        }
    }

    if (matchedBlogLanguage == null) {
        matchedBlogLanguage = blog.getLanguage(blog.getDefaultLanguage());
    }

    return new BlogLanguageRewriteMatch(matchedBlogLanguage);
}

From source file:ei.ne.ke.cassandra.cql3.template.Ordering.java

/**
 * {@inheritDoc}//from ww w.ja  v a  2s .  c  om
 */
@Override
public boolean equals(Object rhs) {
    if (this == rhs) {
        return true;
    } else if (!(rhs instanceof Ordering)) {
        return false;
    } else {
        Ordering that = (Ordering) rhs;
        return ObjectUtils.nullSafeEquals(this.ordering, that.ordering)
                && ObjectUtils.nullSafeEquals(this.direction, that.direction);
    }
}

From source file:org.eclipse.virgo.ide.management.remote.PackageImport.java

@Override
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }//from   w w  w. j a  va 2s  .  c  o m
    if (!(other instanceof PackageImport)) {
        return false;
    }
    PackageImport that = (PackageImport) other;
    if (!ObjectUtils.nullSafeEquals(this.name, that.name))
        return false;
    if (!ObjectUtils.nullSafeEquals(this.version, that.version))
        return false;
    if (!ObjectUtils.nullSafeEquals(this.supplierId, that.supplierId))
        return false;
    return true;
}

From source file:ei.ne.ke.cassandra.cql3.template.Option.java

/**
 * {@inheritDoc}/*from w w w . j a  v  a 2  s.  co  m*/
 */
@Override
public boolean equals(Object rhs) {
    if (this == rhs) {
        return true;
    } else if (!(rhs instanceof Option)) {
        return false;
    } else {
        Option that = (Option) rhs;
        return ObjectUtils.nullSafeEquals(this.name, that.name)
                && ObjectUtils.nullSafeEquals(this.value, that.value);
    }
}

From source file:com.springsource.hq.plugin.tcserver.serverconfig.services.engine.ThreadDiagnostics.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/* w w w . j a v a2s.c  o m*/
    if (!(obj instanceof ThreadDiagnostics)) {
        return false;
    }
    ThreadDiagnostics threadDianostics = (ThreadDiagnostics) obj;
    return ObjectUtils.nullSafeEquals(this.getEnabled(), threadDianostics.getEnabled())
            && ObjectUtils.nullSafeEquals(this.getHistory(), threadDianostics.getHistory())
            && ObjectUtils.nullSafeEquals(this.getThreshold(), threadDianostics.getThreshold());
}