Class CommentTypeAdapter

java.lang.Object
net.darkhax.pricklemc.common.api.config.comment.CommentTypeAdapter
All Implemented Interfaces:
com.google.gson.JsonDeserializer<IComment>, com.google.gson.JsonSerializer<IComment>

public final class CommentTypeAdapter extends Object implements com.google.gson.JsonSerializer<IComment>, com.google.gson.JsonDeserializer<IComment>
A GSON type adapter that handles reading and writing comments through GSON. This will serialize the values from IComment.getLines() and deserialize values to the basic Comment that only holds the data.
  • Field Details

    • INSTANCE

      public static final CommentTypeAdapter INSTANCE
      The single instance of this type adapter.
  • Method Details

    • deserialize

      public IComment deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<IComment>
      Throws:
      com.google.gson.JsonParseException
    • serialize

      public com.google.gson.JsonElement serialize(IComment src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<IComment>