在我的应用程序中,我有推土机映射,如下所示:
<mapping>
<class-a>java.util.HashMap</class-a>
<class-b>org.mycompany.TargetClass</class-b>
<field custom-converter="org.example.MyConverter">
<a>this</a>
<b>anotherField</b>
</field>
</mapping>
MyConverter
是一个实例ConfigurableCustomConverter
:
public class MyConverter implements ConfigurableCustomConverter {
private String parameter;
@Override
public Object convert(
Object existingDestinationFieldValue,
Object sourceFieldValue,
Class<?> destinationClass,
Class<?> sourceClass) {
// sourceClass is always java.lang.Object and
// sourceFieldValue is always null!!!
}
@Override
public void setParameter(String parameter) {
this.parameter = parameter;
}
}
为什么会发生源内评论中提到的事情?