Reputation: 480
I have
public class A {
private String id;
private Object filter;
}
I build Object A with data
{
"id":1,
"filter" : {
"ids":[1,2,3],
"type": "1"
}
}
After
A b = mapper.map(a, A.class)
b.filter is empty. How to fix it?
Upvotes: 0
Views: 325
Reputation: 480
MapperFactory build = new
DefaultMapperFactory.Builder().build();
build.classMap(A.class, A.class)
.customize(
new CustomMapper<>() {
@Override
public void mapAtoB(A source, A destination, MappingContext context) {
b.setFilter(a.getFilter());
}
}
)
.byDefault()
.register();
Upvotes: 0