Class JsonTextMessageCodec

java.lang.Object
io.quarkus.websockets.next.runtime.JsonTextMessageCodec
All Implemented Interfaces:
MessageCodec<Object,String>, TextMessageCodec<Object>

@Singleton @Priority(0) public class JsonTextMessageCodec extends Object implements TextMessageCodec<Object>
  • Field Details

    • mapper

      @Inject com.fasterxml.jackson.databind.ObjectMapper mapper
  • Constructor Details

    • JsonTextMessageCodec

      public JsonTextMessageCodec()
  • Method Details

    • encode

      public String encode(Object value)
      Specified by:
      encode in interface MessageCodec<Object,String>
      Parameters:
      value - the value to encode, must not be null
      Returns:
      the encoded representation of the value
    • decode

      public Object decode(Type type, String value)
      Specified by:
      decode in interface MessageCodec<Object,String>
      Parameters:
      type - the type of the object to decode, must not be null
      value - the value to decode, must not be null
      Returns:
      the decoded representation of the value
    • supports

      public boolean supports(Type type)
      Specified by:
      supports in interface MessageCodec<Object,String>
      Parameters:
      type - the type to handle, must not be null
      Returns:
      true if this codec can encode/decode the provided type, false otherwise