/** Field name. */
public static final String SECOND_FIELD_NAME = "second";
@Override
public MutableFudgeMsg buildMessage(FudgeSerializer serializer, Pair<?, ?> object) {
final MutableFudgeMsg msg = serializer.newMessage();
if (object instanceof LongObjectPair || object instanceof LongDoublePair) {
msg.add("firstLong", object.getFirst());
} else if (object instanceof IntObjectPair || object instanceof IntDoublePair) {
msg.add("firstInt", object.getFirst());
} else if (object instanceof DoublesPair) {
msg.add("firstDouble", object.getFirst());
} else {
if (object.getFirst() != null) {
if (object.getFirst() instanceof String) {
msg.add(FIRST_FIELD_NAME, null, FudgeWireType.STRING, object.getFirst());
} else {
serializer.addToMessageObject(msg, FIRST_FIELD_NAME, null, object.getFirst(), Object.class);
}
}
}
if (object instanceof LongDoublePair || object instanceof IntDoublePair || object instanceof DoublesPair) {
msg.add("secondDouble", object.getSecond());
} else {
if (object.getSecond() != null) {
if (object.getSecond() instanceof String) {
msg.add(SECOND_FIELD_NAME, null, FudgeWireType.STRING, object.getSecond());
} else {
serializer.addToMessageObject(msg, SECOND_FIELD_NAME, null, object.getSecond(), Object.class);
}
}
}