aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/Builder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lombok/Builder.java')
-rw-r--r--src/core/lombok/Builder.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/lombok/Builder.java b/src/core/lombok/Builder.java
index dfa5ecb5..4ca3da65 100644
--- a/src/core/lombok/Builder.java
+++ b/src/core/lombok/Builder.java
@@ -153,6 +153,22 @@ public @interface Builder {
* @return The builder class will be generated with this access modifier.
*/
AccessLevel access() default lombok.AccessLevel.PUBLIC;
+
+ /**
+ * Prefix to prepend to 'set' methods in the generated builder class. By default, generated methods do not include a prefix.
+ *
+ * For example, a method normally generated as {@code someField(String someField)} would instead be
+ * generated as {@code withSomeField(String someField)} if using {@code @Builder(setterPrefix = "with")}.
+ *
+ * Note that using "with" to prefix builder setter methods is strongly discouraged as as "with" normally
+ * suggests immutable data structures, and builders by definition are mutable objects.
+ *
+ * For {@code @Singular} fields, the generated methods are called {@code withName}, {@code withNames}, and {@code clearNames}, instead of
+ * the default {@code name}, {@code names}, and {@code clearNames}.
+ *
+ * @return The prefix to prepend to generated method names.
+ */
+ String setterPrefix() default "";
/**
* Put on a field (in case of {@code @Builder} on a type) or a parameter (for {@code @Builder} on a constructor or static method) to