Mapping deep properties with intermediate collections in dozer

前端 未结 3 1769
一个人的身影
一个人的身影 2021-02-09 16:29

Suppose I have the following classes

public class Baz {
  private List foos = new ArrayList();
}

public class Foo {
  private String strin         


        
3条回答
  •  耶瑟儿~
    2021-02-09 17:26

    I think you can do it without custom converter.

    Override the toString() method of Foo class like below:

    @Override
    public String toString(){
    return this.getString(); //assuming string property has a getter method. if not,write this.string
    

    And now the follwing mapping:

    
    fully qualified name of Baz(with package name)
    same for Target
    
       foos
       fooStrings
       foo
       java.lang.String
    
    
    

提交回复
热议问题