public final class ProtobufJsonPayloadConverter extends java.lang.Object implements PayloadConverter
Constructor and Description |
---|
ProtobufJsonPayloadConverter() |
ProtobufJsonPayloadConverter(com.google.protobuf.util.JsonFormat.Printer printer,
com.google.protobuf.util.JsonFormat.Parser parser) |
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()
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.
|
public ProtobufJsonPayloadConverter()
public ProtobufJsonPayloadConverter(com.google.protobuf.util.JsonFormat.Printer printer, com.google.protobuf.util.JsonFormat.Parser parser)
public java.lang.String getEncodingType()
PayloadConverter
PayloadConverter
has an Encoding Type that it handles. Each PayloadConverter
should add the information about its Encoding Type into the Payload
it produces inside PayloadConverter.toData(Object)
by associating it with the EncodingKeys.METADATA_ENCODING_KEY
key attached to the Payload
's Metadata using Payload.Builder#putMetadata(String, ByteString)
.getEncodingType
in interface PayloadConverter
public java.util.Optional<io.temporal.api.common.v1.Payload> toData(java.lang.Object value) throws DataConverterException
PayloadConverter
toData
in interface PayloadConverter
value
- Java value to convert.DataConverterException
- if conversion of the value passed as parameter failed for any
reason.getEncodingType javadoc for an important implementation detail
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.