Simplifies implementations of equals() considerably.
Change-Id: I1d86308156abdca36ad9c770621a82e852ad56ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
return false;
}
AbstractSignedInteger other = (AbstractSignedInteger) obj;
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
+ if (!Objects.equals(description, other.description)) {
return false;
}
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
+ if (!Objects.equals(name, other.name)) {
return false;
}
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
+ if (!Objects.equals(path, other.path)) {
return false;
}
- if (rangeStatements == null) {
- if (other.rangeStatements != null) {
- return false;
- }
- } else if (!rangeStatements.equals(other.rangeStatements)) {
+ if (!Objects.equals(rangeStatements, other.rangeStatements)) {
return false;
}
- if (units == null) {
- if (other.units != null) {
- return false;
- }
- } else if (!units.equals(other.units)) {
+ if (!Objects.equals(units, other.units)) {
return false;
}
return true;
return false;
}
AbstractUnsignedInteger other = (AbstractUnsignedInteger) obj;
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
+ if (!Objects.equals(description, other.description)) {
return false;
}
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
+ if (!Objects.equals(name, other.name)) {
return false;
}
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
+ if (!Objects.equals(path, other.path)) {
return false;
}
- if (rangeStatements == null) {
- if (other.rangeStatements != null) {
- return false;
- }
- } else if (!rangeStatements.equals(other.rangeStatements)) {
+ if (!Objects.equals(rangeStatements, other.rangeStatements)) {
return false;
}
- if (units == null) {
- if (other.units != null) {
- return false;
- }
- } else if (!units.equals(other.units)) {
+ if (!Objects.equals(units, other.units)) {
return false;
}
return true;
return false;
}
BinaryType other = (BinaryType) obj;
- if (bytes == null) {
- if (other.bytes != null) {
- return false;
- }
- } else if (!bytes.equals(other.bytes)) {
- return false;
- }
- if (lengthConstraints == null) {
- if (other.lengthConstraints != null) {
- return false;
- }
- } else if (!lengthConstraints.equals(other.lengthConstraints)) {
- return false;
- }
- return true;
+ return Objects.equals(bytes, other.bytes) && Objects.equals(lengthConstraints, other.lengthConstraints);
}
@Override
return false;
}
Bit other = (Bit) obj;
- if (qname == null) {
- if (other.getQName() != null) {
- return false;
- }
- } else if (!qname.equals(other.getQName())) {
- return false;
- }
- if (schemaPath == null) {
- if (other.getPath() != null) {
- return false;
- }
- } else if (!schemaPath.equals(other.getPath())) {
- return false;
- }
- return true;
+ return Objects.equals(qname, other.getQName()) && Objects.equals(schemaPath, other.getPath());
}
@Override
return false;
}
BitsType other = (BitsType) obj;
- if (bits == null) {
- if (other.bits != null) {
- return false;
- }
- } else if (!bits.equals(other.bits)) {
- return false;
- }
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
- return false;
- }
- return true;
+ return Objects.equals(bits, other.bits) && Objects.equals(path, other.path);
}
@Override
return false;
}
Decimal64 other = (Decimal64) obj;
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
- return false;
- }
- return true;
+ return Objects.equals(path, other.path);
}
@Override
return false;
}
EnumerationType other = (EnumerationType) obj;
- if (defaultEnum == null) {
- if (other.defaultEnum != null) {
- return false;
- }
- } else if (!defaultEnum.equals(other.defaultEnum)) {
+ if (!Objects.equals(defaultEnum, other.defaultEnum)) {
return false;
}
- if (enums == null) {
- if (other.enums != null) {
- return false;
- }
- } else if (!enums.equals(other.enums)) {
+ if (!Objects.equals(enums, other.enums)) {
return false;
}
- if (path == null) {
- if (other.path != null) {
- return false;
- }
- } else if (!path.equals(other.path)) {
+ if (!Objects.equals(path, other.path)) {
return false;
}
return true;
return false;
}
Leafref other = (Leafref) obj;
- if (xpath == null) {
- if (other.xpath != null) {
- return false;
- }
- } else if (!xpath.equals(other.xpath)) {
- return false;
- }
- return true;
+ return Objects.equals(xpath, other.xpath);
}
@Override
return false;
}
final LengthConstraintImpl other = (LengthConstraintImpl) obj;
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
+ if (!Objects.equals(description, other.description)) {
return false;
}
- if (errorAppTag == null) {
- if (other.errorAppTag != null) {
- return false;
- }
- } else if (!errorAppTag.equals(other.errorAppTag)) {
+ if (!Objects.equals(errorAppTag, other.errorAppTag)) {
return false;
}
- if (errorMessage == null) {
- if (other.errorMessage != null) {
- return false;
- }
- } else if (!errorMessage.equals(other.errorMessage)) {
+ if (!Objects.equals(errorMessage, other.errorMessage)) {
return false;
}
if (max != other.max) {
if (min != other.min) {
return false;
}
- if (reference == null) {
- if (other.reference != null) {
- return false;
- }
- } else if (!reference.equals(other.reference)) {
+ if (!Objects.equals(reference, other.reference)) {
return false;
}
return true;
return false;
}
ModuleImport other = (ModuleImport) obj;
- if (getModuleName() == null) {
- if (other.getModuleName() != null) {
- return false;
- }
- } else if (!getModuleName().equals(other.getModuleName())) {
+ if (!Objects.equals(getModuleName(), other.getModuleName())) {
return false;
}
- if (getRevision() == null) {
- if (other.getRevision() != null) {
- return false;
- }
- } else if (!getRevision().equals(other.getRevision())) {
+ if (!Objects.equals(getRevision(), other.getRevision())) {
return false;
}
- if (getPrefix() == null) {
- if (other.getPrefix() != null) {
- return false;
- }
- } else if (!getPrefix().equals(other.getPrefix())) {
+ if (!Objects.equals(getPrefix(), other.getPrefix())) {
return false;
}
return true;
return false;
}
final MustDefinitionImpl other = (MustDefinitionImpl) obj;
- if (mustStr == null) {
- if (other.mustStr != null) {
- return false;
- }
- } else if (!mustStr.equals(other.mustStr)) {
+ if (!Objects.equals(mustStr, other.mustStr)) {
return false;
}
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
+ if (!Objects.equals(description, other.description)) {
return false;
}
- if (reference == null) {
- if (other.reference != null) {
- return false;
- }
- } else if (!reference.equals(other.reference)) {
+ if (!Objects.equals(reference, other.reference)) {
return false;
}
return true;
return false;
}
final PatternConstraintImpl other = (PatternConstraintImpl) obj;
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
+ if (!Objects.equals(description, other.description)) {
return false;
}
- if (errorAppTag == null) {
- if (other.errorAppTag != null) {
- return false;
- }
- } else if (!errorAppTag.equals(other.errorAppTag)) {
+ if (!Objects.equals(errorAppTag, other.errorAppTag)) {
return false;
}
- if (errorMessage == null) {
- if (other.errorMessage != null) {
- return false;
- }
- } else if (!errorMessage.equals(other.errorMessage)) {
+ if (!Objects.equals(errorMessage, other.errorMessage)) {
return false;
}
- if (reference == null) {
- if (other.reference != null) {
- return false;
- }
- } else if (!reference.equals(other.reference)) {
+ if (!Objects.equals(reference, other.reference)) {
return false;
}
- if (regex == null) {
- if (other.regex != null) {
- return false;
- }
- } else if (!regex.equals(other.regex)) {
+ if (!Objects.equals(regex, other.regex)) {
return false;
}
return true;
return false;
}
final RangeConstraintImpl other = (RangeConstraintImpl) obj;
- if (description == null) {
- if (other.description != null) {
- return false;
- }
- } else if (!description.equals(other.description)) {
+ if (!Objects.equals(description, other.description)) {
return false;
}
- if (max == null) {
- if (other.max != null) {
- return false;
- }
- } else if (!max.equals(other.max)) {
+ if (!Objects.equals(max, other.max)) {
return false;
}
- if (min == null) {
- if (other.min != null) {
- return false;
- }
- } else if (!min.equals(other.min)) {
+ if (!Objects.equals(min, other.min)) {
return false;
}
- if (reference == null) {
- if (other.reference != null) {
- return false;
- }
- } else if (!reference.equals(other.reference)) {
+ if (!Objects.equals(reference, other.reference)) {
return false;
}
return true;
return false;
}
RevisionAwareXPathImpl other = (RevisionAwareXPathImpl) obj;
- if (xpath == null) {
- if (other.xpath != null) {
- return false;
- }
- } else if (!xpath.equals(other.xpath)) {
- return false;
- }
- if (absolute != other.absolute) {
- return false;
- }
- return true;
+ return absolute == other.absolute && Objects.equals(xpath, other.xpath);
}
@Override
return false;
}
StringType other = (StringType) obj;
- if (lengthStatements == null) {
- if (other.lengthStatements != null) {
- return false;
- }
- } else if (!lengthStatements.equals(other.lengthStatements)) {
- return false;
- }
- if (patterns == null) {
- if (other.patterns != null) {
- return false;
- }
- } else if (!patterns.equals(other.patterns)) {
- return false;
- }
- return true;
+ return Objects.equals(lengthStatements, other.lengthStatements) && Objects.equals(patterns, other.patterns);
}
@Override