
nl.pvanassen.highchart.api.serializer.CenterSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of highchart-java-api Show documentation
Show all versions of highchart-java-api Show documentation
A Java API to generate highchart json on the server side.
The newest version!
package nl.pvanassen.highchart.api.serializer;
import java.lang.reflect.Type;
import nl.pvanassen.highchart.api.serie.SeriesCenter;
import com.google.gson.*;
public class CenterSerializer implements JsonSerializer {
@Override
public JsonElement serialize(SeriesCenter center, Type arg1, JsonSerializationContext arg2) {
if (center.getX() == null || center.getY() == null) {
return new JsonPrimitive("");
}
JsonArray r = new JsonArray();
r.add(new JsonPrimitive(center.getX()));
r.add(new JsonPrimitive(center.getY()));
return r;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy