io.leonis.subra.ipc.serialization.gson.FieldArcSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of subra Show documentation
Show all versions of subra Show documentation
soccer is simple, but it is difficult to play simple
package io.leonis.subra.ipc.serialization.gson;
import com.google.gson.*;
import java.lang.reflect.Type;
import io.leonis.subra.game.data.FieldArc;
/**
* Class for handling serialization of FieldArc objects.
*
* @author Ryan Meulenkamp
*/
public final class FieldArcSerializer implements JsonSerializer {
@Override
public JsonElement serialize(
final FieldArc field,
final Type type,
final JsonSerializationContext context
) {
final JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("x", field.getX());
jsonObject.addProperty("y", field.getY());
jsonObject.addProperty("startAngle", field.getStartAngle());
jsonObject.addProperty("stopAngle", field.getStopAngle());
jsonObject.addProperty("thickness", field.getThickness());
jsonObject.addProperty("radius", field.getRadius());
return jsonObject;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy