PdxField implements DataSerializable, Comparable<PdxField> { @Override public boolean equals(Object other) { if (other == this) { return true; } if (!(other instanceof PdxField)) { return false; } PdxField otherVFT = (PdxField) other; if (otherVFT.fieldName == null) { return false; } if (otherVFT.fieldName.equals(this.fieldName) && this.isDeleted() == otherVFT.isDeleted() && this.type.equals(otherVFT.type)) { return true; } return false; } PdxField();  PdxField(String fieldName, int index, int varId, FieldType type, boolean identityField); protected  PdxField(PdxField other); String getFieldName(); int getFieldIndex(); int getVarLenFieldSeqId(); boolean isVariableLengthType(); FieldType getFieldType(); int getRelativeOffset(); void setRelativeOffset(int relativeOffset); int getVlfOffsetIndex(); void setVlfOffsetIndex(int vlfOffsetIndex); void setIdentityField(boolean identityField); boolean isIdentityField(); void setDeleted(boolean v); boolean isDeleted(); @Override void fromData(DataInput in); @Override void toData(DataOutput out); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); String getTypeIdString(); @Override int compareTo(PdxField o); void toStream(PrintStream printStream);  }
@Test public void testEquals() { final PdxField field = new PdxField(FIELD_NAME, FIELD_INDEX, VAR_LEN_FIELD_SEQ_ID, FIELD_TYPE, IDENTITY_FIELD); field.setDeleted(true); assertTrue(field.equals(field)); assertFalse(field.equals(null)); assertFalse(field.equals(new Object())); final PdxField sameFieldNameFieldTypeAndDeleted = new PdxField(FIELD_NAME, FIELD_INDEX + 1, VAR_LEN_FIELD_SEQ_ID + 1, FIELD_TYPE, !IDENTITY_FIELD); sameFieldNameFieldTypeAndDeleted.setDeleted(true); assertTrue(field.equals(sameFieldNameFieldTypeAndDeleted)); final PdxField differentFieldName = new PdxField("Not " + FIELD_NAME, FIELD_INDEX + 1, VAR_LEN_FIELD_SEQ_ID + 1, FIELD_TYPE, !IDENTITY_FIELD); differentFieldName.setDeleted(true); assertFalse(field.equals(differentFieldName)); final PdxField differentFieldType = new PdxField(FIELD_NAME, FIELD_INDEX + 1, VAR_LEN_FIELD_SEQ_ID + 1, getAnotherFieldType(FIELD_TYPE), !IDENTITY_FIELD); differentFieldType.setDeleted(true); assertFalse(field.equals(differentFieldType)); final PdxField differentDeleted = new PdxField(FIELD_NAME, FIELD_INDEX + 1, VAR_LEN_FIELD_SEQ_ID + 1, FIELD_TYPE, !IDENTITY_FIELD); differentDeleted.setDeleted(false); assertFalse(field.equals(differentDeleted)); }