Pass mapstructSpi.enumPostfix as compilerArg#133
Conversation
648604a to
5ab5e44
Compare
61ec81c to
bb7c753
Compare
seime
left a comment
There was a problem hiding this comment.
I was thinking that this should be made configurable pr package since one may one package with proto files using one style, and another using a different style.
WDYT?
|
How would you envision that it would work ideally? As in, how would you want to pass in the different configuration per package? e.g. Or something different? In this case, if we wanted to support non specificity of packages (in the scenarios where all protos need to be treated the same) we might also need to support wildcards... But my opinion is that your project is more likely than not going to have some sort of consistency (either you are following Google's style guide, or Uber's, or your own) and the need for a multi-configuration is likely unnecessary for the majority of use cases. I know for us it definitely is. |
|
My preference is to merge as is and incrementally add more support for configurability as the need arises. In my honest opinion, an organization/individual service should be consistent with their naming conventions. |
|
I think we should default to Google style and use this new parameter to override this for certain package roots? |
So how it's written right now, it will default to the Google style if the param is not passed. Are you suggesting that the param (if supplied) should only be applied to specific specified package roots? As in, another compiler arg? If so, I was just wondering what use case you are thinking of where one would need two separate postfixes in the same project. Is it a scenario in which one is importing proto messages from multiple sources, where one source might be using the Google style and another source is using some other style? |
|
Updated to allow for package specific enum postfix overrides. |
|
Thanks for your contribution @ro0sterjam ! |
Allow configuration of enumPostfix by means of a compilerArg.
e.g.
Unfortunately I was unable to find a "clean" way to pass the
ProcessingEnvironmentoptions from MapStruct'sMappingProcessorso I had to create my own to pass the options to a static variable (terrible, I know). Please let me know if you have any better suggestions.This should be safe because the processors are all initialized together first, before calling
processthus theOPTIONSstatic field should be initialized by the time it is called on byProtobufEnumMappingStrategy.