Interface Values

  • All Known Implementing Classes:
    EncodedValues

    public interface Values
    Value that can be extracted to an appropriate type.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default 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.
      default <T> T get​(java.lang.Class<T> parameterType)
      The same as get(int, Class) with 0 index.
      default <T> T get​(java.lang.Class<T> parameterType, java.lang.reflect.Type genericParameterType)
      The same as get(int, Class, Type) with 0 index.
      int getSize()  
    • Method Detail

      • getSize

        int getSize()
      • get

        <T> T get​(int index,
                  java.lang.Class<T> parameterType)
           throws DataConverterException
        Get value of the specified type.
        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

        <T> T get​(int index,
                  java.lang.Class<T> parameterType,
                  java.lang.reflect.Type genericParameterType)
           throws DataConverterException
        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());
          
        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