カスタム コンバーターのドキュメントで、フィールド マッピングのカスタム コンバーターにカスタム パラメーターを渡すことができることを読みました。これは、マッパーをビルドするときに 1 回指定されるため、私には十分ではありません。
実際のマッピングを行うときにこのパラメーターを渡す方法はありますか?
mapper.map(sourceObject, Destination.class, "parameter");
私の実際の問題は、多言語プロパティを含む1つのクラスからマップしたいということであり、目的地には「選択された」言語プロパティのみが必要です。
ソースクラス
public class Source
{
// Fields in default language
private String prop1;
private String prop2;
// List containing all translations of properties
private List<SourceName> sourceNames;
}
public class SourceName
{
private int lang_id;
private String prop1;
private String prop2;
}
宛先クラス
public class Destination
{
// Fields translated in choosen language
private String prop1;
private String prop2;
}
私の目標は、次のようにすることです。
Destination destination = mapper.map(source, Destination.class, 4); // To lang_id 4
ありがとう