Interface Values

All Known Implementing Classes:
EncodedValues

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

    Modifier and Type
    Method
    Description
    <T> T
    get(int index, Class<T> parameterType)
    Get value of the specified type.
    <T> T
    get(int index, Class<T> parameterType, Type genericParameterType)
    Get value of the specified generic type.
    default <T> T
    get(Class<T> parameterType)
    The same as get(int, Class) with 0 index.
    default <T> T
    get(Class<T> parameterType, Type genericParameterType)
    The same as get(int, Class, Type) with 0 index.
    int
     
  • Method Details

    • getSize

      int getSize()
    • get

      default <T> T get(Class<T> parameterType) throws DataConverterException
      The same as get(int, Class) with 0 index.
      Throws:
      DataConverterException
    • get

      <T> T get(int index, 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

      default <T> T get(Class<T> parameterType, Type genericParameterType) throws DataConverterException
      The same as get(int, Class, Type) with 0 index.
      Throws:
      DataConverterException
    • get

      <T> T get(int index, Class<T> parameterType, 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