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.robotframework.swing.chooser.ByNameComponentChooser.java

public boolean checkComponent(Component comp) {
    return ObjectUtils.nullSafeEquals(comp.getName(), componentName);
}

From source file:org.robotframework.swing.chooser.ListItemChooser.java

public boolean checkItem(JListOperator operator, int index) {
    String item = operator.getModel().getElementAt(index).toString();
    return ObjectUtils.nullSafeEquals(name, item);
}

From source file:org.lightadmin.core.config.domain.renderer.EnumRenderer.java

@Override
public String apply(F input) {
    for (EnumElement elem : elements) {
        if (ObjectUtils.nullSafeEquals(elem.getValue(), input)) {
            return elem.getLabel();
        }/*from  w  w w. j  a  v  a  2  s.c o  m*/
    }
    return (input != null) ? input.toString() : "";
}

From source file:org.robotframework.swing.chooser.ByTextComponentChooser.java

public boolean checkComponent(Component component) {
    WithText withText = (WithText) Retrofit.partial(component, WithText.class);
    return ObjectUtils.nullSafeEquals(expectedText, withText.getText());
}

From source file:org.robotframework.swing.chooser.ByTitleComponentChooser.java

public boolean checkComponent(Component component) {
    WithTitle withTitle = (WithTitle) Retrofit.partial(component, WithTitle.class);
    return ObjectUtils.nullSafeEquals(expectedTitle, withTitle.getTitle());
}

From source file:Main.java

/**
 * Check whether the given Iterator contains the given element.
 * @param iterator the Iterator to check
 * @param element the element to look for
 * @return <code>true</code> if found, <code>false</code> else
 *///from  ww  w  . j  a  v a 2 s  .c om
public static boolean contains(Iterator iterator, Object element) {
    if (iterator != null) {
        while (iterator.hasNext()) {
            Object candidate = iterator.next();
            if (ObjectUtils.nullSafeEquals(candidate, element)) {
                return true;
            }
        }
    }
    return false;
}

From source file:org.springmodules.cache.serializable.Puppy.java

/**
 * @see Object#equals(Object)//from  w  ww  .ja  v a2s .co  m
 */
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }

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

    Puppy puppy = (Puppy) obj;
    return ObjectUtils.nullSafeEquals(name, puppy.name);
}

From source file:org.springmodules.validation.valang.EqualsFunction.java

protected Object getResult(Object target, Function[] arguments) {
    Object value1 = arguments[0].getResult(target);
    Object value2 = arguments[1].getResult(target);
    return (ObjectUtils.nullSafeEquals(value1, value2)) ? Boolean.TRUE : Boolean.FALSE;
}

From source file:me.j360.boot.microservice.profile.repository.InMemoryProfileRepository.java

@Override
public Profile findOne(Long id) {
    for (Profile customer : this.customers) {
        if (ObjectUtils.nullSafeEquals(customer.getId(), id)) {
            return customer;
        }/*ww w  .  j  a  va  2  s  .  c  om*/
    }
    return null;
}

From source file:com.frank.search.solr.core.query.SimpleField.java

@Override
public boolean equals(Object other) {
    if (this == other) {
        return true;
    }/*from w w  w  .j ava 2s . co m*/
    if (!(other instanceof SimpleField)) {
        return false;
    }
    SimpleField that = (SimpleField) other;
    return ObjectUtils.nullSafeEquals(this.name, that.name);
}