Java Code Examples for org.springframework.util.ObjectUtils#nullSafeEquals()
The following examples show how to use
org.springframework.util.ObjectUtils#nullSafeEquals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationTypeMapping.java From spring-analysis-note with MIT License | 6 votes |
private void validateMirrorSet(MirrorSet mirrorSet) { Method firstAttribute = mirrorSet.get(0); Object firstDefaultValue = firstAttribute.getDefaultValue(); for (int i = 1; i <= mirrorSet.size() - 1; i++) { Method mirrorAttribute = mirrorSet.get(i); Object mirrorDefaultValue = mirrorAttribute.getDefaultValue(); if (firstDefaultValue == null || mirrorDefaultValue == null) { throw new AnnotationConfigurationException(String.format( "Misconfigured aliases: %s and %s must declare default values.", AttributeMethods.describe(firstAttribute), AttributeMethods.describe(mirrorAttribute))); } if (!ObjectUtils.nullSafeEquals(firstDefaultValue, mirrorDefaultValue)) { throw new AnnotationConfigurationException(String.format( "Misconfigured aliases: %s and %s must declare the same default value.", AttributeMethods.describe(firstAttribute), AttributeMethods.describe(mirrorAttribute))); } } }
Example 2
Source File: KeyValueTemplateTestsUsingHazelcastTest.java From spring-data-hazelcast with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ClassWithTypeAlias)) { return false; } ClassWithTypeAlias other = (ClassWithTypeAlias) obj; if (!ObjectUtils.nullSafeEquals(this.id, other.id)) { return false; } if (!ObjectUtils.nullSafeEquals(this.name, other.name)) { return false; } return true; }
Example 3
Source File: BeanMetadataAttribute.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof BeanMetadataAttribute)) { return false; } BeanMetadataAttribute otherMa = (BeanMetadataAttribute) other; return (this.name.equals(otherMa.name) && ObjectUtils.nullSafeEquals(this.value, otherMa.value) && ObjectUtils.nullSafeEquals(this.source, otherMa.source)); }
Example 4
Source File: BeanDefinitionHolder.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof BeanDefinitionHolder)) { return false; } BeanDefinitionHolder otherHolder = (BeanDefinitionHolder) other; return this.beanDefinition.equals(otherHolder.beanDefinition) && this.beanName.equals(otherHolder.beanName) && ObjectUtils.nullSafeEquals(this.aliases, otherHolder.aliases); }
Example 5
Source File: AbstractAspectJAdvisorFactoryTests.java From java-technology-stack with MIT License | 5 votes |
@Before(value="execution(void set*(*)) && this(modifiable) && args(newValue)", argNames="modifiable,newValue") public void recordModificationIfSetterArgumentDiffersFromOldValue( JoinPoint jp, MutableModifiable mixin, Object newValue) { /* * We use the mixin to check and, if necessary, change, * modification status. We need the JoinPoint to get the * setter method. We use newValue for comparison. * We try to invoke the getter if possible. */ if (mixin.isModified()) { // Already changed, don't need to change again //System.out.println("changed"); return; } // Find the current raw value, by invoking the corresponding setter Method correspondingGetter = getGetterFromSetter(((MethodSignature) jp.getSignature()).getMethod()); boolean modified = true; if (correspondingGetter != null) { try { Object oldValue = correspondingGetter.invoke(jp.getTarget()); //System.out.println("Old value=" + oldValue + "; new=" + newValue); modified = !ObjectUtils.nullSafeEquals(oldValue, newValue); } catch (Exception ex) { ex.printStackTrace(); // Don't sweat on exceptions; assume value was modified } } else { //System.out.println("cannot get getter for " + jp); } if (modified) { mixin.markDirty(); } }
Example 6
Source File: NotificationListenerHolder.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof NotificationListenerHolder)) { return false; } NotificationListenerHolder otherNlh = (NotificationListenerHolder) other; return (ObjectUtils.nullSafeEquals(this.notificationListener, otherNlh.notificationListener) && ObjectUtils.nullSafeEquals(this.notificationFilter, otherNlh.notificationFilter) && ObjectUtils.nullSafeEquals(this.handback, otherNlh.handback) && ObjectUtils.nullSafeEquals(this.mappedObjectNames, otherNlh.mappedObjectNames)); }
Example 7
Source File: FlashMap.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof FlashMap)) { return false; } FlashMap otherFlashMap = (FlashMap) other; return (super.equals(otherFlashMap) && ObjectUtils.nullSafeEquals(this.targetRequestPath, otherFlashMap.targetRequestPath) && this.targetRequestParams.equals(otherFlashMap.targetRequestParams)); }
Example 8
Source File: CacheOperationSourcePointcut.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof CacheOperationSourcePointcut)) { return false; } CacheOperationSourcePointcut otherPc = (CacheOperationSourcePointcut) other; return ObjectUtils.nullSafeEquals(getCacheOperationSource(), otherPc.getCacheOperationSource()); }
Example 9
Source File: PropertyValue.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof PropertyValue)) { return false; } PropertyValue otherPv = (PropertyValue) other; return (this.name.equals(otherPv.name) && ObjectUtils.nullSafeEquals(this.value, otherPv.value) && ObjectUtils.nullSafeEquals(getSource(), otherPv.getSource())); }
Example 10
Source File: JCacheOperationSourcePointcut.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof JCacheOperationSourcePointcut)) { return false; } JCacheOperationSourcePointcut otherPc = (JCacheOperationSourcePointcut) other; return ObjectUtils.nullSafeEquals(getCacheOperationSource(), otherPc.getCacheOperationSource()); }
Example 11
Source File: AbstractPointcutAdvisor.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof PointcutAdvisor)) { return false; } PointcutAdvisor otherAdvisor = (PointcutAdvisor) other; return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) && ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut())); }
Example 12
Source File: ResolvableType.java From spring-analysis-note with MIT License | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof ResolvableType)) { return false; } ResolvableType otherType = (ResolvableType) other; if (!ObjectUtils.nullSafeEquals(this.type, otherType.type)) { return false; } if (this.typeProvider != otherType.typeProvider && (this.typeProvider == null || otherType.typeProvider == null || !ObjectUtils.nullSafeEquals(this.typeProvider.getType(), otherType.typeProvider.getType()))) { return false; } if (this.variableResolver != otherType.variableResolver && (this.variableResolver == null || otherType.variableResolver == null || !ObjectUtils.nullSafeEquals(this.variableResolver.getSource(), otherType.variableResolver.getSource()))) { return false; } if (!ObjectUtils.nullSafeEquals(this.componentType, otherType.componentType)) { return false; } return true; }
Example 13
Source File: WebSocketMessage.java From spring-analysis-note with MIT License | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof WebSocketMessage)) { return false; } WebSocketMessage otherMessage = (WebSocketMessage) other; return (this.type.equals(otherMessage.type) && ObjectUtils.nullSafeEquals(this.payload, otherMessage.payload)); }
Example 14
Source File: HttpEntity.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || other.getClass() != getClass()) { return false; } HttpEntity<?> otherEntity = (HttpEntity<?>) other; return (ObjectUtils.nullSafeEquals(this.headers, otherEntity.headers) && ObjectUtils.nullSafeEquals(this.body, otherEntity.body)); }
Example 15
Source File: BeanDefinitionVisitor.java From spring-analysis-note with MIT License | 5 votes |
protected void visitPropertyValues(MutablePropertyValues pvs) { PropertyValue[] pvArray = pvs.getPropertyValues(); for (PropertyValue pv : pvArray) { Object newVal = resolveValue(pv.getValue()); if (!ObjectUtils.nullSafeEquals(newVal, pv.getValue())) { pvs.add(pv.getName(), newVal); } } }
Example 16
Source File: SimpleField.java From dubbox with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof SimpleField)) { return false; } SimpleField that = (SimpleField) other; return ObjectUtils.nullSafeEquals(this.name, that.name); }
Example 17
Source File: ResolvableType.java From spring-analysis-note with MIT License | 5 votes |
@Nullable private ResolvableType resolveVariable(TypeVariable<?> variable) { if (this.type instanceof TypeVariable) { return resolveType().resolveVariable(variable); } if (this.type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) this.type; Class<?> resolved = resolve(); if (resolved == null) { return null; } TypeVariable<?>[] variables = resolved.getTypeParameters(); for (int i = 0; i < variables.length; i++) { if (ObjectUtils.nullSafeEquals(variables[i].getName(), variable.getName())) { Type actualType = parameterizedType.getActualTypeArguments()[i]; return forType(actualType, this.variableResolver); } } Type ownerType = parameterizedType.getOwnerType(); if (ownerType != null) { return forType(ownerType, this.variableResolver).resolveVariable(variable); } } if (this.variableResolver != null) { return this.variableResolver.resolveVariable(variable); } return null; }
Example 18
Source File: KeyValueTemplateTestsUsingHazelcastTest.java From spring-data-hazelcast with Apache License 2.0 | 5 votes |
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Foo)) { return false; } Foo other = (Foo) obj; return ObjectUtils.nullSafeEquals(this.foo, other.foo); }
Example 19
Source File: ClassFilters.java From spring-analysis-note with MIT License | 4 votes |
@Override public boolean equals(Object other) { return (this == other || (other instanceof IntersectionClassFilter && ObjectUtils.nullSafeEquals(this.filters, ((IntersectionClassFilter) other).filters))); }
Example 20
Source File: HeadersRequestCondition.java From spring-analysis-note with MIT License | 4 votes |
@Override protected boolean matchValue(HttpServletRequest request) { return ObjectUtils.nullSafeEquals(this.value, request.getHeader(this.name)); }