Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

jTransfo lightning talk

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

  • Login to see the comments

  • Be the first to like this

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.org @joachimvda