9
Lighting Talks October 2013 Vyacheslav Yakovenko

EPAM :: LightingTalks :: Oct 2013

Embed Size (px)

Citation preview

Page 1: EPAM :: LightingTalks :: Oct 2013

Lighting TalksOctober 2013

Vyacheslav Yakovenko

Page 2: EPAM :: LightingTalks :: Oct 2013

How to produce clean and neat POJO from XSD?

• JAXB ?!

Page 3: EPAM :: LightingTalks :: Oct 2013

How to produce clean and neat POJO from XSD?

Page 4: EPAM :: LightingTalks :: Oct 2013

How to produce clean and neat POJO from XSD?

• xjc –b jaxb-bindings.xml Hotel.xsd

Page 5: EPAM :: LightingTalks :: Oct 2013

How to produce clean and neat POJO from XSD?

• JiBX: Binding XML to Java Code ( http://jibx.sourceforge.net/ )

• java -cp .:/home/epam/bin/jibx/lib/jibx-tools.jar org.jibx.schema.codegen.CodeGen-p com.epam.lightingtalks.dto Hotel.xsd

Page 6: EPAM :: LightingTalks :: Oct 2013

How to effectively map Value/Entity object to DTO?

• Hardcode ()• (pros) Simple

• (cons) Prone to error and time consuming strategy

• Dozer ( http://dozer.sourceforge.net/ )• (pros) Simple

• (cons) Xml config, slow

• ModelMapper ( http://modelmapper.org/ )• (pros) Fast, Open for Extension, There is some strategies out of box

• (cons) Extensions can take a time

Page 7: EPAM :: LightingTalks :: Oct 2013

How to effectively map Value/Entity object to DTO?

• ModelMapper• ModelMapper modelMapper = new ModelMapper();

• OrderDTO dto = modelMapper.map(order, OrderDTO.class);

Page 8: EPAM :: LightingTalks :: Oct 2013

How to effectively map Value/Entity object to DTO?

Page 9: EPAM :: LightingTalks :: Oct 2013

How to effectively map Value/Entity object to DTO?