Appendix A. Common Type Conversions

The following table is a set of Java and Talend methods that allow conversion between different data types. This is by no means an exhaustive list, but will cover many of type conversions that you will encounter.

From Type

To Type

Example

String

Integer

Integer.parseInt(row1.myString)

String

Date

TalendDate.parseDate("dd-MM-yyyy",row1.myString)

String

BigDecimal

new BigDecimal(row1.myString) where myString can include decimal places. For example, 99.00

String

Float

Float.parseFloat(row1.myString)

String

Long

Long.parseLong(row1.myString)

Integer

String

variable+"" or variable.toString()

Date

String

TalendDate.formatDate("yy-MM-dd", row1.myDate)

BigDecimal

String

row1.myBigDecimal.toString() ...

Get Talend Open Studio Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.