Interface PayloadConverter

    • 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()
      Each PayloadConverter 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()
        Each PayloadConverter has an Encoding Type that it handles. Each PayloadConverter should add the information about its Encoding Type into the Payload it produces inside toData(Object) by associating it with the EncodingKeys.METADATA_ENCODING_KEY key attached to the Payload's Metadata using Payload.Builder.putMetadata(String, ByteString).
        Returns:
        encoding type that this converter handles.
      • 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 the content
        valueGenericType - generic type of the value stored in the content
        Returns:
        converted Java object
        Throws:
        DataConverterException - if conversion of the data passed as parameter failed for any reason.