我正在尝试通过dozer深度映射两个类型为set的属性。我的示例代码如下,
class SomeObject {
String name;
}
class AnotherObject {
String myName;
}
class A {
private String identity;
private Set < SomeObject > someSet = new HashSet < SomeObject >;
}
class B {
private String id;
private Set < AnotherObject > someAnotherSet = new HashSet < AnotherObject >;
}
下面是我尝试通过dozer API进行深度映射的代码
BeanMappingBuilder builder = new BeanMappingBuilder () {
mapping(A.class, B.class)
.fields("identity", "id")
.fields("someSet.name", "someAnotherSet.myName");
}
在运行上面的示例时,我发现以下错误
java.lang.IllegalArgumentException: object is not an instance of declaring class
任何帮助将不胜感激。感谢