@FudgeBuilderFor(FuturePriceCurveData.class)
public class FuturePriceCurveDataFudgeBuilder implements FudgeBuilder<FuturePriceCurveData<?>> {
@Override
public MutableFudgeMsg buildMessage(final FudgeSerializer serializer, final FuturePriceCurveData<?> object) {
final MutableFudgeMsg message = serializer.newMessage();
message.add("target", FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(object.getTarget()), object.getTarget().getClass()));
serializer.addToMessage(message, "target", null, object.getTarget());
message.add("definitionName", object.getDefinitionName());
message.add("specificationName", object.getSpecificationName());
for (final Object x : object.getXs()) {
if (x != null) {
message.add("xs", null, FudgeSerializer.addClassHeader(serializer.objectToFudgeMsg(x), x.getClass()));
}
}
for (final Entry<?, Double> entry : object.asMap().entrySet()) {
final Object x = entry.getKey();
final MutableFudgeMsg subMessage = serializer.newMessage();
if (x != null) {
subMessage.add("x", null, serializer.objectToFudgeMsg(x));
subMessage.add("value", null, entry.getValue());
message.add("values", null, subMessage);
}
}
return message;
}