Wednesday, February 23, 2011

Mapping with Dozer

http://dozer.sourceforge.net/

I can't praise enough this little gem.

Just do:
MapperIF mapper = DozerBeanMapperSingletonWrapper.getInstance();


put dozerBeanMapping.xml in your classpath and in it you map:




 
  true
  MM/dd/yyyy HH:mm
  true
 

 
  acme.Product
  
  acme.model.Product
  
   dimensions.height
   dimHeight
  
 






If you receive an error:

net.sf.dozer.util.mapping.MappingException: org.xml.sax.SAXException: Parsing Error

Message: Document root element "mappings", must match DOCTYPE root "null".


then you are screwed and probably give up using Dozer. I Hate Xml.

No comments: