jTransfo lightning talk

5,584 views
5,946 views

Published on

Very short introduction to jTranso, an open source project which handles conversion between transfer and domain objects.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
5,584
On SlideShare
0
From Embeds
0
Number of Embeds
4,550
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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 conversionJTransfo jTransfo = new JTransfoImpl();SomeDomainClass domainObject = (SomeDomainClass)         jTransfo.convert(transferObject);OrSomeDomainClass domainObject = new            SomeDomainClass();jTransfo.convert(transferObject, domainObject);OrjTransfo.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.orghttps://github.com/joachimvda/jtransfo @joachimvda

×