Exporting a structure as an XStream Java class - 7.3

Talend Data Mapper User Guide

Version
7.3
Language
English
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2023-01-05

Export a structure as a Java class source with XStream annotations.

Note: This feature is available only if you have installed the R2020-10 Studio monthly update or a later one delivered by Talend. For more information, check with your administrator.

About this task

You can use this option to export a structure with an XML representation and marshal the XML to a Plain Old Java Object (POJO). Talend Data Mapper does not perform the actual marshaling, it just provides the source of a Java class with XStream annotations.

Procedure

  1. Open the structure that you want to export.
  2. Click File > Export to open the Export window.
  3. Expand Data Mapper and select XStream Export, then click Next.
  4. Select the structure to export.
  5. Click Browse next to the To directory field and select the target folder for your structure.
  6. Optional: Enter a Java package name.
    This option creates a corresponding sub-folder in the selected export folder.
  7. Select how to handle DateTime types:
    • Select java.time.OffsetDateTime if you want DateTime values with a time zone, 2017-07-03T22:02:56.525+05:30 for example.
    • Select java.time.LocalDateTime if you want DateTime values without a time zone, 2017-07-03T22:02:56.525 for example.
  8. Click Finish.

Results

The structure is exported to the selected directory. You can now compile and package that class and marshal the XML to a POJO in a Job or Route using a tJava or cProcessor component.
Note: This feature has the following limitations:
  • XStream does not handle XML namespaces, they are therefore ignored on output.
  • Enumerations do not produce Java Enums.