use of org.qi4j.api.association.AssociationWrapper in project qi4j-sdk by Qi4j.
the class AssociationInstance method equals.
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Association<?> that = (Association) o;
// Unwrap if needed
while (that instanceof AssociationWrapper) {
that = ((AssociationWrapper) that).next();
}
// Descriptor equality
AssociationInstance<?> thatInstance = (AssociationInstance) that;
AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
if (!associationInfo.equals(thatDescriptor)) {
return false;
}
// State equality
if (associationState.get() != null ? !associationState.get().equals(thatInstance.associationState.get()) : thatInstance.associationState.get() != null) {
return false;
}
return true;
}
Aggregations