Frage

I have source class hierarchy as below

Class A {
    List<B> bs;
}

Class B {
    List<C> cs;
}

Class C {
   String n;
}

The new destination class hierarchy is as below

Class A1 {
    List<C1> cs;
}


Class C1 {
    String n;
}

As you can see the destination class hierarchy is skipping bs. How to configure this copying of a property in the object to the destination but skipping the object itself in the source

War es hilfreich?

Lösung

One crude solution is to pre-process the source and copy the List<C> cs to a transient variable in Class A. The source will look like this after the pre-process

Class A {
    List<B> bs;

    transient List<C> cs;
}

Class B {
   List<C> cs;
}

Class C {
   String n; 
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top