mapstruct / mapstruct-idea

An IntelliJ IDEA plugin for working with MapStruct
Other
141 stars 38 forks source link

add support for unmappedTargetPolicy #131

Closed hduelme closed 1 year ago

hduelme commented 1 year ago

I added support for unmappedTargetPolicy. The policy will be read from the class annotation @Mapper first. If not configured on class level, the property of the mapper-config-class will be used. Otherwise the fallback policy warn is used.

To directly match the compiler results, unmappedTargetPolicy = ERROR results in Errors getting reported instead of warnings. If set to unmappedTargetPolicy = IGNORE all warnings for unmapped targets are suppressed in the current class.

Fixes #132

hduelme commented 1 year ago

@filiphr I added support for @BeanMapping. I also renamed the methods as suggested and removed the not needed parameters. Furthermore, I have added more tests, which cover different possible combinations of overwriting policy.

filiphr commented 1 year ago

Thanks a lot @hduelme. It looks great. I did a small change to reduce the size of the tests a bit. I removed some obsolete mappers and moved all the tests into one single test class. Hope you are OK with that

filiphr commented 1 year ago

I also updated the description of the inspection to include the fact that the unmapped target policy is taken into consideration

hduelme commented 1 year ago

@filiphr thanks for the feedback. I personally was not sure, if it would be better to have all tests in the same place. But I a agree. It looks cleaner.