mule - Data Weave Pojo to Pojo Mappings -


i trying pojo pojo transformation below( each pojo has list of objects) - output transformed skipping object - sample code below.

public class pojo1 implements serializable {   private list<foo> foolist =new arraylist<foo>(1);   public pojo1() {  }   public list<foo> getfoolist() {      return foolist ;  }   public void setfoolist(list<foo> foolist) {      this.foolist= foolist;  } 

}

public class pojo2 implements serializable {

    private list<bar> barlist =new arraylist<bar>(1);      public pojo2() {     }      public list<bar> getbarlist() {         return barlist ;     }      public void setbarlist(list<bar> barlist) {         this.barlist= barlist;     }  } 

dataweave transformation follows - works fine 1 object in list gets transformed , i'm missing second one.

   barlist: [{    (         payload.foolist map {            item1:$.item1                        }    )    } :object {         class :"com.fooclass"    }]    } :object {        class : "com.barclass"    } 

thanks in advance !

try with

{   barlist: in1.foolist map {     item1: $.item1   } :object {class : "com.fooclass"} } :object {class : "com.barclass"} 

note: as :object {class : "com.fooclass"} should optional, can inferred


the problem seems defined array one object , filled object result of:

payload.foolist map {   item1:$.item1                 } 

which array of objects:

[   {     item1: "value1"   },   {     item1: "value2"   } ] 

after filling object that, ends like:

{   item1: "value1",   item1: "value2",   item1: ... } 

so, filling array object lot of duplicated fields (with different values) , when output written (since it's java) each 1 of fields 1 value.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -