Successfully reported this slideshow.

jTransfo lightning talk

0

Share

Upcoming SlideShare
Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11
Loading in …3
×
1 of 7
1 of 7

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

jTransfo lightning talk

  1. 1. Convert transfer ↔ domain objects ● Easy to use ● No dependencies ● Annotation based ● Many transfer objects – one domain object ● Integration ● Spring Framework ● Joda-time
  2. 2. Easy conversion JTransfo jTransfo = new JTransfoImpl(); SomeDomainClass domainObject = (SomeDomainClass)          jTransfo.convert(transferObject); Or SomeDomainClass domainObject = new             SomeDomainClass(); jTransfo.convert(transferObject, domainObject); Or jTransfo.convertTo(transferObject,        SomeDomainClass.class);
  3. 3. Annotations on transfer object @Data @DomainClass("pkg.Person") public class PersonTo {     private String name;     @MappedBy(field = “country”, path = “addr”)     private String addrCountry;     @MappedBy(readOnly = true)     private String gender;     @NotMapped     private String globaalNummer; }
  4. 4. Type conversion, lists @MappedBy(typeConverter = "filterToList") private List<FilterTo> filters; @MappedBy(typeConverter = "readOnlyDomain") private LayerTo layer;
  5. 5. Type conversion, spring <import resource=  "classpath:org/jtransfo/spring/jTransfoContext.xml" /> <bean  class="org.jtransfo.ReadOnlyDomainTypeConverter" /> <bean  class="org.jtransfo.ReadOnlyDomainListTypeConverter" >     <constructor­arg value="filterToList" />     <constructor­arg value="pkg.FilterTo" />     <property name="sortList" value="true" /> </bean>
  6. 6. ORM link, Object finder ● Automatically build new / linked object ● Find in Hibernate maybe ● Always consistent ● Use ReadOnlyDomain to either update links only or linked object contents as well
  7. 7. www.jtransfo.org https://github.com/joachimvda/jtransfo @joachimvda

×