Packages

o

kalix.scalasdk

JsonSupport

object JsonSupport

Source
JsonSupport.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonSupport
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def decodeJson[T](jsonType: String, any: Any)(implicit arg0: ClassTag[T]): Option[T]

    Decode the given protobuf Any to an instance of T using Jackson but only if the suffix of the type URL matches the given jsonType.

    Decode the given protobuf Any to an instance of T using Jackson but only if the suffix of the type URL matches the given jsonType.

    returns

    An Option containing the successfully decoded value or None if the type suffix does not match.

    Exceptions thrown

    IllegalArgumentException if the suffix matches but the Any cannot be parsed into a T

  7. def decodeJson[T](any: Any)(implicit arg0: ClassTag[T]): T

    Decode the given protobuf Any object to an instance of T using Jackson.

    Decode the given protobuf Any object to an instance of T using Jackson. The object must have the JSON string as bytes as value and a type URL starting with json.kalix.io/.

    returns

    The decoded object

    Exceptions thrown

    IllegalArgumentException if the given value cannot be decoded to a T

  8. def encodeJson[T](value: T, jsonType: String): Any

    Encode the given value as JSON using Jackson and put the encoded string as bytes in a protobuf Any with the type URL json.kalix.io/[jsonType].

    Encode the given value as JSON using Jackson and put the encoded string as bytes in a protobuf Any with the type URL json.kalix.io/[jsonType].

    value

    the object to encode as JSON, must be an instance of a class properly annotated with the needed Jackson annotations.

    jsonType

    A discriminator making it possible to identify which type of object is in the JSON, useful for example when multiple different objects are passed through a pub/sub topic.

    Exceptions thrown

    IllegalArgumentException if the given value cannot be turned into JSON

  9. def encodeJson[T](value: T): Any

    Encode the given value as JSON using Jackson and put the encoded string as bytes in a protobuf Any with the type URL json.kalix.io/[valueClassName].

    Encode the given value as JSON using Jackson and put the encoded string as bytes in a protobuf Any with the type URL json.kalix.io/[valueClassName].

    Note that if the serialized Any is published to a pub/sub topic that is consumed by an external service using the class name suffix this introduces coupling as the internal class name of this service becomes known to the outside of the service (and for example renaming it may break existing consumers). For such cases consider using the overload with an explicit name for the JSON type instead.

    See also

    java.lang.String)

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def getObjectMapper(): ObjectMapper

    The Jackson ObjectMapper that is used for encoding and decoding JSON.

    The Jackson ObjectMapper that is used for encoding and decoding JSON. You may adjust it's configuration, but that must only be performed before starting Kalix

  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped