public static void serializeAggregateReply(List<OFAggregateStatsReply> aggregateReplies, JsonGenerator jGen) throws IOException, JsonProcessingException{ OFAggregateStatsReply aggregateReply = aggregateReplies.get(0); // There are only one aggregateReply from the switch jGen.writeObjectFieldStart("aggregate"); jGen.writeStringField("version", aggregateReply.getVersion().toString()); //return the enum name jGen.writeNumberField("flowCount", aggregateReply.getFlowCount()); jGen.writeNumberField("packetCount", aggregateReply.getPacketCount().getValue()); jGen.writeNumberField("byteCount", aggregateReply.getByteCount().getValue()); switch (aggregateReply.getVersion()) { case OF_10: jGen.writeNumberField("flags", OFStatsReplyFlagsSerializerVer10.toWireValue(aggregateReply.getFlags())); break; case OF_11: jGen.writeNumberField("flags", OFStatsReplyFlagsSerializerVer11.toWireValue(aggregateReply.getFlags())); break; case OF_12: jGen.writeNumberField("flags", OFStatsReplyFlagsSerializerVer12.toWireValue(aggregateReply.getFlags())); break; case OF_13: jGen.writeNumberField("flags", OFStatsReplyFlagsSerializerVer13.toWireValue(aggregateReply.getFlags())); break; case OF_14: jGen.writeNumberField("flags", OFStatsReplyFlagsSerializerVer14.toWireValue(aggregateReply.getFlags())); break; default: break; } jGen.writeEndObject(); // end match }