List of usage examples for org.springframework.util ObjectUtils nullSafeEquals
public static boolean nullSafeEquals(@Nullable Object o1, @Nullable Object o2)
From source file:org.wallride.service.CategoryService.java
@CacheEvict(value = { WallRideCacheConfiguration.ARTICLE_CACHE, WallRideCacheConfiguration.PAGE_CACHE }, allEntries = true) public Category updateCategory(CategoryUpdateRequest request, AuthorizedUser authorizedUser) { categoryRepository.lock(request.getId()); Category category = categoryRepository.findOneByIdAndLanguage(request.getId(), request.getLanguage()); Category parent = null;/*from w ww. j a v a 2s. co m*/ if (request.getParentId() != null) { parent = categoryRepository.findOneByIdAndLanguage(request.getParentId(), request.getLanguage()); } if (!(category.getParent() == null && parent == null) && !ObjectUtils.nullSafeEquals(category.getParent(), parent)) { categoryRepository.shiftLftRgt(category.getLft(), category.getRgt()); categoryRepository.shiftRgt(category.getRgt()); categoryRepository.shiftLft(category.getRgt()); int rgt = 0; if (parent == null) { rgt = categoryRepository.findMaxRgt(); rgt++; } else { rgt = parent.getRgt(); categoryRepository.unshiftRgt(rgt); categoryRepository.unshiftLft(rgt); } category.setLft(rgt); category.setRgt(rgt + 1); } category.setParent(parent); String code = request.getCode(); if (code == null) { try { code = new CodeFormatter().parse(request.getName(), LocaleContextHolder.getLocale()); } catch (ParseException e) { throw new ServiceException(e); } } category.setCode(code); category.setName(request.getName()); category.setDescription(request.getDescription()); category.setLanguage(request.getLanguage()); return categoryRepository.save(category); }
From source file:com.turbospaces.core.SpaceUtility.java
/** * check whether template object(in form of property values) matches with actual bean's property value. This method * is efficiently used for {@link JSpace#notify(Object, com.turbospaces.api.SpaceNotificationListener, int)} * operation implementation.</p>/*from w w w. j a va 2 s.co m*/ * * @param templatePropertyValues * template object's properties * @param entryPropertyValues * actual entry's properties * * @return template matches result */ public static boolean macthesByPropertyValues(final Object[] templatePropertyValues, final Object[] entryPropertyValues) { assert templatePropertyValues.length == entryPropertyValues.length; for (int i = 0; i < templatePropertyValues.length; i++) { final Object templatePropertyValue = templatePropertyValues[i]; final Object entryPropertyValue = entryPropertyValues[i]; if (templatePropertyValue != null && !ObjectUtils.nullSafeEquals(templatePropertyValue, entryPropertyValue)) return false; } return true; }
From source file:com.springsource.hq.plugin.tcserver.serverconfig.configuration.jvm.Debug.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/*from w ww . j ava 2 s. c o m*/ if (!(obj instanceof Debug)) { return false; } Debug debug = (Debug) obj; return ObjectUtils.nullSafeEquals(this.getHeapDumpOnOutOfMemoryError(), debug.getHeapDumpOnOutOfMemoryError()) && ObjectUtils.nullSafeEquals(this.getLoggc(), debug.getLoggc()) && ObjectUtils.nullSafeEquals(this.getPrintGC(), debug.getPrintGC()) && ObjectUtils.nullSafeEquals(this.getPrintGCApplicationStoppedTime(), debug.getPrintGCApplicationStoppedTime()) && ObjectUtils.nullSafeEquals(this.getPrintGCDetails(), debug.getPrintGCDetails()) && ObjectUtils.nullSafeEquals(this.getPrintGCTimeStamps(), debug.getPrintGCTimeStamps()) && ObjectUtils.nullSafeEquals(this.getPrintHeapAtGC(), debug.getPrintHeapAtGC()); }
From source file:org.springmodules.cache.provider.ehcache.EhCacheCachingModel.java
/** * @see Object#equals(Object)// w w w .ja v a 2 s.co m */ public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof EhCacheCachingModel)) { return false; } EhCacheCachingModel cachingModel = (EhCacheCachingModel) obj; if (!ObjectUtils.nullSafeEquals(cacheName, cachingModel.cacheName)) { return false; } return true; }
From source file:org.springmodules.cache.impl.Element.java
/** * @see Object#equals(Object)// w w w. java 2s . com */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof Element)) { return false; } Element other = (Element) obj; if (!ObjectUtils.nullSafeEquals(key, other.key)) { return false; } if (!ObjectUtils.nullSafeEquals(value, other.value)) { return false; } return true; }
From source file:com.px100systems.data.core.CalculatingCriteria.java
@Override public CalculatingCriteria.Predicate convert(Criteria.ne c) { return new Predicate() { @Override/*from w w w. jav a 2s.c o m*/ public boolean eval() { return !ObjectUtils.nullSafeEquals(def.getField(bean, c.getMember()), c.getValue()); } }; }
From source file:com.wavemaker.commons.io.store.StoredResource.java
@Override public boolean equals(Object obj) { if (obj == this) { return true; }/*from w w w .jav a 2 s . c o m*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } StoredResource other = (StoredResource) obj; return ObjectUtils.nullSafeEquals(getStore(), other.getStore()); }
From source file:example.app.model.Address.java
@Override public boolean equals(Object obj) { if (obj == this) { return true; }//ww w. jav a 2 s . com if (!(obj instanceof Address)) { return false; } Address that = (Address) obj; return ObjectUtils.nullSafeEquals(this.getLocation(), that.getLocation()) && ObjectUtils.nullSafeEquals(this.getStreet(), that.getStreet()) && ObjectUtils.nullSafeEquals(this.getCity(), that.getCity()) && ObjectUtils.nullSafeEquals(this.getState(), that.getState()) && ObjectUtils.nullSafeEquals(this.getZipCode(), that.getZipCode()); }
From source file:org.spring.data.gemfire.app.beans.Person.java
@Override public boolean equals(final Object obj) { if (obj == this) { return true; }/*from w w w . j av a 2 s . c o m*/ if (!(obj instanceof Person)) { return false; } Person that = (Person) obj; return ObjectUtils.nullSafeEquals(this.getBirthDate(), that.getBirthDate()) && ObjectUtils.nullSafeEquals(this.getLastName(), that.getLastName()) && ObjectUtils.nullSafeEquals(this.getFirstName(), that.getFirstName()); }
From source file:org.openmrs.projectbuendia.ClientConceptNamer.java
private String getPreferredStringInLocaleOrNull(Concept concept, Locale locale) { for (ConceptName nameInLocale : concept.getNames(locale)) { if (ObjectUtils.nullSafeEquals(nameInLocale.isLocalePreferred(), true)) { return nameInLocale.getName(); }/*www.ja v a2 s. co m*/ } return null; }