Skip to main content Skip to complementary content

Exporting a structure as an XStream Java class

Availability-noteBeta
Export a structure as a Java class source with XStream annotations.

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.
Information noteNote: This feature has the following limitations:
  • XStream does not handle XML namespaces, they are therefore ignored on output.
  • Enumerations do not produce Java Enums.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!