Class EncodedValues

  • All Implemented Interfaces:
    Values

    public final class EncodedValues
    extends java.lang.Object
    implements Values
    • Constructor Summary

      Constructors 
      Constructor Description
      EncodedValues​(java.lang.Object... values)  
      EncodedValues​(java.util.Optional<io.temporal.api.common.v1.Payloads> payloads, DataConverter converter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T get​(int index, java.lang.Class<T> parameterType)
      Get value of the specified type.
      <T> T get​(int index, java.lang.Class<T> parameterType, java.lang.reflect.Type genericParameterType)
      Get value of the specified generic type.
      int getSize()  
      void setDataConverter​(DataConverter converter)  
      java.util.Optional<io.temporal.api.common.v1.Payloads> toPayloads()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.temporal.common.converter.Values

        get, get
    • Constructor Detail

      • EncodedValues

        public EncodedValues​(java.util.Optional<io.temporal.api.common.v1.Payloads> payloads,
                             DataConverter converter)
      • EncodedValues

        public EncodedValues​(java.lang.Object... values)
    • Method Detail

      • toPayloads

        public java.util.Optional<io.temporal.api.common.v1.Payloads> toPayloads()
      • setDataConverter

        public void setDataConverter​(DataConverter converter)
      • getSize

        public int getSize()
        Specified by:
        getSize in interface Values
      • get

        public <T> T get​(int index,
                         java.lang.Class<T> parameterType)
                  throws DataConverterException
        Description copied from interface: Values
        Get value of the specified type.
        Specified by:
        get in interface Values
        Type Parameters:
        T - type of the value to get
        Parameters:
        index - index of the value in the list of values.
        parameterType - class of the value to get
        Returns:
        value or null
        Throws:
        DataConverterException - if value cannot be extracted to the given type
      • get

        public <T> T get​(int index,
                         java.lang.Class<T> parameterType,
                         java.lang.reflect.Type genericParameterType)
                  throws DataConverterException
        Description copied from interface: Values
        Get value of the specified generic type. For example if value is of type List use the following expression (using TypeToken) to extract:
        
         TypeToken<List<MyClass>> typeToken = new TypeToken<List<MyClass>>() {};
         List<MyClass> result = value.get(List.class, typeToken.getType());
          
        Specified by:
        get in interface Values
        Type Parameters:
        T - type of the value to get
        Parameters:
        index - index of the value in the list of values.
        parameterType - class of the value to get
        genericParameterType - the type of the value to get
        Returns:
        value or null
        Throws:
        DataConverterException - if value cannot be extracted to the given type