Class AnimationTypeAdapter

java.lang.Object
io.github.kosmx.emotes.common.serializer.gson.AnimationTypeAdapter
All Implemented Interfaces:
com.google.gson.JsonDeserializer<com.zigythebird.playeranimcore.animation.Animation>, com.google.gson.JsonSerializer<com.zigythebird.playeranimcore.animation.Animation>

public final class AnimationTypeAdapter extends Object implements com.google.gson.JsonSerializer<com.zigythebird.playeranimcore.animation.Animation>, com.google.gson.JsonDeserializer<com.zigythebird.playeranimcore.animation.Animation>
(De)serializes an Animation to the Emotecraft binary format as a Base64 JSON string, so an emote can be embedded verbatim (e.g. in a config) rather than referenced by UUID. Ported from the Jackson variant; no downgrade.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.zigythebird.playeranimcore.animation.Animation
    deserialize(com.google.gson.JsonElement json, Type type, com.google.gson.JsonDeserializationContext ctx)
     
    static com.zigythebird.playeranimcore.animation.Animation
     
    static com.zigythebird.playeranimcore.animation.Animation
    fromBytes(byte[] bytes)
     
    com.google.gson.JsonElement
    serialize(com.zigythebird.playeranimcore.animation.Animation src, Type type, com.google.gson.JsonSerializationContext ctx)
     
    static String
    toBase64(com.zigythebird.playeranimcore.animation.Animation animation)
     
    static byte[]
    toBytes(com.zigythebird.playeranimcore.animation.Animation animation)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • toBytes

      public static byte[] toBytes(com.zigythebird.playeranimcore.animation.Animation animation)
    • fromBytes

      public static com.zigythebird.playeranimcore.animation.Animation fromBytes(byte[] bytes)
    • toBase64

      public static String toBase64(com.zigythebird.playeranimcore.animation.Animation animation)
    • fromBase64

      public static com.zigythebird.playeranimcore.animation.Animation fromBase64(String base64)
    • serialize

      public com.google.gson.JsonElement serialize(com.zigythebird.playeranimcore.animation.Animation src, Type type, com.google.gson.JsonSerializationContext ctx)
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<com.zigythebird.playeranimcore.animation.Animation>
    • deserialize

      public com.zigythebird.playeranimcore.animation.Animation deserialize(com.google.gson.JsonElement json, Type type, com.google.gson.JsonDeserializationContext ctx) throws com.google.gson.JsonParseException
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<com.zigythebird.playeranimcore.animation.Animation>
      Throws:
      com.google.gson.JsonParseException