Interface DataConverter

  • All Known Implementing Classes:
    DefaultDataConverter

    public interface DataConverter
    Used by the framework to serialize/deserialize method parameters that need to be sent over the wire.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static java.lang.Object[] arrayFromPayloads​(DataConverter converter, java.util.Optional<io.temporal.api.common.v1.Payloads> content, java.lang.Class<?>[] parameterTypes, java.lang.reflect.Type[] genericParameterTypes)  
      <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> valueType, java.lang.reflect.Type valueGenericType)
      Implements conversion of an array of values of different types.
      static DataConverter getDefaultInstance()  
      <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)
      Implements conversion of a list of values.
    • Method Detail

      • toPayload

        <T> java.util.Optional<io.temporal.api.common.v1.Payload> toPayload​(T value)
      • fromPayload

        <T> T fromPayload​(io.temporal.api.common.v1.Payload payload,
                          java.lang.Class<T> valueClass,
                          java.lang.reflect.Type valueType)
      • toPayloads

        java.util.Optional<io.temporal.api.common.v1.Payloads> toPayloads​(java.lang.Object... values)
                                                                   throws DataConverterException
        Implements conversion of a list of values.
        Parameters:
        values - Java values to convert to String.
        Returns:
        converted value
        Throws:
        DataConverterException - if conversion of the value passed as parameter failed for any reason.
      • fromPayloads

        <T> T fromPayloads​(int index,
                           java.util.Optional<io.temporal.api.common.v1.Payloads> content,
                           java.lang.Class<T> valueType,
                           java.lang.reflect.Type valueGenericType)
                    throws DataConverterException
        Implements conversion of an array of values of different types. Useful for deserializing arguments of function invocations.
        Parameters:
        index - index of the value in the payloads
        content - serialized value to convert to Java objects.
        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.
      • arrayFromPayloads

        static java.lang.Object[] arrayFromPayloads​(DataConverter converter,
                                                    java.util.Optional<io.temporal.api.common.v1.Payloads> content,
                                                    java.lang.Class<?>[] parameterTypes,
                                                    java.lang.reflect.Type[] genericParameterTypes)
                                             throws DataConverterException
        Throws:
        DataConverterException