blob: 6f1a6f6b4fe0081a79d380c8c28e343e463cb2d5 [file] [log] [blame]
package net.floodlightcontroller.util.serializers;
import java.io.IOException;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;
import net.floodlightcontroller.util.FlowId;
/**
* Serialize a Flow ID as a hexadecimal string.
*/
public class FlowIdSerializer extends JsonSerializer<FlowId> {
@Override
public void serialize(FlowId flowId, JsonGenerator jGen,
SerializerProvider serializer)
throws IOException, JsonProcessingException {
jGen.writeStartObject();
jGen.writeStringField("value", flowId.toString());
jGen.writeEndObject();
}
}