Interface InputParser.InputConverter<T>

Type Parameters:
T - the type of data produced by parsing
All Known Implementing Classes:
ConverterFromString, JsonInputParser.JsonInputConverter, ModelInputConverter, TextLineParser.TextLineParserConverter
Enclosing interface:
InputParser<T>

public static interface InputParser.InputConverter<T>
Converts parsed data to primitive types. Implementations must be stateless.
Author:
Holger Eichelberger, SSE
  • Method Details

    • toByte

      byte toByte(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to byte.
      Parameters:
      data - the obtained data
      Returns:
      the converted integer
      Throws:
      IOException - if conversion fails
    • toInteger

      int toInteger(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to integer.
      Parameters:
      data - the obtained data
      Returns:
      the converted integer
      Throws:
      IOException - if conversion fails
    • toLong

      long toLong(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to long.
      Parameters:
      data - the obtained data
      Returns:
      the converted long
      Throws:
      IOException - if conversion fails
    • toShort

      short toShort(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to short.
      Parameters:
      data - the obtained data
      Returns:
      the converted long
      Throws:
      IOException - if conversion fails
    • toString

      String toString(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to String.
      Parameters:
      data - the obtained data
      Returns:
      the converted String
      Throws:
      IOException - if conversion fails
    • toDouble

      double toDouble(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to double.
      Parameters:
      data - the obtained data
      Returns:
      the converted double
      Throws:
      IOException - if conversion fails
    • toFloat

      float toFloat(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to float.
      Parameters:
      data - the obtained data
      Returns:
      the converted float
      Throws:
      IOException - if conversion fails
    • toBigInteger

      BigInteger toBigInteger(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a BigInteger.
      Parameters:
      data - the obtained data
      Returns:
      the converted BigInteger
      Throws:
      IOException - if conversion fails
    • toBigDecimal

      BigDecimal toBigDecimal(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a BigDecimal.
      Parameters:
      data - the obtained data
      Returns:
      the converted BigDecimal
      Throws:
      IOException - if conversion fails
    • toBoolean

      boolean toBoolean(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to Boolean.
      Parameters:
      data - the obtained data
      Returns:
      the converted Boolean
      Throws:
      IOException - if conversion fails
    • toIntegerArray

      int[] toIntegerArray(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to an integer array.
      Parameters:
      data - the obtained data
      Returns:
      the converted integer array
      Throws:
      IOException - if conversion fails
    • toStringArray

      String[] toStringArray(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a String array.
      Parameters:
      data - the obtained data
      Returns:
      the converted integer array
      Throws:
      IOException - if conversion fails
    • toDoubleArray

      double[] toDoubleArray(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a double array.
      Parameters:
      data - the obtained data
      Returns:
      the converted double array
      Throws:
      IOException - if conversion fails
    • toByteArray

      byte[] toByteArray(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a byte array.
      Parameters:
      data - the obtained data
      Returns:
      the converted double array
      Throws:
      IOException - if conversion fails
    • toDate

      default Date toDate(T data, String format) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a date representation.
      Parameters:
      data - the obtained data
      format - the target date format (see TimeUtils)
      Returns:
      the converted date
      Throws:
      IOException - if conversion fails
    • toLocalDateTime

      default LocalDateTime toLocalDateTime(T data, String format) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a date representation.
      Parameters:
      data - the obtained data
      format - the target date format (see TimeUtils)
      Returns:
      the converted date
      Throws:
      IOException - if conversion fails
    • toEnum

      default <E extends Enum<E> & de.iip_ecosphere.platform.transport.serialization.IipEnum> E toEnum(T data, Class<E> enumType) throws IOException
      Converts parsed data returned by InputParser.ParseResult to an instance of enumType. Primarily, a conversion to toInteger(Object) and IipEnum.getModelOrdinal() is performed. If this fails, a name-based enum conversion is applied.
      Type Parameters:
      E - the enum type
      Parameters:
      data - the obtained data
      enumType - enumeration target type
      Returns:
      the converted enum instance
      Throws:
      IOException - if the conversion fails
    • toList

      <E> List<E> toList(T data, Class<E> eltCls) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a list instance.
      Type Parameters:
      E - the element type
      Parameters:
      data - the obtained data
      eltCls - the element type class
      Returns:
      the converted list instance
      Throws:
      IOException - if the conversion fails
    • toElementList

      <E> List<de.iip_ecosphere.platform.transport.serialization.QualifiedElement<E>> toElementList(T data, Class<E> eltCls) throws IOException
      Converts parsed data returned by InputParser.ParseResult to a list instance.
      Type Parameters:
      E - the element type
      Parameters:
      data - the obtained data
      eltCls - the element type class
      Returns:
      the converted list instance
      Throws:
      IOException - if the conversion fails
    • toObject

      Object toObject(T data) throws IOException
      Converts parsed data returned by InputParser.ParseResult to an object. [fallback dummy]
      Parameters:
      data - the obtained data
      Returns:
      the converted double array
      Throws:
      IOException - if conversion fails