New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MapStruct should have means to mark getters / setters as going to be ignored #1152
Comments
I think that we can do this and #1151 together. We can do the implementation flexible so that it uses an SPI (maybe even a list of SPIs) that provides a way for the user to give multiple annotations that can be used to ignore getter / setter. This way they can use their own annotations and can for example in one go ignore In the end |
I don't see how this is different from not having the new auto mapping... If I don't want a property But I like the idea of providing means to do it with an SPI, if there is really some special need for this. |
Well. when I wrote this I spent half an hour troubleshooting on a mapping that MapStruct tried to make on This type is called in a lot of places. So I would like to be able to stick an |
@TobLin921 : this one is not closed. Implementing this one would also offer a solution for #1151. However, we're not in agreement if marking the target properties is the way forward.. That's why its still open. |
protected <R> R getRepo(R repoType){
return (R) SpringApplicationContext.getBeanByType(repoType.getClass());
} a method like the one above is automatically used in all sorts of tests of mine for various types, because of its generic nature. I believe the |
Hi @pascalwhoop , Have a look at the SPI. I think you are able to exclude I'm going to close this issue. There's a PR pending in 1.3 for supporting annotations on source/target side. Perhaps that could be used to fabric a solution as well (not relying on SPI). Not sure whether the PR will make it eventually. |
@sjaakd Can you link the PR? I went through 1.3 changelog and didn't find anything on this topic. Thank you. |
My answer dated from over a year ago.. We decided against having annotations on the source / target beans. So, I guess its up to implementing the SPI. |
@sjaakd Having a separate artefact just to ignore a couple of methods is overkill, don't you agree? |
Suppose a reusable source dto:
Especially with the new nested mapping, I want to have some means that the
isValid()
is not considered a source accessor if by any chance somewhere in the structure of the target is a propertyvalid
.Something like this:
The text was updated successfully, but these errors were encountered: