Annotations

10 views
Skip to first unread message

Bradlee Johnson

unread,
May 23, 2019, 5:05:13 PM5/23/19
to Dozer Mapper
I've used the Annotations in a limited way but the documentation states they are still experimental.

I'd like to suggest that the annotations not be used at runtime but, instead, that a Maven plugin process the annotations at compile time and create a standard Dozer XML mapping file that it tucks away in the jar file along with a bootstrap mechanism. That is useful from a number angles. The mapping mechanisms are exactly the same between annotations and XML even if the annotations might be more limited. One simply isn't looking for annotations in the code at runtime. Everything goes through XML files.

If you look at something like OSGi declarative services and the SCR (component runtime) they use that mechanism from bootstrapping components, exporting service interfaces, settting properties, etc. The annotations and the dependencies they specify are not used at runtime. If you have a jar file that uses the SCR/DS annotations, it is all stripped out at compile time and a relevant XML file that the OSGi containers understand is created. If you use that jar file in Spring Boot or J2EE or in a plain Java application, it is just some XML files that it ignores and doesn't require any extra dependencies. That is obviously important in that case  and that doesn't apply so much to a library like Dozer. But what does apply is the secondary aspect - whether your write your SCR XML by hand or you use the annotations and have the Maven plugin generate the XML files, there isn't a secondary mechanism for dealing with the functionality.


Reply all
Reply to author
Forward
0 new messages