I am using Anypoint Studio 6.1 with Mule 3.8.1 and I have a csv file that I have converted to java using Dataweave. Later in the workflow I have to perform a new mapping to the output JSON object using Dataweave.
I have a number of fields to map so wanted to find out if there is there a way of showing the fields in the Java input in the left side input panel so I can use the graphical GUI to map?
The code I am using to convert the csv to java in Dataweave is:
%dw 1.0
%input payload application/csv
%output application/java
---
payload
Thanks
You have to define metadata in configuration of transform component.
Follow the sequence
Click on define metdata
Add type id (any name)
Select type.
Select java object type.
Type qualified name of class.
To add to Beacon's response..after you follow those instructions you can right click on the payload -> Edit Sample Data and then add your sample/mock up java object info following
The input java class (follows TheBeacon's instructions):
package org.example;
public class Name {
String first;
String last;
public Name() {};
public void setFirst(String first){
this.first = first;
}
public void getFirst(){
return first;
}
public setLast(String last){
this.last = last;
}
public getLast() {
return last;
}
}
Then your DW input side example would look like:
%dw 1.0
%output application/java
---
{
first: 'Jane',
last: 'Doe'
} as :object {
class : "org.example.Name"
}
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.