object JsonSupport
- Source
- JsonSupport.scala
- Alphabetic
- By Inheritance
- JsonSupport
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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
java.lang.IllegalArgumentException
if the suffix matches but the Any cannot be parsed into a T
- def decodeJson[T](any: Any)(implicit arg0: ClassTag[T]): T
Decode the given protobuf
Any
object to an instance ofT
using Jackson.Decode the given protobuf
Any
object to an instance ofT
using Jackson. The object must have the JSON string as bytes as value and a type URL starting withjson.kalix.io/
.- returns
The decoded object
- Exceptions thrown
java.lang.IllegalArgumentException
if the given value cannot be decoded to a T
- 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
java.lang.IllegalArgumentException
if the given value cannot be turned into JSON
- 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 URLjson.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 URLjson.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.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()