Conversation
|
@chris922 First of all, nice idea. But I also need to think about it a bit more..
Anyway.. If we are going to swap out the |
|
Hi @sjaakd,
To what Thanks for your feedback! Best regards |
I really appreciate that. Its good to have more folks on board. 😄.
My wrong... Doing too much at the same time.. I meant |
I think we could already implement that |
|
This is indeed an interesting PR. Replacing the Using a custom annotation would be easier to add injection specific parameters, like the @chris922 I had a quick glance over it and there are some places that I think we can improve one:
In any case our plan is to release 1.3.0.Beta1 as soon as possible. If you don't mind I would put this for the release after that 1.3.0.Beta2. |
|
Hi @filiphr ,
I try to summarize the current status:
If those things fit your expectation I would already start with them. Please let me know. I will wait for feedback if the EDIT: Ahh and what I missed: What about |
|
Hmm. its a pity java does not allow you to extend annotations. It would make perfect sense to let |
…mponent models Added two new annotations that allows to configure the component models, e. g. the bean name * MapperSpringConfig * MapperJsr330Config
* Renamed MapperJsr330Config to Jsr330Mapper, attribute value to name * Renamed MapperSpringConfig to SpringMapper, attribute value to name * Added deprecated warning to Mapper#componentModel * Added CdiMapper annotation
…g componentModel attribute in @Mapper Additionally added cdi-api dependency to unit tests (was it the first unit-testcase for cdi component model?)
283c3a7 to
6f04625
Compare
chris922
left a comment
There was a problem hiding this comment.
I just pushed the changes to add the things I mentioned in my last comment. As I am unsure about a few things I did I added review comments inline.
I am looking forward for your feedback!
| @Documented | ||
| @Target(ElementType.ANNOTATION_TYPE) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| public @interface ComponentModelMapper { |
There was a problem hiding this comment.
I had to add this meta-annotation that allows to recognize the @SpringMapper/.. annotations, otherwise it is not possible to detect that no such annotation exist and the default component model should be used - or if multiple component model annotations exists (-> ERROR).
| </dependency> | ||
| <dependency> | ||
| <groupId>javax.enterprise</groupId> | ||
| <artifactId>cdi-api</artifactId> |
There was a problem hiding this comment.
Seems that I added the first CDI unit tests ... hopefully in a correct way
| // this prevents creating many instances of this configuration for the same Element | ||
| // it will be assumed that this method will never be called with different messagers for the same Element | ||
| // one reason to cache instances is that the the MapperConfiguration validates the Element and multiple | ||
| // instantiations would lead to multiple identical warnings/errors |
There was a problem hiding this comment.
Is this okay? Maybe a WeakHashMap is too much as a processor is only a short-running process. Maybe you've got better ideas
| mapperPrism.componentModel() | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
I added the validation of the mapper here, there is also a TODO a few lines earlier that some more validations are required here. Removing the printMessage calls here would allow to remove the configurations cache.
| private MapperConfiguration(MapperPrism mapperPrism) { | ||
| this.mapperPrism = mapperPrism; | ||
| private MapperConfiguration(Element e, FormattingMessager messager) { | ||
| this.mapperPrism = MapperPrism.getInstanceOn( e ); |
There was a problem hiding this comment.
Moved the MapperPrism.getInstanceOn to the constructor as the Element is required a few lines later. I also added the FormattingMessager to be able to print the validation messages. I don't know if validation is fine at this point, maybe there is some more general place when the @Mapper annotated classes will be loaded?
|
@chris922 just to let you know that we haven't forgotten this one. We are focused on the 1.3.0.Beta1 release and we want to get it out as soon as possible (and issues just keep popping up 😟). Once we get that out I am going to have a look at your comments and update in this one. I hope this is fine for you |
|
Closing this since it is now possible to achieve this with the new This was done in PR #3019 |
Added two new annotations that allows to configure the component models, e. g. the bean name
@MapperSpringConfig@MapperJsr330ConfigThis adds the functionality requested in ticket #1427. A few more information from my side are available there.
I added
@Since 1.3to new classes, so in case the PR will be accepted after 1.3 was released I/someone must update this.