blob: a6a5405ef7cab029ec628228c389c0684c28f371 [file] [log] [blame]
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08001package net.floodlightcontroller.util.serializers;
2
3import java.io.IOException;
4
5import org.codehaus.jackson.JsonGenerator;
6import org.codehaus.jackson.JsonProcessingException;
7import org.codehaus.jackson.map.JsonSerializer;
8import org.codehaus.jackson.map.SerializerProvider;
9
10import net.floodlightcontroller.util.FlowPath;
11
12/**
13 * Serialize a FlowPath as a string.
14 */
15public class FlowPathSerializer extends JsonSerializer<FlowPath> {
16
17 @Override
18 public void serialize(FlowPath flowPath,
19 JsonGenerator jGen, SerializerProvider serializer)
20 throws IOException, JsonProcessingException {
21 jGen.writeStartObject();
22 jGen.writeObjectField("flowId", flowPath.flowId());
23 jGen.writeObjectField("installerId", flowPath.installerId());
24 jGen.writeObjectField("dataPath", flowPath.dataPath());
25 jGen.writeEndObject();
26 }
27}