jTransfo 2.0 and 2.1 released

jTransfo 2.0 was released at the beginning of the year (but not yet announced), and fixed a long existing bug with 2.1.

There have been many changes:

  • jTransfo 2 requires java8. This allows some improvements in the code base and using repeated annotations.
  • @MapOnly is now repeatable, it is no longer needed to put multiple @MapOnly annotations inside a @MapOnlies annotation. So, instead of
            @MapOnly(value = "some_tag"),
            @MapOnly(value = "*", readOnly = true)

    you can now use

    @MapOnly(value = "some_tag")
    @MapOnly(value = "*", readOnly = true)
  • We made changes to prepare for the upcoming java9 release. Specifically there is now a jTransfoFactory class which can be used to create jTransfo instances. You should never need access to the “internal” package.
  • From now one jTransfo has one dependency. We introduced slf4j to allow proper logging support.
  • Add a Set type converter.
  • List, Set and ReadOnly (automatic) type converters are now available by default. The default included is sorted.
  • The type converters which are installed by default can be overriden.
  • The empty object for list and set converters can now be defined by the user. The defaults are ArrayList and HashSet respectively.
  • jTransfo now uses jUnit5.
  • Convert tags should also be passed to the ObjectFinder and findTarget.
  • List and Set type converters now work properly for a list or set of primitives (copying the contents instead of the collection)
  • The JTransfoImpl class has been hidden. You should now use JTransfoFactory to create instances. Some of the internal methods which were needed for configuration are now public using the ConfigurableJTransfo interface. This has also been extended to make confuguration easier and more fluent.
  • jTransfo now supports meta annotations and includes @ReadOnly and @ReadOnlyDomain meta annotations to allow you to write clearer code. So instead of

    you can now write


    Similary, instead of

    @MappedBy(typeConverter = "readOnlyDomain")

    you can now write


    You can also define your own meta annotations. As an example, the ReadOnlyDomain meta annotation looks like this

    @MappedBy(typeConverter = "readOnlyDomain")
    @Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
    public @interface ReadOnlyDomain {

The 2.1 release adds a bugfix where a null for a list or set object was converted either to null or a new list. When keepNullList is false it should still consider alwaysNewList and reuse the existing list in the target when that is false. This is particularly important in Hibernate for a collection which is marked to remove orphans.

Posted in Release