mapstruct/mapstruct — pull request #106 by sjaakd (2014-01-22 21:58:52+00:00)
Title: Issue81

Hi,

This is a prel version. I need to add UT. When creating this, I stumbled upon various issues:

1) Did I cover all cases? (I have a nagging feeling there are more ' new' cases that need to be potentially be replaced by a factory).

2) The MappingCreationProcessor is getting larger and larger.. This is for a major part that it creates all the model elements underneath the root element (Mapper) as well. It feels a bit strange to have these model elements available (and created) outside the scope of the Mapper itself (perhaps that's the pattern I'm not familiar with). But wouldn't it bit better to make each model element responsible for creating its children? Factories could be made to achieve re-use. Also, I think it would be logical to have a reverse relation from child to parent. Also, some kind of class diagram would come in handy for newbees. Anyway.. impact is not small for this change.

3) I base my work upon MappingMethodReference. It has an MappingMethodReference.ftl (Freemarker) file, but I cannot see where it is used in other free marker files. So now we have (possibly) a superfluous FactoryMethodReference.

4) I have many JAXB ObjectFactories (all with the same 'simple name' but declared in a different package. That is not going to work as used class (in the mapper annotation). The variable name is not unique anymore. I need to open up a new issue for that one. I can provide a simple test case to show my point. Perhaps we needs some kind of global map in the processor context.

5) I'm struggling a bit with the way the processor chain works. The first processor seems to pass on a List but the next ones all pass on a Mapper (the model root element). However, that does not contain all info that was in the original list. You cannot interchange processors freely.

Anyway.. Feedback is more than welcome ;-)