Class GsonSerializer

java.lang.Object
io.github.projectunified.faststats.gson.GsonSerializer
All Implemented Interfaces:
Serializer

public class GsonSerializer extends Object implements Serializer
An implementation of Serializer that uses Google Gson.
  • Constructor Details

    • GsonSerializer

      public GsonSerializer()
      Constructs a new GsonSerializer with a default Gson instance.
    • GsonSerializer

      public GsonSerializer(com.google.gson.Gson gson)
      Constructs a new GsonSerializer with the specified Gson instance.
      Parameters:
      gson - the Gson instance to use
  • Method Details

    • serialize

      public String serialize(Map<String,Object> value) throws Exception
      Description copied from interface: Serializer
      Serializes the given telemetry map into its JSON representation.
      Specified by:
      serialize in interface Serializer
      Parameters:
      value - the telemetry map to serialize
      Returns:
      the serialized JSON string
      Throws:
      Exception - if serialization fails