This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing 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
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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.
 
Those are the largest trousers in the world! Especially when next to this 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!