rythm-android.recordEqualityMethods.txt Maven / Gradle / Ivy
@args String className, com.linkedin.pegasus.generator.spec.RecordTemplateSpec record, org.coursera.courier.android.JavaSyntax syntax
@import com.linkedin.pegasus.generator.spec.RecordTemplateSpec.Field
@import com.linkedin.data.schema.DataSchema.Type
private transient volatile Integer hashCode = null;
@@Override
public int hashCode() {
if (hashCode != null) return hashCode.intValue();
@if(record.getFields().size() == 0) {
hashCode = Objects.hashCode(this.getClass());
} else {
hashCode = Objects.hash(this.getClass(), @syntax.hashCodeList(record.getFields()));
}
return hashCode.intValue();
}
@@Override
public boolean equals(Object obj) {
if (!(obj instanceof @className)) return false;
@className other = (@className)obj;
if (other == this) return true;
return @for(Field field: record.getFields()) {@{ String fieldName = syntax.escapeKeyword(field.getSchemaField().getName())} Objects.deepEquals(this.@fieldName, other.@fieldName) &&} true;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy