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 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 it contains a single value and it is null then return empty blob.
|
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.converter
- 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.