List of usage examples for org.springframework.util ObjectUtils nullSafeEquals
public static boolean nullSafeEquals(@Nullable Object o1, @Nullable Object o2)
From source file:org.springframework.batch.item.excel.transform.MappingColumnToAttributeConverter.java
public String toColumn(final String attribute) { if (this.mapping.containsValue(attribute)) { for (Map.Entry<String, String> entry : this.mapping.entrySet()) { if (ObjectUtils.nullSafeEquals(attribute, entry.getValue())) { return entry.getKey(); }/*from www .j a v a 2s . c om*/ } } return attribute; }
From source file:org.hdiv.beans.SerializablePerson.java
public boolean equals(Object other) { if (!(other instanceof SerializablePerson)) { return false; }//from ww w .ja va 2s .c o m SerializablePerson p = (SerializablePerson) other; return p.age == age && ObjectUtils.nullSafeEquals(name, p.name); }
From source file:com.autsia.socialboot.infrastructure.syncronization.NodeManager.java
public void selectNewMasterNode() { Member localMember = hazelcastInstance.getCluster().getLocalMember(); Member next = hazelcastInstance.getCluster().getMembers().iterator().next(); if (ObjectUtils.nullSafeEquals(localMember, next)) { twitterService.start();//from ww w.j a v a 2 s .co m } }
From source file:com.developmentsprint.spring.breaker.interceptor.CircuitBreakerAttributeSourcePointcut.java
@Override public boolean equals(Object other) { if (this == other) { return true; }//from ww w. j a v a 2 s . c om if (!(other instanceof CircuitBreakerAttributeSourcePointcut)) { return false; } CircuitBreakerAttributeSourcePointcut otherPc = (CircuitBreakerAttributeSourcePointcut) other; return ObjectUtils.nullSafeEquals(getCircuitBreakerAttributeSource(), otherPc.getCircuitBreakerAttributeSource()); }
From source file:org.ayfaar.app.spring.handler.BusinessError.java
@Override public boolean equals(Object o) { if (this == o) { return true; }//from w w w . j ava 2 s . c om if (o instanceof BusinessError) { BusinessError re = (BusinessError) o; return ObjectUtils.nullSafeEquals(getCode(), re.getCode()); } return false; }
From source file:com.example.session.app.validation.ConfirmValidator.java
@Override public boolean isValid(Object value, ConstraintValidatorContext context) { BeanWrapper beanWrapper = new BeanWrapperImpl(value); Object fieldValue = beanWrapper.getPropertyValue(field); Object confirmFieldValue = beanWrapper.getPropertyValue(confirmField); boolean matched = ObjectUtils.nullSafeEquals(fieldValue, confirmFieldValue); if (matched) { return true; } else {// w w w . j a v a2s .c o m context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(message).addPropertyNode(field).addConstraintViolation(); return false; } }
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} if found, {@code false} else *//*from ww w . j a va 2 s .c o m*/ 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:com.indusborn.ui.validators.ConfirmValidator.java
public boolean isValid(Object value, ConstraintValidatorContext context) { BeanWrapper beanWrapper = new BeanWrapperImpl(value); Object fieldValue = beanWrapper.getPropertyValue(field); Object matchesValue = beanWrapper.getPropertyValue(matches); boolean matched = ObjectUtils.nullSafeEquals(fieldValue, matchesValue); if (matched) { return true; } else {// w ww. jav a 2 s. com context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(message).addNode(field).addConstraintViolation(); return false; } }
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</code> if found, <code>false</code> else *//*from ww w .j ava 2s . c om*/ 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.pivotal.customer.versonix.support.PaxReserveType.java
@Override public boolean equals(final Object obj) { if (obj == this) { return true; }//from ww w. j av a 2s .c o m if (!(obj instanceof PaxReserveType)) { return false; } PaxReserveType that = (PaxReserveType) obj; return ObjectUtils.nullSafeEquals(this.id, that.id); }