This simplifies implementations of equals() method.
Change-Id: Ib58c7417607f85224ab6d452dab2a8aac604c055
Signed-off-by: Robert Varga <rovarga@cisco.com>
return false;
}
final LazyDataObject<?> other = (LazyDataObject<?>) obj;
- if (context == null) {
- if (other.context != null) {
- return false;
- }
- } else if (!context.equals(other.context)) {
- return false;
- }
- if (data == null) {
- if (other.data != null) {
- return false;
- }
- } else if (!data.equals(other.data)) {
- return false;
- }
- return true;
+ return Objects.equals(context, other.context) && Objects.equals(data, other.data);
}
}
* @param name
* string with the name for this <code>Type</code>
*/
- protected AbstractBaseType(String pkName, String name) {
+ protected AbstractBaseType(final String pkName, final String name) {
if (pkName == null) {
throw new IllegalArgumentException("Package Name for Generated Type cannot be null!");
}
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
return false;
}
Type other = (Type) obj;
- if (name == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!name.equals(other.getName())) {
- return false;
- }
- if (packageName == null) {
- if (other.getPackageName() != null) {
- return false;
- }
- } else if (!packageName.equals(other.getPackageName())) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.getName()) && Objects.equals(packageName, other.getPackageName());
}
@Override
return false;
}
AbstractGeneratedTypeBuilder<?> other = (AbstractGeneratedTypeBuilder<?>) obj;
- if (getName() == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!getName().equals(other.getName())) {
- return false;
- }
- if (getPackageName() == null) {
- if (other.getPackageName() != null) {
- return false;
- }
- } else if (!getPackageName().equals(other.getPackageName())) {
- return false;
- }
- return true;
+ return Objects.equals(getName(), other.getName()) && Objects.equals(getPackageName(), other.getPackageName());
}
public Type getParent() {
return false;
}
AbstractTypeMember other = (AbstractTypeMember) obj;
- if (getName() == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!getName().equals(other.getName())) {
- return false;
- }
- if (getReturnType() == null) {
- if (other.getReturnType() != null) {
- return false;
- }
- } else if (!getReturnType().equals(other.getReturnType())) {
- return false;
- }
- return true;
+ return Objects.equals(getName(), other.getName()) && Objects.equals(getReturnType(), other.getReturnType());
}
@Override
return false;
}
AbstractTypeMemberBuilder<?> other = (AbstractTypeMemberBuilder<?>) obj;
- if (getName() == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!getName().equals(other.getName())) {
- return false;
- }
- if (getReturnType() == null) {
- if (other.getReturnType() != null) {
- return false;
- }
- } else if (!getReturnType().equals(other.getReturnType())) {
- return false;
- }
- return true;
+ return Objects.equals(getName(), other.getName()) && Objects.equals(getReturnType(), other.getReturnType());
}
@Override
return false;
}
AnnotationTypeBuilderImpl other = (AnnotationTypeBuilderImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (packageName == null) {
- if (other.packageName != null) {
- return false;
- }
- } else if (!packageName.equals(other.packageName)) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.name) && Objects.equals(packageName, other.packageName);
}
@Override
return false;
}
AnnotationTypeImpl other = (AnnotationTypeImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (packageName == null) {
- if (other.packageName != null) {
- return false;
- }
- } else if (!packageName.equals(other.packageName)) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.name) && Objects.equals(packageName, other.packageName);
}
@Override
return false;
}
ParameterImpl other = (ParameterImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.name);
}
@Override
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#hashCode()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
return false;
}
ConstantImpl other = (ConstantImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (type == null) {
- if (other.type != null) {
- return false;
- }
- } else if (!type.equals(other.type)) {
- return false;
- }
- if (value == null) {
- if (other.value != null) {
- return false;
- }
- } else if (!value.equals(other.value)) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.name) && Objects.equals(type, other.type) && Objects.equals(value, other.value);
}
@Override
}
@Override
- public void setDescription(String description) {
+ public void setDescription(final String description) {
this.description = description;
}
return false;
}
EnumPairImpl other = (EnumPairImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (value == null) {
- if (other.value != null) {
- return false;
- }
- } else if (!value.equals(other.value)) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.name) && Objects.equals(value, other.value);
}
/*
package org.opendaylight.yangtools.binding.generator.util.generated.type.builder;
import java.util.Objects;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature.Parameter;
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
final class MethodParameterImpl implements Parameter {
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#hashCode()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
return false;
}
MethodParameterImpl other = (MethodParameterImpl) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (type == null) {
- if (other.type != null) {
- return false;
- }
- } else if (!type.equals(other.type)) {
- return false;
- }
- return true;
+ return Objects.equals(name, other.name) && Objects.equals(type, other.type);
}
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
return false;
}
MethodSignatureBuilderImpl other = (MethodSignatureBuilderImpl) obj;
- if (getName() == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!getName().equals(other.getName())) {
+ if (!Objects.equals(getName(), other.getName())) {
return false;
}
- if (parameters == null) {
- if (other.parameters != null) {
- return false;
- }
- } else if (!parameters.equals(other.parameters)) {
+ if (!Objects.equals(parameters, other.parameters)) {
return false;
}
- if (getReturnType() == null) {
- if (other.getReturnType() != null) {
- return false;
- }
- } else if (!getReturnType().equals(other.getReturnType())) {
+ if (!Objects.equals(getReturnType(), other.getReturnType())) {
return false;
}
return true;
return false;
}
MethodSignatureImpl other = (MethodSignatureImpl) obj;
- if (getName() == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!getName().equals(other.getName())) {
+ if (!Objects.equals(getName(), other.getName())) {
return false;
}
- if (params == null) {
- if (other.params != null) {
- return false;
- }
- } else if (!params.equals(other.params)) {
+ if (!Objects.equals(params, other.params)) {
return false;
}
- if (getReturnType() == null) {
- if (other.getReturnType() != null) {
- return false;
- }
- } else if (!getReturnType().equals(other.getReturnType())) {
+ if (!Objects.equals(getReturnType(), other.getReturnType())) {
return false;
}
return true;