java.lang.Object
com.pervasive.datarush.functions.Conversions
Provides implementations of common type conversion functions.
These functions are for conversions which would not normally be permitted by the token type
system as they are either possibly "lossy" (such as type narrowing) or ambiguous (such
as string formatting).
- See Also:
-
ScalarValuedFunctionDeriveFields
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScalarValuedFunctionasBoolean(ScalarValuedFunction expr, int truth, int falsity) Convert an int typed field into a boolean type.static ScalarValuedFunctionConvert an int typed field into a boolean type.static ScalarValuedFunctionConvert an int typed field into a boolean type.static ScalarValuedFunctionasDate(ScalarValuedFunction expr) Convert a timestamp expression result into a date field.static ScalarValuedFunctionConvert a timestamp typed field into a date field.static ScalarValuedFunctionasDouble(ScalarValuedFunction expr) Convert a numeric typed expression into a double type.static ScalarValuedFunctionConvert a numeric typed field into a double type.static ScalarValuedFunctionasFloat(ScalarValuedFunction expr) Convert a numeric typed expression into a float type.static ScalarValuedFunctionConvert a numeric typed field into a float type.static ScalarValuedFunctionasInt(ScalarValuedFunction expr) Convert a numeric typed expression into an integer type.static ScalarValuedFunctionConvert a numeric typed field into an integer type.static ScalarValuedFunctionasLong(ScalarValuedFunction expr) Convert a numeric typed expression into a long type.static ScalarValuedFunctionConvert a numeric typed field into a long type.static ScalarValuedFunctionasMoney(ScalarValuedFunction expr) Convert a numeric typed expression into a money type.static ScalarValuedFunctionConvert a numeric typed field into a money type.static ScalarValuedFunctionConvert a numeric typed expression into a numeric type.static ScalarValuedFunctionConvert a numeric typed field into a numeric type.static ScalarValuedFunctionasTime(ScalarValuedFunction expr) Convert a timestamp expression result into a time field.static ScalarValuedFunctionConvert a timestamp typed field into a time field.static ScalarValuedFunctiontoBinary(ScalarValuedFunction expr) Convert a string typed expression into a binary type.static ScalarValuedFunctionConvert a string typed field into a binary type.static ScalarValuedFunctiontoBoolean(ScalarValuedFunction expr, TruthValues mapping) Convert a string typed expression into a boolean type.static ScalarValuedFunctiontoBoolean(ScalarValuedFunction expr, String truth, String falsity) Convert a string typed expression into a boolean type.static ScalarValuedFunctiontoBoolean(String field, TruthValues mapping) Convert a string typed field into a boolean type.static ScalarValuedFunctionConvert a string typed field into a boolean type.static ScalarValuedFunctiontoChar(ScalarValuedFunction expr) Convert a string typed expression into a char type.static ScalarValuedFunctionConvert a string typed field into a char type.static ScalarValuedFunctiontoDate(ScalarValuedFunction expr) Convert a string typed expression into a date type.static ScalarValuedFunctiontoDate(ScalarValuedFunction expr, DateTimeFormatting format) Convert a string typed expression into a date type using the given format.static ScalarValuedFunctionConvert a string typed field into a date type.static ScalarValuedFunctiontoDate(String field, DateTimeFormatting format) Convert a string typed field into a date type using the given format.static ScalarValuedFunctionConvert a string typed field into a date type using the given format.static ScalarValuedFunctiontoDouble(ScalarValuedFunction expr) Convert a string typed expression into a double type.static ScalarValuedFunctiontoDouble(ScalarValuedFunction expr, NumberFormat format) Convert a string typed expression into a double type using the given format.static ScalarValuedFunctionConvert a string typed field into a double type.static ScalarValuedFunctionConvert a string typed field into a double type using the given format.static ScalarValuedFunctiontoDouble(String field, NumberFormat format) Convert a string typed field into a double type using the given format.static ScalarValuedFunctiontoFloat(ScalarValuedFunction expr) Convert a string typed expression into a float type.static ScalarValuedFunctiontoFloat(ScalarValuedFunction expr, NumberFormat format) Convert a string typed expression into a float type using the given format.static ScalarValuedFunctionConvert a string typed field into a float type.static ScalarValuedFunctionConvert a string typed field into a float type using the given format.static ScalarValuedFunctiontoFloat(String field, NumberFormat format) Convert a string typed field into a float type using the given format.static ScalarValuedFunctiontoInt(ScalarValuedFunction expr) Convert a string typed expression into a integer type.static ScalarValuedFunctiontoInt(ScalarValuedFunction expr, NumberFormat format) Convert a string typed expression into a integer type using the given format.static ScalarValuedFunctionConvert a string typed field into a integer type.static ScalarValuedFunctionConvert a string typed field into a integer type using the given format.static ScalarValuedFunctiontoInt(String field, NumberFormat format) Convert a string typed field into a integer type using the given format.static ScalarValuedFunctiontoLong(ScalarValuedFunction expr) Convert a string typed expression into a long type.static ScalarValuedFunctiontoLong(ScalarValuedFunction expr, NumberFormat format) Convert a string typed expression into a long type using the given format.static ScalarValuedFunctionConvert a string typed field into a long type.static ScalarValuedFunctionConvert a string typed field into a long type using the given format.static ScalarValuedFunctiontoLong(String field, NumberFormat format) Convert a string typed field into a long type using the given format.static ScalarValuedFunctiontoMoney(ScalarValuedFunction expr) Convert a string typed expression into a money type.static ScalarValuedFunctiontoMoney(ScalarValuedFunction expr, NumberFormat format) Convert a string typed expression into a money type using the given format.static ScalarValuedFunctionConvert a string typed field into a money type.static ScalarValuedFunctionConvert a string typed field into a money type using the given format.static ScalarValuedFunctiontoMoney(String field, NumberFormat format) Convert a string typed field into a money type using the given format.static ScalarValuedFunctionConvert a string typed expression into a numeric type.static ScalarValuedFunctiontoNumeric(ScalarValuedFunction expr, NumberFormat format) Convert a string typed expression into a numeric type using the given format.static ScalarValuedFunctionConvert a string typed field into a numeric type.static ScalarValuedFunctionConvert a string typed field into a numeric type using the given format.static ScalarValuedFunctiontoNumeric(String field, NumberFormat format) Convert a string typed field into a numeric type using the given format.static ScalarValuedFunctiontoString(ScalarValuedFunction expr) Convert the value of an expression into a string value.static ScalarValuedFunctionConvert a scalar type field into a string value.static ScalarValuedFunctiontoText(ScalarValuedFunction expr, String format) Convert the value of an expression into text using the given format.static ScalarValuedFunctiontoText(ScalarValuedFunction expr, Format formatter) Convert the value of an expression into text using the given format.static ScalarValuedFunctionConvert a scalar type field into text using the given format.static ScalarValuedFunctionConvert a scalar type field into text using the given format.static ScalarValuedFunctiontoTime(ScalarValuedFunction expr) Convert a string typed expression into a time type.static ScalarValuedFunctiontoTime(ScalarValuedFunction expr, DateTimeFormatting format) Convert a string typed expression into a time type using the given format.static ScalarValuedFunctionConvert a string typed field into a time type.static ScalarValuedFunctiontoTime(String field, DateTimeFormatting format) Convert a string typed field into a time type using the given format.static ScalarValuedFunctionConvert a string typed field into a time type using the given format.static ScalarValuedFunctionConvert a string typed expression into a timestamp type.static ScalarValuedFunctiontoTimestamp(ScalarValuedFunction expr, DateTimeFormatting format) Convert a string typed expression into a timestamp type using the given format.static ScalarValuedFunctiontoTimestamp(String field) Convert a string typed field into a timestamp type.static ScalarValuedFunctiontoTimestamp(String field, DateTimeFormatting format) Convert a string typed field into a timestamp type using the given format.static ScalarValuedFunctiontoTimestamp(String field, String format) Convert a string typed field into a timestamp type using the given format.
-
Method Details
-
asBoolean
Convert an int typed field into a boolean type. Unmapped values will be set to null.- Parameters:
field- a field whose type is an int- Returns:
- the function that provides the conversion
-
asBoolean
Convert an int typed field into a boolean type. Unmapped values will be set to null.- Parameters:
field- a field whose type is an inttruth- int representing the value of truefalsity- int representing the value of false- Returns:
- the function that provides the conversion
-
asBoolean
Convert an int typed field into a boolean type. Unmapped values will be set to null.- Parameters:
expr- a function expression whose return type is an inttruth- int representing the value of truefalsity- int representing the value of false- Returns:
- the function that provides the conversion
-
asFloat
Convert a numeric typed field into a float type. Note that precision may be lost during the conversion.- Parameters:
field- a field whose type is a number- Returns:
- the function that provides the conversion
-
asFloat
Convert a numeric typed expression into a float type. Note that precision may be lost during the conversion.- Parameters:
expr- a function expression whose return type is a number- Returns:
- the function that provides the conversion
-
asDouble
Convert a numeric typed field into a double type. Note that precision may be lost during the conversion.- Parameters:
field- a field whose type is a number- Returns:
- the function that provides the conversion
-
asDouble
Convert a numeric typed expression into a double type. Note that precision may be lost during the conversion.- Parameters:
expr- a function expression whose return type is a number- Returns:
- the function that provides the conversion
-
asInt
Convert a numeric typed field into an integer type. Note that precision may be lost during the conversion.- Parameters:
field- a field whose type is a number- Returns:
- the function that provides the conversion
-
asInt
Convert a numeric typed expression into an integer type. Note that precision may be lost during the conversion.- Parameters:
expr- a function expression whose return type is a number- Returns:
- the function that provides the conversion
-
asLong
Convert a numeric typed field into a long type. Note that precision may be lost during the conversion.- Parameters:
field- a field whose type is a number- Returns:
- the function that provides the conversion
-
asLong
Convert a numeric typed expression into a long type. Note that precision may be lost during the conversion.- Parameters:
expr- a function expression whose return type is a number- Returns:
- the function that provides the conversion
-
asMoney
Convert a numeric typed field into a money type. Note that precision may be lost during the conversion.- Parameters:
field- a field whose type is a number- Returns:
- the function that provides the conversion
-
asMoney
Convert a numeric typed expression into a money type. Note that precision may be lost during the conversion.- Parameters:
expr- a function expression whose return type is a number- Returns:
- the function that provides the conversion
-
asNumeric
Convert a numeric typed field into a numeric type. The numeric type is typically backed by aBigDecimalobject.- Parameters:
field- a field whose type is a number- Returns:
- the function that provides the conversion
-
asTime
Convert a timestamp typed field into a time field. This down casting essentially drops the date portion of the timestamp field leaving only the time portion. The timestamp is interpreted using the timezone offset associated with it.- Parameters:
field- a field whose type is timestamp- Returns:
- the function that provides the conversion
-
asTime
Convert a timestamp expression result into a time field. This down casting essentially drops the date portion of the timestamp field leaving only the time portion. The timestamp is interpreted using the timezone offset associated with it.- Parameters:
expr- a function expression whose return type is timestamp- Returns:
- the function that provides the conversion
-
asNumeric
Convert a numeric typed expression into a numeric type. The numeric type is typically backed by aBigDecimalobject.- Parameters:
expr- a function expression whose return type is a number- Returns:
- the function that provides the conversion
-
asDate
Convert a timestamp typed field into a date field. This down casting essentially drops the time portion of the timestamp field leaving only the date portion.- Parameters:
field- a field whose type is timestamp- Returns:
- the function that provides the conversion
-
asDate
Convert a timestamp expression result into a date field. This down casting essentially drops the time portion of the timestamp field leaving only the date portion.- Parameters:
expr- a function expression whose return type is timestamp- Returns:
- the function that provides the conversion
-
toBinary
Convert a string typed field into a binary type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toBinary
Convert a string typed expression into a binary type.- Parameters:
expr- an expression whose type is string- Returns:
- the function that provides the conversion
-
toChar
Convert a string typed field into a char type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toChar
Convert a string typed expression into a char type.- Parameters:
expr- an expression whose type is string- Returns:
- the function that provides the conversion
-
toDouble
Convert a string typed field into a double type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toDouble
Convert a string typed expression into a double type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toDouble
Convert a string typed field into a double type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert strings to doubles- Returns:
- the function that provides the conversion
-
toDouble
Convert a string typed field into a double type using the given format.- Parameters:
field- a field whose type is stringformat- formatter instance to use to convert strings to doubles- Returns:
- the function that provides the conversion
-
toDouble
Convert a string typed expression into a double type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- formatter instance to use to convert strings to doubles- Returns:
- the function that provides the conversion
-
toFloat
Convert a string typed field into a float type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toFloat
Convert a string typed expression into a float type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toFloat
Convert a string typed field into a float type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert string to floats- Returns:
- the function that provides the conversion
-
toFloat
Convert a string typed field into a float type using the given format.- Parameters:
field- a field whose type is stringformat- formatter instance to use to convert strings to floats- Returns:
- the function that provides the conversion
-
toFloat
Convert a string typed expression into a float type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- formatter instance to use to convert strings to floats- Returns:
- the function that provides the conversion
-
toInt
Convert a string typed field into a integer type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toInt
Convert a string typed expression into a integer type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toInt
Convert a string typed field into a integer type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert strings to integers- Returns:
- the function that provides the conversion
-
toInt
Convert a string typed field into a integer type using the given format.- Parameters:
field- a field whose type is stringformat- formatter instance to use to convert strings to integers- Returns:
- the function that provides the conversion
-
toInt
Convert a string typed expression into a integer type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- formatter instance to use to convert strings to integers- Returns:
- the function that provides the conversion
-
toLong
Convert a string typed field into a long type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toLong
Convert a string typed expression into a long type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toLong
Convert a string typed field into a long type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert strings to longs- Returns:
- the function that provides the conversion
-
toLong
Convert a string typed field into a long type using the given format.- Parameters:
field- a field whose type is stringformat- formatter instance to use to convert strings to longs- Returns:
- the function that provides the conversion
-
toLong
Convert a string typed expression into a long type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- formatter instance to use to convert strings to longs- Returns:
- the function that provides the conversion
-
toMoney
Convert a string typed field into a money type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toMoney
Convert a string typed expression into a money type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toMoney
Convert a string typed field into a money type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert strings to money- Returns:
- the function that provides the conversion
-
toMoney
Convert a string typed field into a money type using the given format.- Parameters:
field- a field whose type is stringformat- formatter instance to use to convert strings to money- Returns:
- the function that provides the conversion
-
toMoney
Convert a string typed expression into a money type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- formatter instance to use to convert strings to money- Returns:
- the function that provides the conversion
-
toNumeric
Convert a string typed field into a numeric type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toNumeric
Convert a string typed expression into a numeric type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toNumeric
Convert a string typed field into a numeric type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert strings to numerics- Returns:
- the function that provides the conversion
-
toNumeric
Convert a string typed field into a numeric type using the given format.- Parameters:
field- a field whose type is stringformat- formatter instance to use to convert strings to numeric- Returns:
- the function that provides the conversion
-
toNumeric
Convert a string typed expression into a numeric type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- formatter instance to use to convert strings to numeric- Returns:
- the function that provides the conversion
-
toBoolean
Convert a string typed field into a boolean type.- Parameters:
field- a field whose type is stringtruth- text representing the value of truefalsity- text representing the value of false- Returns:
- the function that provides the conversion
-
toBoolean
public static ScalarValuedFunction toBoolean(ScalarValuedFunction expr, String truth, String falsity) Convert a string typed expression into a boolean type.- Parameters:
expr- a function expression whose return type is stringtruth- text representing the value of truefalsity- text representing the value of false- Returns:
- the function that provides the conversion
-
toBoolean
Convert a string typed field into a boolean type.- Parameters:
field- a field whose type is stringmapping- a truthvalue mapping between boolean values and strings- Returns:
- the function that provides the conversion
-
toBoolean
Convert a string typed expression into a boolean type.- Parameters:
expr- a function expression whose return type is stringmapping- a truthvalue mapping between boolean values and strings- Returns:
- the function that provides the conversion
-
toDate
Convert a string typed field into a date type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toDate
Convert a string typed expression into a date type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toDate
Convert a string typed field into a date type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert string to date- Returns:
- the function that provides the conversion
-
toDate
Convert a string typed field into a date type using the given format.- Parameters:
field- a field whose type is stringformat- format instance to use to convert string to date- Returns:
- the function that provides the conversion
-
toDate
Convert a string typed expression into a date type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- format instance to use to convert string to date- Returns:
- the function that provides the conversion
-
toTime
Convert a string typed field into a time type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toTime
Convert a string typed expression into a time type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toTime
Convert a string typed field into a time type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert string to time- Returns:
- the function that provides the conversion
-
toTime
Convert a string typed field into a time type using the given format.- Parameters:
field- a field whose type is stringformat- format instance to use to convert string to time- Returns:
- the function that provides the conversion
-
toTime
Convert a string typed expression into a time type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- format instance to use to convert string to time- Returns:
- the function that provides the conversion
-
toTimestamp
Convert a string typed field into a timestamp type.- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toTimestamp
Convert a string typed expression into a timestamp type.- Parameters:
expr- a function expression whose return type is string- Returns:
- the function that provides the conversion
-
toTimestamp
Convert a string typed field into a timestamp type using the given format.- Parameters:
field- a field whose type is stringformat- format specification to use to convert string to timestamp- Returns:
- the function that provides the conversion
-
toTimestamp
Convert a string typed field into a timestamp type using the given format.- Parameters:
field- a field whose type is stringformat- format instance to use to convert string to timestamp- Returns:
- the function that provides the conversion
-
toTimestamp
public static ScalarValuedFunction toTimestamp(ScalarValuedFunction expr, DateTimeFormatting format) Convert a string typed expression into a timestamp type using the given format.- Parameters:
expr- a function expression whose return type is stringformat- format instance to use to convert string to timestamp- Returns:
- the function that provides the conversion
-
toString
Convert a scalar type field into a string value. The default formatting per data type will be used. To specify a format, usetoText(String, Format).- Parameters:
field- a field whose type is string- Returns:
- the function that provides the conversion
-
toString
Convert the value of an expression into a string value. The default formatting per data type will be used. To specify a format, usetoText(String, Format).- Parameters:
expr- the expression to convert- Returns:
- the function that provides the conversion
-
toText
Convert a scalar type field into text using the given format. The format object instance must be able to format the token type of the field being converted.- Parameters:
field- a field whose type is stringformatter- format instance to use to convert values to strings- Returns:
- the function that provides the conversion
-
toText
Convert the value of an expression into text using the given format. The format object instance must be able to format the token type of the field being converted.- Parameters:
expr- the expression to convertformatter- format instance to use to convert values to strings- Returns:
- the function that provides the conversion
-
toText
Convert a scalar type field into text using the given format. The format specification must be acceptable to a formatter for the token type of the field being converted.- Parameters:
field- a field whose type is stringformat- format specification to use to convert values to strings- Returns:
- the function that provides the conversion
-
toText
Convert the value of an expression into text using the given format. The format specification must be acceptable to a formatter for the token type of the field being converted.- Parameters:
expr- the expression to convertformat- format specification to use to convert values to strings- Returns:
- the function that provides the conversion
-