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.zkybase.kite.throttle.interceptor.ThrottleSourcePointcut.java

@Override
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }/* ww w.java 2  s .  co  m*/
    if (!(other instanceof ThrottleSourcePointcut)) {
        return false;
    }
    ThrottleSourcePointcut otherPc = (ThrottleSourcePointcut) other;
    return ObjectUtils.nullSafeEquals(source, otherPc.source);
}

From source file:ch.rasc.wampspring.security.WampMessageTypeMatcher.java

@Override
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }/*from  ww  w  . j a v  a 2 s  . com*/
    if (!(other instanceof WampMessageTypeMatcher)) {
        return false;
    }
    WampMessageTypeMatcher otherMatcher = (WampMessageTypeMatcher) other;
    return ObjectUtils.nullSafeEquals(this.typeToMatch, otherMatcher.typeToMatch);

}

From source file:com.novation.eligibility.rest.spring.web.servlet.handler.RestError.java

@Override
public boolean equals(Object o) {
    if (this == o) {
        return true;
    }/*from  w  w  w  . j a v  a  2s . c  om*/
    if (o instanceof RestError) {
        RestError re = (RestError) o;
        return ObjectUtils.nullSafeEquals(getStatus(), re.getStatus()) && getCode() == re.getCode()
                && ObjectUtils.nullSafeEquals(getMessage(), re.getMessage())
                && ObjectUtils.nullSafeEquals(getDeveloperMessage(), re.getDeveloperMessage())
                && ObjectUtils.nullSafeEquals(getMoreInfoUrl(), re.getMoreInfoUrl())
                && ObjectUtils.nullSafeEquals(getThrowable(), re.getThrowable());
    }

    return false;
}

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

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

From source file:Main.java

/**
 * Check whether the given Enumeration contains the given element.
 *
 * @param enumeration the Enumeration to check
 * @param element     the element to look for
 * @return {@code true} if found, {@code false} else
 *///from   w  w w. j  a va 2 s .c o  m
public static boolean contains(Enumeration<?> enumeration, Object element) {
    if (enumeration != null) {
        while (enumeration.hasMoreElements()) {
            Object candidate = enumeration.nextElement();
            if (ObjectUtils.nullSafeEquals(candidate, element)) {
                return true;
            }
        }
    }
    return false;
}

From source file:org.spring.data.gemfire.app.beans.Gemstone.java

@Override
public boolean equals(final Object obj) {
    if (obj == this) {
        return true;
    }/*from www .j  av  a  2  s.  c o  m*/

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

    Gemstone that = (Gemstone) obj;

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

From source file:example.app.model.Customer.java

@Override
public boolean equals(Object obj) {
    if (!super.equals(obj)) {
        return false;
    }/*from ww w. ja  v a  2  s  . c o  m*/

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

    Customer that = (Customer) obj;

    return super.equals(obj) && ObjectUtils.nullSafeEquals(this.getAccountNumber(), that.getAccountNumber());
}

From source file:com.springinpractice.ch14.kite.interceptor.GuardListSourcePointcut.java

@Override
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }//from ww  w.j  a  v  a 2  s. c  o m
    if (!(other instanceof GuardListSourcePointcut)) {
        return false;
    }
    GuardListSourcePointcut otherPc = (GuardListSourcePointcut) other;
    return ObjectUtils.nullSafeEquals(source, otherPc.source);
}

From source file:com.springsource.hq.plugin.tcserver.serverconfig.configuration.jvm.General.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }//  w  ww  .  ja  v a2  s  .  c o m
    if (!(obj instanceof General)) {
        return false;
    }
    General general = (General) obj;
    return ObjectUtils.nullSafeEquals(this.getServer(), general.getServer());
}

From source file:com.springsource.hq.plugin.tcserver.serverconfig.configuration.jvm.Advanced.java

@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }/*w  w w .ja v a2  s.  com*/
    if (!(obj instanceof Advanced)) {
        return false;
    }
    Advanced advanced = (Advanced) obj;
    return ObjectUtils.nullSafeEquals(this.getCliArgs(), advanced.getCliArgs());
}