简体   繁体   中英

Convert a String payload to a POJO in Mule using Java Component

I have the following flow:

    <flow name="load-flow" doc:name="load-flow">
    <file:inbound-endpoint path="/Users/andre/Desktop/Feeder" responseTimeout="10000" doc:name="File"/>
    <file:file-to-string-transformer doc:name="File to String"/>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    <component class="transformer" doc:name="Java"/>
</flow>

and a POJO Person

private String name; private String surname; private String email;

I input a cv file then take it to string. i then want to read the payload into a java component and then map the values of the csv file to a POJO Person. how can this be done? how do you read the string payload into a java component and how would i map it to the POJO Person

Use the datamapper transformer. It can map to and from many data formats.

http://www.mulesoft.org/documentation/display/current/Datamapper+User+Guide+and+Reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM