Polishing AbstractBeanDefinition.equals
This commit is contained in:
committed by
Juergen Hoeller
parent
866e9d702e
commit
8f9aa06dfe
@@ -1114,91 +1114,39 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
|||||||
public abstract AbstractBeanDefinition cloneBeanDefinition();
|
public abstract AbstractBeanDefinition cloneBeanDefinition();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object obj) {
|
||||||
if (this == other) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(other instanceof AbstractBeanDefinition)) {
|
if (!(obj instanceof AbstractBeanDefinition)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
AbstractBeanDefinition other = (AbstractBeanDefinition) obj;
|
||||||
AbstractBeanDefinition that = (AbstractBeanDefinition) other;
|
boolean rtn = true;
|
||||||
|
rtn = rtn &= ObjectUtils.nullSafeEquals(getBeanClassName(), other.getBeanClassName());
|
||||||
if (!ObjectUtils.nullSafeEquals(getBeanClassName(), that.getBeanClassName())) {
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.scope, other.scope);
|
||||||
return false;
|
rtn = rtn &= this.abstractFlag == other.abstractFlag;
|
||||||
}
|
rtn = rtn &= this.lazyInit == other.lazyInit;
|
||||||
if (!ObjectUtils.nullSafeEquals(this.scope, that.scope)) {
|
rtn = rtn &= this.autowireMode == other.autowireMode;
|
||||||
return false;
|
rtn = rtn &= this.dependencyCheck == other.dependencyCheck;
|
||||||
}
|
rtn = rtn &= Arrays.equals(this.dependsOn, other.dependsOn);
|
||||||
if (this.abstractFlag != that.abstractFlag) {
|
rtn = rtn &= this.autowireCandidate == other.autowireCandidate;
|
||||||
return false;
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.qualifiers, other.qualifiers);
|
||||||
}
|
rtn = rtn &= this.primary == other.primary;
|
||||||
if (this.lazyInit != that.lazyInit) {
|
rtn = rtn &= this.nonPublicAccessAllowed == other.nonPublicAccessAllowed;
|
||||||
return false;
|
rtn = rtn &= this.lenientConstructorResolution == other.lenientConstructorResolution;
|
||||||
}
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.constructorArgumentValues, other.constructorArgumentValues);
|
||||||
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.propertyValues, other.propertyValues);
|
||||||
if (this.autowireMode != that.autowireMode) {
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.methodOverrides, other.methodOverrides);
|
||||||
return false;
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.factoryBeanName, other.factoryBeanName);
|
||||||
}
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.factoryMethodName, other.factoryMethodName);
|
||||||
if (this.dependencyCheck != that.dependencyCheck) {
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.initMethodName, other.initMethodName);
|
||||||
return false;
|
rtn = rtn &= this.enforceInitMethod == other.enforceInitMethod;
|
||||||
}
|
rtn = rtn &= ObjectUtils.nullSafeEquals(this.destroyMethodName, other.destroyMethodName);
|
||||||
if (!Arrays.equals(this.dependsOn, that.dependsOn)) {
|
rtn = rtn &= this.enforceDestroyMethod == other.enforceDestroyMethod;
|
||||||
return false;
|
rtn = rtn &= this.synthetic == other.synthetic;
|
||||||
}
|
rtn = rtn &= this.role == other.role;
|
||||||
if (this.autowireCandidate != that.autowireCandidate) {
|
return rtn && super.equals(obj);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.qualifiers, that.qualifiers)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.primary != that.primary) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.nonPublicAccessAllowed != that.nonPublicAccessAllowed) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.lenientConstructorResolution != that.lenientConstructorResolution) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.constructorArgumentValues, that.constructorArgumentValues)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.propertyValues, that.propertyValues)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.methodOverrides, that.methodOverrides)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.factoryBeanName, that.factoryBeanName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.factoryMethodName, that.factoryMethodName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.initMethodName, that.initMethodName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.enforceInitMethod != that.enforceInitMethod) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!ObjectUtils.nullSafeEquals(this.destroyMethodName, that.destroyMethodName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.enforceDestroyMethod != that.enforceDestroyMethod) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.synthetic != that.synthetic) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.role != that.role) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.equals(other);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user