O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

jTransfo lightning talk

6.244 visualizações

Publicada em

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

Publicada em: Tecnologia
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

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

×