This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

How to use Custom Converter by Id?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a Sprint boot Application ,where i make a Request and then i get a Response. Before i make the request,i need to transform my data.But,the Destination class to transform could be different for the same Source class to transform. Example :

   public Request getTransformedRequest(Request, String typeTransformation) {
       Request transformedRequest= mapper.map(request,Request.class);
       return transformedRequest;
}
If i am not using Converters,and i am using just normal Dozer mapping,i can have the following in my mapping.xml;

And then in my code,for the same Source class ,i can switch using the mapping Id;

 ClassB mapper.map(request,Request.class,"Type1"); //Here ClassB extends Request
 ClassC mapper.map(request,Request.class,"Type2"); //Here ClassC extends Request
My problem,it s i cant do the same with converters.I want to have different converters for the same source class:

So ,in my scenario,i would like to select (like in the mapping id example) ,the converter i wish. I really appreciate same help.Thanks in advance.
 
Danger, 10,000 volts, very electic .... tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!