PdxField implements DataSerializable, Comparable<PdxField> { @Override public int compareTo(PdxField o) { return getFieldName().compareTo(o.getFieldName()); } 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 testCompareTo() { final PdxField field = new PdxField(FIELD_NAME, FIELD_INDEX, VAR_LEN_FIELD_SEQ_ID, FIELD_TYPE, IDENTITY_FIELD); assertEquals(0, field.compareTo(field)); final PdxField sameFieldNameOnly = new PdxField(FIELD_NAME, FIELD_INDEX + 1, VAR_LEN_FIELD_SEQ_ID + 1, getAnotherFieldType(FIELD_TYPE), !IDENTITY_FIELD); assertEquals(0, field.compareTo(sameFieldNameOnly)); final PdxField differentFieldNameOnly = new PdxField("Not " + FIELD_NAME, FIELD_INDEX, VAR_LEN_FIELD_SEQ_ID, FIELD_TYPE, IDENTITY_FIELD); assertNotEquals(0, field.compareTo(differentFieldNameOnly)); }