Class JsonCodec

  • All Implemented Interfaces:
    eu.vstoyanov.natsy.codec.MessageCodec

    
    public final class JsonCodec<T extends Object>
     implements MessageCodec<T>
                        

    JSON codec using kotlinx.serialization

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String contentType
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonCodec(KSerializer<T> serializer, Json json, KClass<T> type)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String getContentType() Content type identifier for this codec
      ByteArray encode(T value) Encode a value to bytes
      Result<T> decode(ByteArray data) Decode bytes to a value
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait