W jaki sposób programowo ustawić niestandardowy konwerter dla spycharki? Poniższy kod nie działa:Dozer 5.3.2. Programowo ustawione niestandardowe konwertery?
realizacjęklienta Przelicznik: kod
class ConverterImpl extends DozerConverter<A, B> {
ConverterImpl() {
super(A.class, B.class);
}
@Override
public B convertTo(A source, B destination) {
return destination;
}
@Override
public A convertFrom(B source, A destination) {
return destination;
}
}
testu:
DozerBeanMapper mapper = new DozerBeanMapper();
mapper.setCustomConverters(Collections.<CustomConverter>singletonList(new ConverterImpl()));
A a = new A();
B b = mapper.map(a, A.class);
Po uruchomieniu powyższy kod, niestandardowe konwerter nie zostanie wywołana. Co jest nie tak?
nie są konwertery dla pola ** ** od 'A' lub' B', a nie całej klasy? – beerbajay