feat: supports custom toBuilder method name - #4062
Conversation
|
Nice. Really simple and the example of e.g. |
|
My initial thought about it was that this should probably be a config flag instead of an individual attribute. This keeps all builders in sync and leads to a better codebase. Different names for different builders doesn't feel right. |
The configuration file approach is indeed a more unified way to keep the behavior of all Regarding the priority between the two, my thoughts are:
This way, we maintain global consistency while still allowing overrides on individual |
|
Have you tried this out in different IDEs? I am aware of the Jetbrains IDEA Lombok plugin being part of the main IDE git tree now, so they'd need to update that given they maintain an internal autocomplete index. I suspect they'd be willing given it's been active with work on |
I’ve only tried this in IntelliJ IDEA so far. Regarding the JetBrains Lombok plugin: I’m not fully sure about the coordination process between Lombok and JetBrains. Would it be appropriate to wait for further progress on this PR before opening a corresponding update request on their side, or would parallel tracking be acceptable? I’m happy to follow whichever workflow is preferred. |
|
If using your changes in IntelliJ doesn't cause any issues then that's great. I'll defer to the Lombok team on collaboration with Jetbrains. I personally see no reason it should get in the way. |
Sorry for the confusion earlier — what I meant is that using IntelliJ IDEA as the development environment does not cause any issues for compiling or testing the newly added functionality. |
Summary
Related: #4056 (Scope:
@Builder)Adds a new
toBuilderMethodNameattribute to@Builder, allowing users to customize the name of the method generated whentoBuilder = true.toBuilder = true; otherwise the attribute is ignored.Adds the config key
lombok.builder.toBuilderMethodName, which sets the global default whenever@Builder(toBuilder = true)is used without an explicittoBuilderMethodNameparameter.lombok.builder.toBuilderMethodNameconfig key → "toBuilder" (Default).