public final class GsonJsonPayloadConverter extends java.lang.Object implements PayloadConverter
GsonJsonPayloadConverter(Function)
constructor.Constructor and Description |
---|
GsonJsonPayloadConverter() |
GsonJsonPayloadConverter(java.util.function.Function<com.google.gson.GsonBuilder,com.google.gson.GsonBuilder> builderInterceptor)
Constructs an instance giving an ability to override
Gson initialization. |
Modifier and Type | Method and Description |
---|---|
<T> T |
fromData(io.temporal.api.common.v1.Payload content,
java.lang.Class<T> valueClass,
java.lang.reflect.Type valueType)
Implements conversion of a single value.
|
java.lang.String |
getEncodingType() |
static PayloadConverter |
getInstance() |
java.util.Optional<io.temporal.api.common.v1.Payload> |
toData(java.lang.Object value)
Return empty if value is null.
|
public GsonJsonPayloadConverter()
public GsonJsonPayloadConverter(java.util.function.Function<com.google.gson.GsonBuilder,com.google.gson.GsonBuilder> builderInterceptor)
Gson
initialization.builderInterceptor
- function that intercepts GsonBuilder
construction.public static PayloadConverter getInstance()
public java.lang.String getEncodingType()
getEncodingType
in interface PayloadConverter
public java.util.Optional<io.temporal.api.common.v1.Payload> toData(java.lang.Object value) throws DataConverterException
toData
in interface PayloadConverter
value
- Java value to convert.DataConverterException
- if conversion of the value passed as parameter failed for any
reason.public <T> T fromData(io.temporal.api.common.v1.Payload content, java.lang.Class<T> valueClass, java.lang.reflect.Type valueType) throws DataConverterException
PayloadConverter
fromData
in interface PayloadConverter
content
- Serialized value to convert to a Java object.DataConverterException
- if conversion of the data passed as parameter failed for any
reason.