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 Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleantoBoolean(T data)Converts parsed data returned byInputParser.ParseResultto Boolean.bytetoByte(T data)Converts parsed data returned byInputParser.ParseResultto byte.byte[]toByteArray(T data)Converts parsed data returned byInputParser.ParseResultto a byte array.default java.util.DatetoDate(T data, java.lang.String format)Converts parsed data returned byInputParser.ParseResultto a date representation.doubletoDouble(T data)Converts parsed data returned byInputParser.ParseResultto double.double[]toDoubleArray(T data)Converts parsed data returned byInputParser.ParseResultto a double array.default <E extends java.lang.Enum<E> & de.iip_ecosphere.platform.transport.serialization.IipEnum>
EtoEnum(T data, java.lang.Class<E> enumType)Converts parsed data returned byInputParser.ParseResultto an instance ofenumType.floattoFloat(T data)Converts parsed data returned byInputParser.ParseResultto float.inttoInteger(T data)Converts parsed data returned byInputParser.ParseResultto integer.int[]toIntegerArray(T data)Converts parsed data returned byInputParser.ParseResultto an integer array.default java.time.LocalDateTimetoLocalDateTime(T data, java.lang.String format)Converts parsed data returned byInputParser.ParseResultto a date representation.longtoLong(T data)Converts parsed data returned byInputParser.ParseResultto long.java.lang.ObjecttoObject(T data)Converts parsed data returned byInputParser.ParseResultto an object.shorttoShort(T data)Converts parsed data returned byInputParser.ParseResultto short.java.lang.StringtoString(T data)Converts parsed data returned byInputParser.ParseResultto String.java.lang.String[]toStringArray(T data)Converts parsed data returned byInputParser.ParseResultto a String array.
-
-
-
Method Detail
-
toByte
byte toByte(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto byte.- Parameters:
data- the obtained data- Returns:
- the converted integer
- Throws:
java.io.IOException- if conversion fails
-
toInteger
int toInteger(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto integer.- Parameters:
data- the obtained data- Returns:
- the converted integer
- Throws:
java.io.IOException- if conversion fails
-
toLong
long toLong(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto long.- Parameters:
data- the obtained data- Returns:
- the converted long
- Throws:
java.io.IOException- if conversion fails
-
toShort
short toShort(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto short.- Parameters:
data- the obtained data- Returns:
- the converted long
- Throws:
java.io.IOException- if conversion fails
-
toString
java.lang.String toString(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto String.- Parameters:
data- the obtained data- Returns:
- the converted String
- Throws:
java.io.IOException- if conversion fails
-
toDouble
double toDouble(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto double.- Parameters:
data- the obtained data- Returns:
- the converted double
- Throws:
java.io.IOException- if conversion fails
-
toFloat
float toFloat(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto float.- Parameters:
data- the obtained data- Returns:
- the converted float
- Throws:
java.io.IOException- if conversion fails
-
toBoolean
boolean toBoolean(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto Boolean.- Parameters:
data- the obtained data- Returns:
- the converted Boolean
- Throws:
java.io.IOException- if conversion fails
-
toIntegerArray
int[] toIntegerArray(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto an integer array.- Parameters:
data- the obtained data- Returns:
- the converted integer array
- Throws:
java.io.IOException- if conversion fails
-
toStringArray
java.lang.String[] toStringArray(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto a String array.- Parameters:
data- the obtained data- Returns:
- the converted integer array
- Throws:
java.io.IOException- if conversion fails
-
toDoubleArray
double[] toDoubleArray(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto a double array.- Parameters:
data- the obtained data- Returns:
- the converted double array
- Throws:
java.io.IOException- if conversion fails
-
toByteArray
byte[] toByteArray(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto a byte array.- Parameters:
data- the obtained data- Returns:
- the converted double array
- Throws:
java.io.IOException- if conversion fails
-
toDate
default java.util.Date toDate(T data, java.lang.String format) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto a date representation.- Parameters:
data- the obtained dataformat- the target date format (seeFormatCache)- Returns:
- the converted date
- Throws:
java.io.IOException- if conversion fails
-
toLocalDateTime
default java.time.LocalDateTime toLocalDateTime(T data, java.lang.String format) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto a date representation.- Parameters:
data- the obtained dataformat- the target date format (seeFormatCache)- Returns:
- the converted date
- Throws:
java.io.IOException- if conversion fails
-
toEnum
default <E extends java.lang.Enum<E> & de.iip_ecosphere.platform.transport.serialization.IipEnum> E toEnum(T data, java.lang.Class<E> enumType) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto an instance ofenumType. Primarily, a conversion totoInteger(Object)andIipEnum.getModelOrdinal()is performed. If this fails, a name-based enum conversion is applied.- Type Parameters:
E- the enum type- Parameters:
data- the obtained dataenumType- enumeration target type- Returns:
- the converted enum instance
- Throws:
java.io.IOException- if the conversion fails
-
toObject
java.lang.Object toObject(T data) throws java.io.IOException
Converts parsed data returned byInputParser.ParseResultto an object. [fallback dummy]- Parameters:
data- the obtained data- Returns:
- the converted double array
- Throws:
java.io.IOException- if conversion fails
-
-