Package utils

Source Code of utils.PointJsonSerializer

package utils;

import java.lang.reflect.Type;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.vividsolutions.jts.geom.Point;

public class PointJsonSerializer implements JsonSerializer<Point> {

  @Override
  public JsonElement serialize(Point arg0, Type arg1,
      JsonSerializationContext arg2) {
   
    JsonObject point = new JsonObject();
    point.addProperty("x",  arg0.getX());
    point.addProperty("y",  arg0.getY());
 
    return point;
  }

}
TOP

Related Classes of utils.PointJsonSerializer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.