/**
 * 
 */
package net.floodlightcontroller.mobilesdn.web;

import java.io.IOException;

import net.floodlightcontroller.mobilesdn.APAgent;
import net.floodlightcontroller.mobilesdn.Client;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * @author Yanhe Liu <yanhe.liu@cs.helsinki.fi>
 *
 */
public class ClientJsonSerializer extends JsonSerializer<Client> {

    /**
     * Handles serialization for APAgent
     */
    @Override
    public void serialize(Client clt, JsonGenerator jGen,
            SerializerProvider serializer) throws IOException,
            JsonProcessingException {
        
        jGen.writeStartObject();
        
        jGen.writeStringField("mac", clt.getMacAddress().toString());
        jGen.writeStringField("ip", clt.getIpAddress().getHostAddress());
        jGen.writeStringField("downrate", Double.toString(clt.getDownRate()));
        
        jGen.writeObjectFieldStart("agent");
        jGen.writeStringField("ssid", clt.getAgent().getSSID());
        jGen.writeStringField("bssid", clt.getAgent().getBSSID());
        jGen.writeStringField("ip", clt.getAgent().getIpAddress().getHostAddress());
        jGen.writeEndObject();
        
        jGen.writeEndObject();
    }
    
    
    /**
     * Tells SimpleModule that we are the serializer for APAgent
     */
    @Override
    public Class<Client> handledType() {
        return Client.class;
    }

}

@@ -570,28 +570,27 @@
 ization for 
-APAg
+Cli
 ent%0A     */%0A
@@ -1419,21 +1419,8 @@
 lls 
-SimpleModule 
 that
@@ -1446,20 +1446,19 @@
 zer for 
-APAg
+Cli
 ent%0A    

Remove comment typos in ClientJsonSerializer