public class DefaultDataConverter extends java.lang.Object implements DataConverter
Constructor and Description |
---|
DefaultDataConverter(PayloadConverter... converters)
Creates instance from ordered array of converters.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
fromPayload(io.temporal.api.common.v1.Payload payload,
java.lang.Class<T> valueClass,
java.lang.reflect.Type valueType) |
<T> T |
fromPayloads(int index,
java.util.Optional<io.temporal.api.common.v1.Payloads> content,
java.lang.Class<T> parameterType,
java.lang.reflect.Type genericParameterType)
Implements conversion of an array of values of different types.
|
static DefaultDataConverter |
newDefaultInstance()
Creates a new instance of
DefaultDataConverter populated with the default list of
payload converters. |
static void |
setDefaultDataConverter(DataConverter converter)
Override the global data converter default.
|
<T> java.util.Optional<io.temporal.api.common.v1.Payload> |
toPayload(T value) |
java.util.Optional<io.temporal.api.common.v1.Payloads> |
toPayloads(java.lang.Object... values)
When values is empty or is null then return empty blob.
|
DefaultDataConverter |
withPayloadConverterOverrides(PayloadConverter... overrideConverters)
Modifies this
DefaultDataConverter by overriding some of its PayloadConverter s. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
arrayFromPayloads
public DefaultDataConverter(PayloadConverter... converters)
public static void setDefaultDataConverter(DataConverter converter)
WorkflowClientOptions.Builder.setDataConverter(DataConverter)
to avoid
potential conflicts.public static DefaultDataConverter newDefaultInstance()
DefaultDataConverter
populated with the default list of
payload converters.public DefaultDataConverter withPayloadConverterOverrides(PayloadConverter... overrideConverters)
DefaultDataConverter
by overriding some of its PayloadConverter
s.
Every payload converter from overrideConverters
either replaces existing payload
converter with the same encoding type, or is added to the end of payload converters list.public <T> java.util.Optional<io.temporal.api.common.v1.Payload> toPayload(T value)
toPayload
in interface DataConverter
public <T> T fromPayload(io.temporal.api.common.v1.Payload payload, java.lang.Class<T> valueClass, java.lang.reflect.Type valueType)
fromPayload
in interface DataConverter
public java.util.Optional<io.temporal.api.common.v1.Payloads> toPayloads(java.lang.Object... values) throws DataConverterException
toPayloads
in interface DataConverter
values
- Java values to convert to String.DataConverterException
- if conversion of the value passed as parameter failed for any
reason.public <T> T fromPayloads(int index, java.util.Optional<io.temporal.api.common.v1.Payloads> content, java.lang.Class<T> parameterType, java.lang.reflect.Type genericParameterType) throws DataConverterException
DataConverter
fromPayloads
in interface DataConverter
index
- index of the value in the payloadscontent
- serialized value to convert to Java objects.parameterType
- type of the parameter stored in the contentgenericParameterType
- generic type of the parameter stored in the contentDataConverterException
- if conversion of the data passed as parameter failed for any
reason.