• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to use Custom Converter by Id?

 
Greenhorn
Posts: 13
  • 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.
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic