Package io.temporal.common.converter
Interface PayloadConverter
-
- All Known Implementing Classes:
ByteArrayPayloadConverter
,GsonJsonPayloadConverter
,JacksonJsonPayloadConverter
,NullPayloadConverter
,ProtobufJsonPayloadConverter
,ProtobufPayloadConverter
public interface PayloadConverter
Used by the framework to serialize/deserialize method parameters that need to be sent over the wire.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> T
fromData(io.temporal.api.common.v1.Payload content, java.lang.Class<T> valueType, java.lang.reflect.Type valueGenericType)
Implements conversion of a single value.java.lang.String
getEncodingType()
EachPayloadConverter
has an Encoding Type that it handles.java.util.Optional<io.temporal.api.common.v1.Payload>
toData(java.lang.Object value)
Implements conversion of a list of values.
-
-
-
Method Detail
-
getEncodingType
java.lang.String getEncodingType()
EachPayloadConverter
has an Encoding Type that it handles. EachPayloadConverter
should add the information about its Encoding Type into thePayload
it produces insidetoData(Object)
by associating it with theEncodingKeys.METADATA_ENCODING_KEY
key attached to thePayload
's Metadata usingPayload.Builder.putMetadata(String, ByteString)
.- Returns:
- encoding type that this converter handles.
-
toData
java.util.Optional<io.temporal.api.common.v1.Payload> toData(java.lang.Object value) throws DataConverterException
Implements conversion of a list of values.- Parameters:
value
- Java value to convert.- Returns:
- converted value
- Throws:
DataConverterException
- if conversion of the value passed as parameter failed for any reason.- See Also:
getEncodingType javadoc for an important implementation detail
-
fromData
<T> T fromData(io.temporal.api.common.v1.Payload content, java.lang.Class<T> valueType, java.lang.reflect.Type valueGenericType) throws DataConverterException
Implements conversion of a single value.- Parameters:
content
- Serialized value to convert to a Java object.valueType
- type of the value stored in thecontent
valueGenericType
- generic type of the value stored in thecontent
- Returns:
- converted Java object
- Throws:
DataConverterException
- if conversion of the data passed as parameter failed for any reason.
-
-