From afb03e037cbb22694c9cc80de73da78250b9e3d0 Mon Sep 17 00:00:00 2001
From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Date: Sun, 4 Oct 2026 09:47:05 +0000
Subject: [PATCH 1/5] Order generated builder members: constructors,
visibility, scope, field, name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Introduces a member ordering that keeps each field's methods together
and emits the direct property setter last within its overload group,
so consumers that resolve overloaded builder methods last-wins (e.g.
MapStruct's builder detection) bind to the plain setter.
The emission order is decided on the generation side:
BuilderToGenerationTypeMapper sorts the (field, method) pairs by
ordering value, access modifier (public first), non-static before
static, originating field (alphabetically, builder-level methods
last), method name, direct setter last, then the existing
tie-breakers, and emits already-ordered MethodDtos. MethodDto drops
its ordering field and comparator — it no longer carries
generation-scope metadata. The generator-side signature safety net
degrades to keep-first-occurrence with a warning (error in strict
mode); real conflict resolution stays priority-based in
BuilderDefinitionCreator. Regenerates example builders and golden
test fixtures.
---
docs/CUSTOMIZING.md | 5 +
.../example/ExternalAddressBuilder.java | 198 ++---
.../example/JacksonIntegrationDtoBuilder.java | 60 +-
.../example/MannschaftDtoBuilder.java | 102 +--
.../example/OrderWithDefaultsBuilder.java | 96 +--
.../builders/example/PersonDtoBuilder.java | 218 ++---
.../example/ProductRecordBuilder.java | 94 +--
.../example/ProductWithDefaultsBuilder.java | 116 +--
.../builders/example/SponsorDtoBuilder.java | 38 +-
.../scoping/ScopedOwnerDtoBuilder.java | 114 +--
.../scoping/TrustedHelperDtoBuilder.java | 38 +-
.../roaster/RoasterCodeGenerator.java | 29 +-
.../core/BuilderToGenerationTypeMapper.java | 134 +++-
.../processor/model/method/MethodDto.java | 122 ---
.../processor/AnnotationCopyTest.java | 3 +-
.../ComprehensiveFeatureIntegrationTest.java | 748 ++++++++++--------
.../ConfigurationProcessingTest.java | 10 +-
.../processor/FormattingModeTest.java | 508 ++++++------
18 files changed, 1336 insertions(+), 1297 deletions(-)
diff --git a/docs/CUSTOMIZING.md b/docs/CUSTOMIZING.md
index b52cdbe7..488a43a3 100644
--- a/docs/CUSTOMIZING.md
+++ b/docs/CUSTOMIZING.md
@@ -275,11 +275,14 @@ compileJava {
| [`StringFormatHelperGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/StringFormatHelperGenerator.java) | String.format helpers | 80 |
| [`SupplierMethodGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/SupplierMethodGenerator.java) | Supplier-based setters | 80 |
| [`VarArgsHelperGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/VarArgsHelperGenerator.java) | Varargs helpers | 50 |
+| [`StringBuilderConsumerGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/StringBuilderConsumerGenerator.java) | StringBuilder consumer methods | 45 |
| [`ArrayConversionGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/ArrayConversionGenerator.java) | Array-from-List conversion methods | 35 |
| [`UpdateHelperGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/UpdateHelperGenerator.java) | UnaryOperator update helpers | 31 |
| [`AddToCollectionGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/AddToCollectionGenerator.java) | add2FieldName methods for List/Set | 30 |
| [`ArrayBuilderConsumerGenerator`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/field/ArrayBuilderConsumerGenerator.java) | ArrayListBuilder consumer methods for arrays | 25 |
+The column is the generator's *execution* priority. Emission order inside the generated class is governed separately: constructors first, then methods sorted by their `ordering` value (creation methods 200, fluent field methods 1000, conditional helpers 1100, build 1200, toString 2000, private helpers 2100), then by access modifier (public first, private last), non-static before static, then grouped by originating field, and finally by method name. Within a same-named overload group the direct property setter is emitted last, so consumers that resolve overloaded builder methods last-wins — e.g. MapStruct's builder detection — bind to the plain setter.
+
### Builder-Level Generators
| Generator | Purpose | Priority |
@@ -287,8 +290,10 @@ compileJava {
| [`ConditionalEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/ConditionalEnhancer.java) | Conditional logic methods | 100 |
| [`JacksonAnnotationEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/JacksonAnnotationEnhancer.java) | Jackson annotations | 100 |
| [`CoreMethodsEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/CoreMethodsEnhancer.java) | Core builder methods (build, create, toString) | 100 |
+| [`ConstructorEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/ConstructorEnhancer.java) | Builder constructors (empty + from-instance) | 95 |
| [`WithInterfaceEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/WithInterfaceEnhancer.java) | With interface implementation | 90 |
| [`InterfaceEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/InterfaceEnhancer.java) | Builder interface implementation | 90 |
+| [`FieldPrefillEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/FieldPrefillEnhancer.java) | Field-function prefilling for referenced builders | 15 |
| [`GeneratedAnnotationEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/GeneratedAnnotationEnhancer.java) | @Generated annotation | 10 |
| [`BuilderImplementationAnnotationEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/BuilderImplementationAnnotationEnhancer.java) | @BuilderImplementation annotation | 10 |
| [`ClassJavaDocEnhancer`](../processor/src/main/java/org/javahelpers/simple/builders/processor/generators/builder/ClassJavaDocEnhancer.java) | Class-level JavaDoc | 10 |
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/ExternalAddressBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/ExternalAddressBuilder.java
index f077e84e..7c8de9c9 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/ExternalAddressBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/ExternalAddressBuilder.java
@@ -95,25 +95,6 @@ public static ExternalAddressBuilder create() {
return new ExternalAddressBuilder();
}
- /**
- * Sets the value for city.
- *
- * Generated from setter {@link ExternalAddress#setCity(String) setCity(String city)} - * - *
{@code
- * builder.city("example value");
- * }
- *
- * @param city city
- * @return current instance of builder
- */
- public ExternalAddressBuilder city(String city) {
- this.city = changedValue(city);
- return this;
- }
-
/**
* Sets the value for city by executing the provided consumer.
*
@@ -176,47 +157,47 @@ public ExternalAddressBuilder city(String format, Object... args) {
}
/**
- * Updates the current value of city in place by applying the given operator, instead of reading it out,
- * changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
- * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
- * value must have been set before (directly or via an existing instance).
+ * Sets the value for city.
*
* Generated from setter {@link ExternalAddress#setCity(String) setCity(String city)} * *
{@code
- * builder.city("example value").cityUpdate(String::trim);
+ * builder.city("example value");
* }
*
- * @param cityUpdater operator applied to the current value; its result becomes the new value
+ * @param city city
* @return current instance of builder
- * @throws IllegalStateException if city has not been set yet
*/
- public ExternalAddressBuilder cityUpdate(UnaryOperatorstreet.
+ * Updates the current value of city in place by applying the given operator, instead of reading it out,
+ * changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
+ * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
+ * value must have been set before (directly or via an existing instance).
* - * Generated from setter {@link ExternalAddress#setStreet(String) setStreet(String street)} + * Generated from setter {@link ExternalAddress#setCity(String) setCity(String city)} * *
{@code
- * builder.street("example value");
+ * builder.city("example value").cityUpdate(String::trim);
* }
*
- * @param street street
+ * @param cityUpdater operator applied to the current value; its result becomes the new value
* @return current instance of builder
+ * @throws IllegalStateException if city has not been set yet
*/
- public ExternalAddressBuilder street(String street) {
- this.street = changedValue(street);
+ public ExternalAddressBuilder cityUpdate(UnaryOperatorstreet in place by applying the given operator, instead of reading it
- * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
- * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
- * value must have been set before (directly or via an existing instance).
+ * Sets the value for street.
* * Generated from setter {@link ExternalAddress#setStreet(String) setStreet(String street)} * *
{@code
- * builder.street("example value").streetUpdate(String::trim);
+ * builder.street("example value");
* }
*
- * @param streetUpdater operator applied to the current value; its result becomes the new value
+ * @param street street
* @return current instance of builder
- * @throws IllegalStateException if street has not been set yet
*/
- public ExternalAddressBuilder streetUpdate(UnaryOperator
- * Generated from setter {@link ExternalAddress#setCity(String) setCity(String city)}
- *
- * @return this builder instance for chaining
- * @throws IllegalArgumentException if city is null or empty
- */
- ExternalAddressBuilder validateCity() {
- if (!city.isSet() || city.value().trim().isEmpty()) {
- throw new IllegalArgumentException("City cannot be null or empty");
- }
+ public ExternalAddressBuilder street(String street) {
+ this.street = changedValue(street);
return this;
}
/**
- * Validates that the street field is not null or empty.
+ * Updates the current value of street in place by applying the given operator, instead of reading it
+ * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
+ * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
+ * value must have been set before (directly or via an existing instance).
*
* Generated from setter {@link ExternalAddress#setStreet(String) setStreet(String street)} * - * @return this builder instance for chaining - * @throws IllegalArgumentException if street is null or empty - */ - ExternalAddressBuilder validateStreet() { - if (!street.isSet() || street.value().trim().isEmpty()) { - throw new IllegalArgumentException("Street cannot be null or empty"); - } - return this; - } - - /** - * Validates that the zipCode field is not null or empty. - *
- * Generated from setter {@link ExternalAddress#setZipCode(String) setZipCode(String zipCode)}
- *
- * @return this builder instance for chaining
- * @throws IllegalArgumentException if zipCode is null or empty
- */
- ExternalAddressBuilder validateZipCode() {
- if (!zipCode.isSet() || zipCode.value().trim().isEmpty()) {
- throw new IllegalArgumentException("ZipCode cannot be null or empty");
- }
- return this;
- }
-
- /**
- * Sets the value for zipCode.
- *
- * Generated from setter {@link ExternalAddress#setZipCode(String) setZipCode(String zipCode)} - * *
{@code
- * builder.zipCode("example value");
+ * builder.street("example value").streetUpdate(String::trim);
* }
*
- * @param zipCode zipCode
+ * @param streetUpdater operator applied to the current value; its result becomes the new value
* @return current instance of builder
+ * @throws IllegalStateException if street has not been set yet
*/
- public ExternalAddressBuilder zipCode(String zipCode) {
- this.zipCode = changedValue(zipCode);
+ public ExternalAddressBuilder streetUpdate(UnaryOperatorzipCode.
+ * + * Generated from setter {@link ExternalAddress#setZipCode(String) setZipCode(String zipCode)} + * + *
{@code
+ * builder.zipCode("example value");
+ * }
+ *
+ * @param zipCode zipCode
+ * @return current instance of builder
+ */
+ public ExternalAddressBuilder zipCode(String zipCode) {
+ this.zipCode = changedValue(zipCode);
+ return this;
+ }
+
/**
* Updates the current value of zipCode in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -458,6 +413,51 @@ public ExternalAddressBuilder zipCodeUpdate(UnaryOperator+ * Generated from setter {@link ExternalAddress#setCity(String) setCity(String city)} + * + * @return this builder instance for chaining + * @throws IllegalArgumentException if city is null or empty + */ + ExternalAddressBuilder validateCity() { + if (!city.isSet() || city.value().trim().isEmpty()) { + throw new IllegalArgumentException("City cannot be null or empty"); + } + return this; + } + + /** + * Validates that the street field is not null or empty. + *
+ * Generated from setter {@link ExternalAddress#setStreet(String) setStreet(String street)} + * + * @return this builder instance for chaining + * @throws IllegalArgumentException if street is null or empty + */ + ExternalAddressBuilder validateStreet() { + if (!street.isSet() || street.value().trim().isEmpty()) { + throw new IllegalArgumentException("Street cannot be null or empty"); + } + return this; + } + + /** + * Validates that the zipCode field is not null or empty. + *
+ * Generated from setter {@link ExternalAddress#setZipCode(String) setZipCode(String zipCode)}
+ *
+ * @return this builder instance for chaining
+ * @throws IllegalArgumentException if zipCode is null or empty
+ */
+ ExternalAddressBuilder validateZipCode() {
+ if (!zipCode.isSet() || zipCode.value().trim().isEmpty()) {
+ throw new IllegalArgumentException("ZipCode cannot be null or empty");
+ }
+ return this;
+ }
+
/**
* Conditionally applies builder modifications if the condition is true.
*
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/JacksonIntegrationDtoBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/JacksonIntegrationDtoBuilder.java
index 7ec144f0..7e7671f0 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/JacksonIntegrationDtoBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/JacksonIntegrationDtoBuilder.java
@@ -84,7 +84,7 @@ public static JacksonIntegrationDtoBuilder create() {
}
/**
- * Sets the value for age.
+ * Sets the value for age by invoking the provided supplier.
*
* Generated from parameter in constructor {@link JacksonIntegrationDto#JacksonIntegrationDto(String, int) * JacksonIntegrationDto(String name, int age)} @@ -92,19 +92,19 @@ public static JacksonIntegrationDtoBuilder create() { *
{@code
- * builder.age(42);
+ * builder.age(() -> 42);
* }
*
- * @param age age
+ * @param ageSupplier supplier for age
* @return current instance of builder
*/
- public JacksonIntegrationDtoBuilder age(int age) {
- this.age = changedValue(age);
+ public JacksonIntegrationDtoBuilder age(Supplierage by invoking the provided supplier.
+ * Sets the value for age.
* * Generated from parameter in constructor {@link JacksonIntegrationDto#JacksonIntegrationDto(String, int) * JacksonIntegrationDto(String name, int age)} @@ -112,14 +112,14 @@ public JacksonIntegrationDtoBuilder age(int age) { *
{@code
- * builder.age(() -> 42);
+ * builder.age(42);
* }
*
- * @param ageSupplier supplier for age
+ * @param age age
* @return current instance of builder
*/
- public JacksonIntegrationDtoBuilder age(Suppliername.
- * - * Generated from parameter in constructor {@link JacksonIntegrationDto#JacksonIntegrationDto(String, int) - * JacksonIntegrationDto(String name, int age)} - * - *
{@code
- * builder.name("example value");
- * }
- *
- * @param name name
- * @return current instance of builder
- */
- public JacksonIntegrationDtoBuilder name(String name) {
- this.name = changedValue(name);
- return this;
- }
-
/**
* Sets the value for name by executing the provided consumer.
*
@@ -234,6 +214,26 @@ public JacksonIntegrationDtoBuilder name(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for name.
+ *
+ * Generated from parameter in constructor {@link JacksonIntegrationDto#JacksonIntegrationDto(String, int) + * JacksonIntegrationDto(String name, int age)} + * + *
{@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public JacksonIntegrationDtoBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/MannschaftDtoBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/MannschaftDtoBuilder.java
index 3bd8b580..170884ed 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/MannschaftDtoBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/MannschaftDtoBuilder.java
@@ -84,45 +84,6 @@ public static MannschaftDtoBuilder create() {
return new MannschaftDtoBuilder();
}
- /**
- * Adds a single element to sponsoren.
- *
- * Generated from setter {@link MannschaftDto#setSponsoren(Set) setSponsoren(Set
- * Generated from setter {@link MannschaftDto#setName(String) setName(String name)}
- *
- *
@@ -184,6 +145,25 @@ public MannschaftDtoBuilder name(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for
+ * Generated from setter {@link MannschaftDto#setName(String) setName(String name)}
+ *
+ *
* Generated from setter {@link MannschaftDto#setSponsoren(Set) setSponsoren(Set
* Generated from setter {@link MannschaftDto#setSponsoren(Set) setSponsoren(Set
+ * Generated from setter {@link MannschaftDto#setSponsoren(Set) setSponsoren(Set
- * Generated from setter {@link OrderWithDefaults#setId(String) setId(String id)}
- *
- *
@@ -171,6 +152,25 @@ public OrderWithDefaultsBuilder id(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for
+ * Generated from setter {@link OrderWithDefaults#setId(String) setId(String id)}
+ *
+ *
* Generated from setter {@link OrderWithDefaults#setPriority(int) setPriority(int priority)}
*
*
* Generated from setter {@link OrderWithDefaults#setPriority(int) setPriority(int priority)}
*
*
- * Generated from setter {@link OrderWithDefaults#setStatus(String) setStatus(String status)}
- *
- *
@@ -341,6 +322,25 @@ public OrderWithDefaultsBuilder status(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for
+ * Generated from setter {@link OrderWithDefaults#setStatus(String) setStatus(String status)}
+ *
+ *
- * Generated from setter {@link PersonDto#setNickNames(List) setNickNames(List
- * Generated from setter {@link PersonDto#setBirthdate(LocalDate) setBirthdate(LocalDate birthdate)}
- *
- *
- * Generated from setter {@link PersonDto#setMannschaft(MannschaftDto) setMannschaft(MannschaftDto mannschaft)}
- *
- *
@@ -262,6 +217,25 @@ public PersonDtoBuilder mannschaft(Supplier
+ * Generated from setter {@link PersonDto#setMannschaft(MannschaftDto) setMannschaft(MannschaftDto mannschaft)}
+ *
+ *
- * Generated from parameter in constructor {@link PersonDto#PersonDto(String) PersonDto(String name)}
- *
- *
@@ -363,6 +318,25 @@ public PersonDtoBuilder name(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for
+ * Generated from parameter in constructor {@link PersonDto#PersonDto(String) PersonDto(String name)}
+ *
+ *
* Generated from setter {@link PersonDto#setNickNames(List) setNickNames(List
- * Generated from setter {@link PersonDto#setNickNames2(String) setNickNames2(String nickNames2)}
+ * Generated from setter {@link PersonDto#setNickNames(List) setNickNames(List
+ * Generated from setter {@link PersonDto#setNickNames(List) setNickNames(List
* Generated from setter {@link PersonDto#setNickNames2(String) setNickNames2(String nickNames2)}
*
- * @param nickNames2Updater operator applied to the current value; its result becomes the new value
+ *
- * Generated from setter {@link PersonDto#setNickNames(List) setNickNames(List
- * Generated from parameter in constructor {@link ProductRecord#ProductRecord(String, double, String)
- * ProductRecord(String name, double price, String category)}
- *
- *
@@ -175,10 +155,7 @@ public ProductRecordBuilder category(String format, Object... args) {
}
/**
- * Updates the current value of
* Generated from parameter in constructor {@link ProductRecord#ProductRecord(String, double, String)
* ProductRecord(String name, double price, String category)}
@@ -186,23 +163,22 @@ public ProductRecordBuilder category(String format, Object... args) {
*
* Generated from parameter in constructor {@link ProductRecord#ProductRecord(String, double, String)
* ProductRecord(String name, double price, String category)}
@@ -210,14 +186,18 @@ public ProductRecordBuilder categoryUpdate(UnaryOperator
+ * Generated from parameter in constructor {@link ProductRecord#ProductRecord(String, double, String)
+ * ProductRecord(String name, double price, String category)}
+ *
+ *
* Generated from parameter in constructor {@link ProductRecord#ProductRecord(String, double, String)
* ProductRecord(String name, double price, String category)}
@@ -321,19 +321,19 @@ public ProductRecordBuilder nameUpdate(UnaryOperator
* Generated from parameter in constructor {@link ProductRecord#ProductRecord(String, double, String)
* ProductRecord(String name, double price, String category)}
@@ -341,14 +341,14 @@ public ProductRecordBuilder price(double price) {
*
* Generated from parameter in constructor
* {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
@@ -109,19 +109,19 @@ public static ProductWithDefaultsBuilder create() {
*
* Generated from parameter in constructor
* {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
@@ -130,14 +130,14 @@ public ProductWithDefaultsBuilder active(boolean active) {
*
- * Generated from parameter in constructor
- * {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
- * double price, String category, boolean active)}
- *
- *
@@ -258,10 +237,7 @@ public ProductWithDefaultsBuilder category(String format, Object... args) {
}
/**
- * Updates the current value of
* Generated from parameter in constructor
* {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
@@ -270,23 +246,22 @@ public ProductWithDefaultsBuilder category(String format, Object... args) {
*
* Generated from parameter in constructor
* {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
@@ -295,14 +270,18 @@ public ProductWithDefaultsBuilder categoryUpdate(UnaryOperator
+ * Generated from parameter in constructor
+ * {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
+ * double price, String category, boolean active)}
+ *
+ *
* Generated from parameter in constructor
* {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
@@ -411,19 +411,19 @@ public ProductWithDefaultsBuilder nameUpdate(UnaryOperator
* Generated from parameter in constructor
* {@link ProductWithDefaults#ProductWithDefaults(String, double, String, boolean) ProductWithDefaults(String name,
@@ -432,14 +432,14 @@ public ProductWithDefaultsBuilder price(double price) {
*
- * Generated from setter {@link SponsorDto#setName(String) setName(String name)}
- *
- *
@@ -152,6 +133,25 @@ public SponsorDtoBuilder name(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for
+ * Generated from setter {@link SponsorDto#setName(String) setName(String name)}
+ *
+ *
- * Generated from setter {@link ScopedOwnerDto#setLibrary(LibraryHelperDto) setLibrary(LibraryHelperDto library)}
- *
- *
@@ -140,6 +121,25 @@ public ScopedOwnerDtoBuilder library(Supplier
+ * Generated from setter {@link ScopedOwnerDto#setLibrary(LibraryHelperDto) setLibrary(LibraryHelperDto library)}
+ *
+ *
- * Generated from setter {@link ScopedOwnerDto#setSponsor(SponsorDto) setSponsor(SponsorDto sponsor)}
- *
- *
@@ -213,6 +194,25 @@ public ScopedOwnerDtoBuilder sponsor(Supplier
+ * Generated from setter {@link ScopedOwnerDto#setSponsor(SponsorDto) setSponsor(SponsorDto sponsor)}
+ *
+ *
- * Generated from setter {@link ScopedOwnerDto#setTrusted(TrustedHelperDto) setTrusted(TrustedHelperDto trusted)}
- *
- *
@@ -294,6 +275,25 @@ public ScopedOwnerDtoBuilder trusted(Supplier
+ * Generated from setter {@link ScopedOwnerDto#setTrusted(TrustedHelperDto) setTrusted(TrustedHelperDto trusted)}
+ *
+ *
- * Generated from setter {@link TrustedHelperDto#setName(String) setName(String name)}
- *
- *
@@ -154,6 +135,25 @@ public TrustedHelperDtoBuilder name(String format, Object... args) {
return this;
}
+ /**
+ * Sets the value for
+ * Generated from setter {@link TrustedHelperDto#setName(String) setName(String name)}
+ *
+ * Since conflicts should already be resolved by the builder-specific step, this safety net
- * simply keeps the first occurrence for any remaining duplicate signatures and logs a generic
- * warning.
+ * simply keeps the first occurrence for any remaining duplicate signatures and reports it as a
+ * warning (an error in strict mode).
*/
private List Lower values appear first in the generated class. Methods with the same ordering and name
- * are sorted using the following enhanced rules:
- *
- * Sorting order for methods with same ordering and name:
- *
- * The signature includes method name and parameter types in the format:
- * methodName(paramType1,paramType2,...)
- *
- * @param method the method to create signature for
- * @return signature string for comparison
- */
- private String createMethodSignature(MethodDto method) {
- StringBuilder signature = new StringBuilder(method.getMethodName());
- signature.append("(");
-
- java.util.List
- * Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
- * name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
- * Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
- * name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
- * Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
- * name, int age, Optional
- * Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
- * name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
- * Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
- * name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optional
+ * Generated from parameter in constructor
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
+ * name, int age, Optional
* Generated from parameter in constructor
- * {@link PersonDto#PersonDto(String,int,Optional,List,Set,Map,AddressDto,List,LinkedList) PersonDto(String
+ * {@link PersonDto#PersonDto(String, int, Optional, List, Set, Map, AddressDto, List, LinkedList) PersonDto(String
* name, int age, Optionalname.
- * Example:
- *
- * {@code
- * builder.name("example value");
- * }
- *
- * @param name name
- * @return current instance of builder
- */
- public MannschaftDtoBuilder name(String name) {
- this.name = changedValue(name);
- return this;
- }
-
/**
* Sets the value for name by executing the provided consumer.
* name.
+ * Example:
+ *
+ * {@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public MannschaftDtoBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -211,15 +191,22 @@ public MannschaftDtoBuilder nameUpdate(UnaryOperatorsponsoren.
+ * Adds a single element to sponsoren.
* Example:
- *
- * {@code
- * builder.sponsoren(Set.of(SponsorDtoBuilder.create().build()));
- * }
- *
* @param sponsoren sponsoren
* @return current instance of builder
*/
- public MannschaftDtoBuilder sponsoren(Setsponsoren.
+ * Example:
+ *
+ * {@code
+ * builder.sponsoren(Set.of(SponsorDtoBuilder.create().build()));
+ * }
+ *
+ * @param sponsoren sponsoren
+ * @return current instance of builder
+ */
+ public MannschaftDtoBuilder sponsoren(Setsponsoren in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/OrderWithDefaultsBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/OrderWithDefaultsBuilder.java
index e69d6a04..d0c1e671 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/OrderWithDefaultsBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/OrderWithDefaultsBuilder.java
@@ -91,25 +91,6 @@ public static OrderWithDefaultsBuilder create() {
return new OrderWithDefaultsBuilder();
}
- /**
- * Sets the value for id.
- * Example:
- *
- * {@code
- * builder.id("example value");
- * }
- *
- * @param id id
- * @return current instance of builder
- */
- public OrderWithDefaultsBuilder id(String id) {
- this.id = changedValue(id);
- return this;
- }
-
/**
* Sets the value for id by executing the provided consumer.
* id.
+ * Example:
+ *
+ * {@code
+ * builder.id("example value");
+ * }
+ *
+ * @param id id
+ * @return current instance of builder
+ */
+ public OrderWithDefaultsBuilder id(String id) {
+ this.id = changedValue(id);
+ return this;
+ }
+
/**
* Updates the current value of id in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -198,40 +198,40 @@ public OrderWithDefaultsBuilder idUpdate(UnaryOperatorpriority.
+ * Sets the value for priority by invoking the provided supplier.
* Example:
*
* {@code
- * builder.priority(42);
+ * builder.priority(() -> 42);
* }
*
- * @param priority priority
+ * @param prioritySupplier supplier for priority
* @return current instance of builder
*/
- public OrderWithDefaultsBuilder priority(int priority) {
- this.priority = changedValue(priority);
+ public OrderWithDefaultsBuilder priority(Supplierpriority by invoking the provided supplier.
+ * Sets the value for priority.
* Example:
*
* {@code
- * builder.priority(() -> 42);
+ * builder.priority(42);
* }
*
- * @param prioritySupplier supplier for priority
+ * @param priority priority
* @return current instance of builder
*/
- public OrderWithDefaultsBuilder priority(Supplierstatus.
- * Example:
- *
- * {@code
- * builder.status("example value");
- * }
- *
- * @param status status
- * @return current instance of builder
- */
- public OrderWithDefaultsBuilder status(String status) {
- this.status = changedValue(status);
- return this;
- }
-
/**
* Sets the value for status by executing the provided consumer.
* status.
+ * Example:
+ *
+ * {@code
+ * builder.status("example value");
+ * }
+ *
+ * @param status status
+ * @return current instance of builder
+ */
+ public OrderWithDefaultsBuilder status(String status) {
+ this.status = changedValue(status);
+ return this;
+ }
+
/**
* Updates the current value of status in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/PersonDtoBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/PersonDtoBuilder.java
index b05bb3a5..327027f0 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/PersonDtoBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/PersonDtoBuilder.java
@@ -112,28 +112,21 @@ public static PersonDtoBuilder create() {
}
/**
- * Adds a single element to nickNames.
+ * Sets the value for birthdate by invoking the provided supplier.
* Example:
*
* {@code
- * builder.add2NickNames("example value");
+ * builder.birthdate(() -> LocalDate.now());
* }
*
- * @param element the element to add
+ * @param birthdateSupplier supplier for birthdate
* @return current instance of builder
*/
- public PersonDtoBuilder add2NickNames(String element) {
- Listbirthdate by invoking the provided supplier.
- * Example:
- *
- * {@code
- * builder.birthdate(() -> LocalDate.now());
- * }
- *
- * @param birthdateSupplier supplier for birthdate
- * @return current instance of builder
- */
- public PersonDtoBuilder birthdate(Supplierbirthdate in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -201,25 +175,6 @@ public PersonDtoBuilder birthdateUpdate(UnaryOperatormannschaft.
- * Example:
- *
- * {@code
- * builder.mannschaft(new MannschaftDto());
- * }
- *
- * @param mannschaft mannschaft
- * @return current instance of builder
- */
- public PersonDtoBuilder mannschaft(MannschaftDto mannschaft) {
- this.mannschaft = changedValue(mannschaft);
- return this;
- }
-
/**
* Sets the value for mannschaft using a builder consumer that produces the value.
* mannschaft.
+ * Example:
+ *
+ * {@code
+ * builder.mannschaft(new MannschaftDto());
+ * }
+ *
+ * @param mannschaft mannschaft
+ * @return current instance of builder
+ */
+ public PersonDtoBuilder mannschaft(MannschaftDto mannschaft) {
+ this.mannschaft = changedValue(mannschaft);
+ return this;
+ }
+
/**
* Updates the current value of mannschaft in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -283,25 +257,6 @@ public PersonDtoBuilder mannschaftUpdate(UnaryOperatorname.
- * Example:
- *
- * {@code
- * builder.name("example value");
- * }
- *
- * @param name name
- * @return current instance of builder
- */
- public PersonDtoBuilder name(String name) {
- this.name = changedValue(name);
- return this;
- }
-
/**
* Sets the value for name by executing the provided consumer.
* name.
+ * Example:
+ *
+ * {@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public PersonDtoBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -390,21 +364,28 @@ public PersonDtoBuilder nameUpdate(UnaryOperatornickNames.
+ * Adds a single element to nickNames.
* Example:
*
* {@code
- * builder.nickNames("example value", "example value");
+ * builder.add2NickNames("example value");
* }
*
- * @param nickNames nickNames
+ * @param element the element to add
* @return current instance of builder
*/
- public PersonDtoBuilder nickNames(String... nickNames) {
- this.nickNames = changedValue(List.of(nickNames));
+ public PersonDtoBuilder add2NickNames(String element) {
+ ListExample:
*
* {@code
- * builder.nickNames(List.of("example value"));
+ * builder.nickNames("example value", "example value");
* }
*
* @param nickNames nickNames
* @return current instance of builder
*/
- public PersonDtoBuilder nickNames(List> nickNamesSupplier) {
}
/**
- * Sets the value for
nickNames2.
+ * Sets the value for nickNames.
* Example:
*
* {@code
- * builder.nickNames2(new String[]{"example value"});
+ * builder.nickNames(List.of("example value"));
* }
*
- * @param nickNames2 nickNames2
+ * @param nickNames nickNames
* @return current instance of builder
*/
- public PersonDtoBuilder nickNames2(String... nickNames2) {
- this.nickNames2 = changedValue(nickNames2);
+ public PersonDtoBuilder nickNames(ListnickNames in place by applying the given operator, instead of reading it
+ * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
+ * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
+ * value must have been set before (directly or via an existing instance).
+ * Example:
+ *
+ * {@code
+ * builder.nickNames(List.of("example value")).nickNamesUpdate(list -> list.stream().sorted().toList());
+ * }
+ *
+ * @param nickNamesUpdater operator applied to the current value; its result becomes the new value
+ * @return current instance of builder
+ * @throws IllegalStateException if nickNames has not been set yet
+ */
+ public PersonDtoBuilder nickNamesUpdate(UnaryOperator> nickNamesUpdater) {
+ if (!this.nickNames.isSet()) {
+ throw new IllegalStateException("Cannot update 'nickNames' before it is set");
+ }
+ this.nickNames = changedValue(nickNamesUpdater.apply(this.nickNames.value()));
return this;
}
@@ -547,48 +554,41 @@ public PersonDtoBuilder nickNames2(Supplier
nickNames2 in place by applying the given operator, instead of reading it
- * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
- * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
- * value must have been set before (directly or via an existing instance).
+ * Sets the value for nickNames2.
* Example:
+ *
+ * {@code
+ * builder.nickNames2(new String[]{"example value"});
+ * }
+ *
+ * @param nickNames2 nickNames2
* @return current instance of builder
- * @throws IllegalStateException if nickNames2 has not been set yet
*/
- public PersonDtoBuilder nickNames2Update(UnaryOperatornickNames in place by applying the given operator, instead of reading it
+ * Updates the current value of nickNames2 in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
* upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
* value must have been set before (directly or via an existing instance).
* Example:
- *
- * {@code
- * builder.nickNames(List.of("example value")).nickNamesUpdate(list -> list.stream().sorted().toList());
- * }
+ * Generated from setter {@link PersonDto#setNickNames2(String) setNickNames2(String nickNames2)}
*
- * @param nickNamesUpdater operator applied to the current value; its result becomes the new value
+ * @param nickNames2Updater operator applied to the current value; its result becomes the new value
* @return current instance of builder
- * @throws IllegalStateException if nickNames has not been set yet
+ * @throws IllegalStateException if nickNames2 has not been set yet
*/
- public PersonDtoBuilder nickNamesUpdate(UnaryOperator> nickNamesUpdater) {
- if (!this.nickNames.isSet()) {
- throw new IllegalStateException("Cannot update 'nickNames' before it is set");
+ public PersonDtoBuilder nickNames2Update(UnaryOperator
category.
- * Example:
- *
- * {@code
- * builder.category("example value");
- * }
- *
- * @param category category
- * @return current instance of builder
- */
- public ProductRecordBuilder category(String category) {
- this.category = changedValue(category);
- return this;
- }
-
/**
* Sets the value for category by executing the provided consumer.
* category in place by applying the given operator, instead of reading it
- * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
- * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
- * value must have been set before (directly or via an existing instance).
+ * Sets the value for category.
* Example:
*
* {@code
- * builder.category("example value").categoryUpdate(String::trim);
+ * builder.category("example value");
* }
*
- * @param categoryUpdater operator applied to the current value; its result becomes the new value
+ * @param category category
* @return current instance of builder
- * @throws IllegalStateException if category has not been set yet
*/
- public ProductRecordBuilder categoryUpdate(UnaryOperatorname.
+ * Updates the current value of category in place by applying the given operator, instead of reading it
+ * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
+ * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
+ * value must have been set before (directly or via an existing instance).
* Example:
*
* {@code
- * builder.name("example value");
+ * builder.category("example value").categoryUpdate(String::trim);
* }
*
- * @param name name
+ * @param categoryUpdater operator applied to the current value; its result becomes the new value
* @return current instance of builder
+ * @throws IllegalStateException if category has not been set yet
*/
- public ProductRecordBuilder name(String name) {
- this.name = changedValue(name);
+ public ProductRecordBuilder categoryUpdate(UnaryOperatorname.
+ * Example:
+ *
+ * {@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public ProductRecordBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -313,7 +313,7 @@ public ProductRecordBuilder nameUpdate(UnaryOperatorprice.
+ * Sets the value for price by invoking the provided supplier.
* Example:
*
* {@code
- * builder.price(3.14);
+ * builder.price(() -> 3.14);
* }
*
- * @param price price
+ * @param priceSupplier supplier for price
* @return current instance of builder
*/
- public ProductRecordBuilder price(double price) {
- this.price = changedValue(price);
+ public ProductRecordBuilder price(Supplierprice by invoking the provided supplier.
+ * Sets the value for price.
* Example:
*
* {@code
- * builder.price(() -> 3.14);
+ * builder.price(3.14);
* }
*
- * @param priceSupplier supplier for price
+ * @param price price
* @return current instance of builder
*/
- public ProductRecordBuilder price(Supplieractive.
+ * Sets the value for active by invoking the provided supplier.
* Example:
*
* {@code
- * builder.active(true);
+ * builder.active(() -> true);
* }
*
- * @param active active
+ * @param activeSupplier supplier for active
* @return current instance of builder
*/
- public ProductWithDefaultsBuilder active(boolean active) {
- this.active = changedValue(active);
+ public ProductWithDefaultsBuilder active(Supplieractive by invoking the provided supplier.
+ * Sets the value for active.
* Example:
*
* {@code
- * builder.active(() -> true);
+ * builder.active(true);
* }
*
- * @param activeSupplier supplier for active
+ * @param active active
* @return current instance of builder
*/
- public ProductWithDefaultsBuilder active(Suppliercategory.
- * Example:
- *
- * {@code
- * builder.category("example value");
- * }
- *
- * @param category category
- * @return current instance of builder
- */
- public ProductWithDefaultsBuilder category(String category) {
- this.category = changedValue(category);
- return this;
- }
-
/**
* Sets the value for category by executing the provided consumer.
* category in place by applying the given operator, instead of reading it
- * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
- * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
- * value must have been set before (directly or via an existing instance).
+ * Sets the value for category.
* Example:
*
* {@code
- * builder.category("example value").categoryUpdate(String::trim);
+ * builder.category("example value");
* }
*
- * @param categoryUpdater operator applied to the current value; its result becomes the new value
+ * @param category category
* @return current instance of builder
- * @throws IllegalStateException if category has not been set yet
*/
- public ProductWithDefaultsBuilder categoryUpdate(UnaryOperatorname.
+ * Updates the current value of category in place by applying the given operator, instead of reading it
+ * out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
+ * upper-casing, clamping or incrementing, and in combination with the With copy-and-modify flow. The
+ * value must have been set before (directly or via an existing instance).
* Example:
*
* {@code
- * builder.name("example value");
+ * builder.category("example value").categoryUpdate(String::trim);
* }
*
- * @param name name
+ * @param categoryUpdater operator applied to the current value; its result becomes the new value
* @return current instance of builder
+ * @throws IllegalStateException if category has not been set yet
*/
- public ProductWithDefaultsBuilder name(String name) {
- this.name = changedValue(name);
+ public ProductWithDefaultsBuilder categoryUpdate(UnaryOperatorname.
+ * Example:
+ *
+ * {@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public ProductWithDefaultsBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -402,7 +402,7 @@ public ProductWithDefaultsBuilder nameUpdate(UnaryOperatorprice.
+ * Sets the value for price by invoking the provided supplier.
* Example:
*
* {@code
- * builder.price(3.14);
+ * builder.price(() -> 3.14);
* }
*
- * @param price price
+ * @param priceSupplier supplier for price
* @return current instance of builder
*/
- public ProductWithDefaultsBuilder price(double price) {
- this.price = changedValue(price);
+ public ProductWithDefaultsBuilder price(Supplierprice by invoking the provided supplier.
+ * Sets the value for price.
* Example:
*
* {@code
- * builder.price(() -> 3.14);
+ * builder.price(3.14);
* }
*
- * @param priceSupplier supplier for price
+ * @param price price
* @return current instance of builder
*/
- public ProductWithDefaultsBuilder price(Suppliername.
- * Example:
- *
- * {@code
- * builder.name("example value");
- * }
- *
- * @param name name
- * @return current instance of builder
- */
- public SponsorDtoBuilder name(String name) {
- this.name = changedValue(name);
- return this;
- }
-
/**
* Sets the value for name by executing the provided consumer.
* name.
+ * Example:
+ *
+ * {@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public SponsorDtoBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/ScopedOwnerDtoBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/ScopedOwnerDtoBuilder.java
index 9c660869..9abe8e2e 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/ScopedOwnerDtoBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/ScopedOwnerDtoBuilder.java
@@ -87,25 +87,6 @@ public static ScopedOwnerDtoBuilder create() {
return new ScopedOwnerDtoBuilder();
}
- /**
- * Sets the value for library.
- * Example:
- *
- * {@code
- * builder.library(new LibraryHelperDto());
- * }
- *
- * @param library library
- * @return current instance of builder
- */
- public ScopedOwnerDtoBuilder library(LibraryHelperDto library) {
- this.library = changedValue(library);
- return this;
- }
-
/**
* Sets the value for library by executing the provided consumer.
* library.
+ * Example:
+ *
+ * {@code
+ * builder.library(new LibraryHelperDto());
+ * }
+ *
+ * @param library library
+ * @return current instance of builder
+ */
+ public ScopedOwnerDtoBuilder library(LibraryHelperDto library) {
+ this.library = changedValue(library);
+ return this;
+ }
+
/**
* Updates the current value of library in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -160,25 +160,6 @@ public ScopedOwnerDtoBuilder libraryUpdate(UnaryOperatorsponsor.
- * Example:
- *
- * {@code
- * builder.sponsor(new SponsorDto());
- * }
- *
- * @param sponsor sponsor
- * @return current instance of builder
- */
- public ScopedOwnerDtoBuilder sponsor(SponsorDto sponsor) {
- this.sponsor = changedValue(sponsor);
- return this;
- }
-
/**
* Sets the value for sponsor by executing the provided consumer.
* sponsor.
+ * Example:
+ *
+ * {@code
+ * builder.sponsor(new SponsorDto());
+ * }
+ *
+ * @param sponsor sponsor
+ * @return current instance of builder
+ */
+ public ScopedOwnerDtoBuilder sponsor(SponsorDto sponsor) {
+ this.sponsor = changedValue(sponsor);
+ return this;
+ }
+
/**
* Updates the current value of sponsor in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -233,25 +233,6 @@ public ScopedOwnerDtoBuilder sponsorUpdate(UnaryOperatortrusted.
- * Example:
- *
- * {@code
- * builder.trusted(new TrustedHelperDto());
- * }
- *
- * @param trusted trusted
- * @return current instance of builder
- */
- public ScopedOwnerDtoBuilder trusted(TrustedHelperDto trusted) {
- this.trusted = changedValue(trusted);
- return this;
- }
-
/**
* Sets the value for trusted using a builder consumer that produces the value.
* trusted.
+ * Example:
+ *
+ * {@code
+ * builder.trusted(new TrustedHelperDto());
+ * }
+ *
+ * @param trusted trusted
+ * @return current instance of builder
+ */
+ public ScopedOwnerDtoBuilder trusted(TrustedHelperDto trusted) {
+ this.trusted = changedValue(trusted);
+ return this;
+ }
+
/**
* Updates the current value of trusted in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
diff --git a/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/TrustedHelperDtoBuilder.java b/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/TrustedHelperDtoBuilder.java
index c7b643b8..94fdf114 100644
--- a/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/TrustedHelperDtoBuilder.java
+++ b/example/generated-example-builder/org/javahelpers/simple/builders/example/scoping/TrustedHelperDtoBuilder.java
@@ -74,25 +74,6 @@ public static TrustedHelperDtoBuilder create() {
return new TrustedHelperDtoBuilder();
}
- /**
- * Sets the value for name.
- * Example:
- *
- * {@code
- * builder.name("example value");
- * }
- *
- * @param name name
- * @return current instance of builder
- */
- public TrustedHelperDtoBuilder name(String name) {
- this.name = changedValue(name);
- return this;
- }
-
/**
* Sets the value for name by executing the provided consumer.
* name.
+ * Example:
+ *
+ * {@code
+ * builder.name("example value");
+ * }
+ *
+ * @param name name
+ * @return current instance of builder
+ */
+ public TrustedHelperDtoBuilder name(String name) {
+ this.name = changedValue(name);
+ return this;
+ }
+
/**
* Updates the current value of name in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
diff --git a/processor/src/main/java/org/javahelpers/simple/builders/processor/classgen/roaster/RoasterCodeGenerator.java b/processor/src/main/java/org/javahelpers/simple/builders/processor/classgen/roaster/RoasterCodeGenerator.java
index 56d994d7..498a5550 100644
--- a/processor/src/main/java/org/javahelpers/simple/builders/processor/classgen/roaster/RoasterCodeGenerator.java
+++ b/processor/src/main/java/org/javahelpers/simple/builders/processor/classgen/roaster/RoasterCodeGenerator.java
@@ -289,32 +289,19 @@ private void appendMethods(JavaClassSource source, GenerationTargetClassDto clas
* org.javahelpers.simple.builders.processor.processing.BuilderDefinitionCreator#resolveMethodConflicts}.
*
*
- *
- *
- * @param ordering the ordering value (lower values appear first)
- */
- public void setOrdering(int ordering) {
- this.ordering = ordering;
- }
-
- /**
- * Returns the ordering of this method.
- *
- * @return the ordering value
- */
- public int getOrdering() {
- return ordering;
- }
-
/**
* Setting the inner implementation of a method. Supports placeholders which has to be set by
* addArgument.
@@ -329,98 +299,6 @@ public void addAnnotation(AnnotationDto annotation) {
this.annotations.add(annotation);
}
- /**
- * Comparator for sorting MethodDto instances with sophisticated ordering rules.
- *
- *
- *
- */
- public static class MethodComparator implements java.util.Comparatornicknames.
- * Example:
- *
- * {@code
- * builder.add2Nicknames("example value");
- * }
- *
- * @param element the element to add
- * @return current instance of builder
- */
- public PersonDtoBuilder add2Nicknames(String element) {
- ListphoneNumbers.
+ * Sets the value for address using a builder consumer that produces the value.
* Example:
*
* {@code
- * builder.add2PhoneNumbers("example value");
+ * builder.address(addressDtoBuilder -> addressDtoBuilder);
* }
*
- * @param element the element to add
- * @return current instance of builder
- */
- public PersonDtoBuilder add2PhoneNumbers(String element) {
- LinkedListpreviousAddresses.
- * tags.
+ * Sets the value for address by invoking the provided supplier.
* Example:
*
* {@code
- * builder.add2Tags("example value");
+ * builder.address(() -> AddressDtoBuilder.create().build());
* }
*
- * @param element the element to add
+ * @param addressSupplier supplier for address
* @return current instance of builder
*/
- public PersonDtoBuilder add2Tags(String element) {
- Setaddress.
* address using a builder consumer that produces the value.
- * Example:
- *
- * {@code
- * builder.address(addressDtoBuilder -> addressDtoBuilder);
- * }
- *
- * @param addressBuilderConsumer consumer providing an instance of a builder for address
- * @return current instance of builder
- */
- public PersonDtoBuilder address(Consumeraddress by invoking the provided supplier.
- * Example:
- *
- * {@code
- * builder.address(() -> AddressDtoBuilder.create().build());
- * }
- *
- * @param addressSupplier supplier for address
- * @return current instance of builder
- */
- public PersonDtoBuilder address(Supplieraddress in place by applying the given operator, instead of reading it
* out, changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -498,7 +319,7 @@ public PersonDtoBuilder address(Supplierage.
+ * Sets the value for age by invoking the provided supplier.
* Example:
*
* {@code
- * builder.age(42);
+ * builder.age(() -> 42);
* }
*
- * @param age age
+ * @param ageSupplier supplier for age
* @return current instance of builder
*/
- public PersonDtoBuilder age(int age) {
- this.age = changedValue(age);
+ public PersonDtoBuilder age(Supplierage by invoking the provided supplier.
+ * Sets the value for age.
* Example:
*
* {@code
- * builder.age(() -> 42);
+ * builder.age(42);
* }
*
- * @param ageSupplier supplier for age
+ * @param age age
* @return current instance of builder
*/
- public PersonDtoBuilder age(Supplieremail.
* email.
- * Example:
- *
- * {@code
- * builder.email(Optional.of("example value"));
- * }
- *
- * @param email email
- * @return current instance of builder
- */
- public PersonDtoBuilder email(Optionalemail by executing the provided consumer.
* email by invoking the provided supplier.
* email.
+ * Example:
+ *
+ * {@code
+ * builder.email(Optional.of("example value"));
+ * }
+ *
+ * @param email email
+ * @return current instance of builder
+ */
+ public PersonDtoBuilder email(Optionalemail in place by applying the given operator, instead of reading it out,
* changing it and setting it again. Useful for adjustments relative to the current value, e.g. trimming,
@@ -708,7 +529,7 @@ public PersonDtoBuilder email(String format, Object... args) {
* value must have been set before (directly or via an existing instance).
*