public final class AdeptDataConversion
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.io.Serializable |
convert(java.io.Serializable value,
ProcessConstants.AdeptDataType targetDataType)
Converts the given value to the specified target data type and returns it.
|
public static java.io.Serializable convert(java.io.Serializable value,
ProcessConstants.AdeptDataType targetDataType)
throws ConversionException
| BOOLEAN | INTEGER (accepts all Numbers |
FLOAT (accepts all Numbers |
STRING | DATE | URI | USERDEFINED | ||
| BOOLEAN | -> | as is | false -> 0L true -> 1L |
false -> 0d true -> 1d |
false -> "false" true -> "true" |
- | - | - |
| INTEGER | -> | 0 -> false; true otherwise | as is (cast to Long if necessary) |
cast to Double |
signed decimal representation | taken as milliseconds since 1970-01-01, 00:00:00 GMT | - | - |
| FLOAT | -> | 0 -> false; true otherwise (accepts all Numbers) |
discards fractional digits while casting to Long(accepts all Numbers) |
as is (accepts all Numbers; will be cast to Double) |
computerized scientific notation | taken as milliseconds since 1970-01-01, 00:00:00 GMT; discards fractional digits | - | - |
| STRING | -> | "true" (ignoring case) -> true, false otherwise (Boolean.parseBoolean(String)) |
parsed as signed decimal representation (Long.parseLong(String)) |
parsed as computerized scientific notation (Double.parseDouble(String)) |
as is | parsed as ISO 8601 | parsed as URI (URI.create(String)) |
encoded as UTF-8 |
| DATE | -> | - | milliseconds since 1970-01-01, 00:00:00 GMT as Long |
milliseconds since 1970-01-01, 00:00:00 GMT as Double |
formatted as ISO 8601 | as is | - | - |
| URI | -> | - | - | - | as string | - | as is | - |
| USERDEFINED | -> | - | - | - | decoded as UTF-8 | - | - | as is |
value - the value to be converted; this should typically be a direct
equivalent to an ADEPT2 data typetargetDataType - the target data type to which the value should be
convertedConversionException - if the conversion is not possible