diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/ArrayListBuilder.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/ArrayListBuilder.java
new file mode 100644
index 00000000..24cd7bc6
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/ArrayListBuilder.java
@@ -0,0 +1,90 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Generic Builder for Lists. Helperclass for being able to provide functional interfaces in
+ * extending lists. Using ArrayLists inside.
+ *
+ *
Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.builders.ArrayListBuilder} of simple-builders-core so that
+ * codegen-core does not depend on the builders runtime module. The DTO builders committed in this
+ * module must work without forcing a simple-builders-core dependency onto codegen users.
+ *
+ * @param the type of elements in the targeting list
+ */
+public class ArrayListBuilder {
+ private final List mList = new ArrayList<>();
+
+ /** Creates an empty ArrayListBuilder. */
+ public ArrayListBuilder() {}
+
+ /**
+ * Creates an ArrayListBuilder initialized with the elements from the given list.
+ *
+ * @param initialList list to initialize from
+ */
+ public ArrayListBuilder(List initialList) {
+ if (initialList != null) {
+ mList.addAll(initialList);
+ }
+ }
+
+ /**
+ * Appends the element to the end of the internal list. Calling add-function on inner ArrayList
+ * field.
+ *
+ * @param element Element to be appended
+ * @return current instance of ArrayListBuilder for using in stream-notation
+ */
+ public ArrayListBuilder add(T element) {
+ mList.add(element);
+ return this;
+ }
+
+ /**
+ * Appends a list of elements to the end of the internal list. Calling addAll-function on inner
+ * ArrayList field.
+ *
+ * @param elements list of Elements to be appended
+ * @return current instance of ArrayListBuilder for using in stream-notation
+ */
+ public ArrayListBuilder addAll(List elements) {
+ mList.addAll(elements);
+ return this;
+ }
+
+ /**
+ * Builds a new list based on the elements appended by the other functions.
+ *
+ * @return new ArrayList holding all elements which have been added before
+ */
+ public List build() {
+ return new ArrayList<>(mList);
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/ArrayListBuilderWithElementBuilders.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/ArrayListBuilderWithElementBuilders.java
new file mode 100644
index 00000000..07342916
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/ArrayListBuilderWithElementBuilders.java
@@ -0,0 +1,117 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import java.util.List;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+/**
+ * Enhanced builder for Lists that supports adding elements via builder consumers. This class
+ * extends {@link ArrayListBuilder} and adds methods to accept {@link Consumer} functions that
+ * configure element builders, eliminating the need to manually call {@code build()} on each element
+ * builder.
+ *
+ * Example usage:
+ *
+ *
{@code
+ * List people = new ArrayListBuilderWithElementBuilders<>(PersonBuilder::create)
+ * .add(personBuilder -> personBuilder
+ * .name("John Doe")
+ * .age(30))
+ * .add(personBuilder -> personBuilder
+ * .name("Jane Smith")
+ * .age(25))
+ * .build();
+ * }
+ *
+ * Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.builders.ArrayListBuilderWithElementBuilders} of
+ * simple-builders-core so that codegen-core does not depend on the builders runtime module. The DTO
+ * builders committed in this module must work without forcing a simple-builders-core dependency
+ * onto codegen users.
+ *
+ * @param the type of elements in the targeting list
+ * @param the type of builder used to create elements, must implement {@link IBuilderBase} and
+ * building objects of type T
+ */
+public class ArrayListBuilderWithElementBuilders>
+ extends ArrayListBuilder {
+ private final Supplier elementBuilderProvider;
+
+ /**
+ * Creates an empty ArrayListBuilderWithElementBuilders.
+ *
+ * @param elementBuilderProvider supplier that provides new instances of element builders
+ */
+ public ArrayListBuilderWithElementBuilders(Supplier elementBuilderProvider) {
+ this.elementBuilderProvider = elementBuilderProvider;
+ }
+
+ /**
+ * Creates an ArrayListBuilderWithElementBuilders initialized with the elements from the given
+ * list.
+ *
+ * @param initialList list to initialize from
+ * @param elementBuilderProvider supplier that provides new instances of element builders
+ */
+ public ArrayListBuilderWithElementBuilders(
+ List initialList, Supplier elementBuilderProvider) {
+ super(initialList);
+ this.elementBuilderProvider = elementBuilderProvider;
+ }
+
+ /**
+ * Adds an element to the list by providing a consumer that configures an element builder. The
+ * builder is automatically created using the elementBuilderProvider and built after
+ * configuration.
+ *
+ * @param elementBuilderConsumer consumer that configures the element builder
+ * @return this builder instance for method chaining
+ */
+ public ArrayListBuilderWithElementBuilders add(Consumer elementBuilderConsumer) {
+ B elementBuilder = elementBuilderProvider.get();
+ elementBuilderConsumer.accept(elementBuilder);
+ super.add(elementBuilder.build());
+ return this;
+ }
+
+ /**
+ * Adds multiple elements to the list by providing consumers that configure element builders. Each
+ * builder is automatically created using the elementBuilderProvider and built after
+ * configuration.
+ *
+ * @param elementBuilderConsumers varargs of consumers that configure element builders
+ * @return this builder instance for method chaining
+ */
+ @SafeVarargs
+ public final ArrayListBuilderWithElementBuilders add(
+ Consumer... elementBuilderConsumers) {
+ for (Consumer elementBuilderConsumer : elementBuilderConsumers) {
+ this.add(elementBuilderConsumer);
+ }
+ return this;
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/BuilderToStringStyle.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/BuilderToStringStyle.java
new file mode 100644
index 00000000..933157f4
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/BuilderToStringStyle.java
@@ -0,0 +1,63 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * Custom ToStringStyle for builders that automatically handles TrackedValue fields. This style only
+ * includes fields that have been set (TrackedValue.isSet() returns true) and unwraps their values
+ * automatically.
+ *
+ * Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.util.BuilderToStringStyle} of simple-builders-core so that
+ * codegen-core does not depend on the builders runtime module. The DTO builders committed in this
+ * module must work without forcing a simple-builders-core dependency onto codegen users.
+ */
+public class BuilderToStringStyle extends ToStringStyle {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final BuilderToStringStyle INSTANCE = new BuilderToStringStyle();
+
+ public BuilderToStringStyle() {
+ super();
+ this.setUseClassName(true);
+ this.setUseIdentityHashCode(false);
+ }
+
+ // Overrides ToStringStyle.append to unwrap TrackedValue fields; the signature must match the
+ // overridden method. codeql[java/confusing-method-signature]
+ @Override
+ public void append(StringBuffer buffer, String fieldName, Object value, Boolean fullDetail) {
+ if (value instanceof TrackedValue> trackedValue) {
+ if (trackedValue.isSet()) {
+ super.append(buffer, fieldName, trackedValue.value(), fullDetail);
+ }
+ } else {
+ super.append(buffer, fieldName, value, fullDetail);
+ }
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashMapBuilder.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashMapBuilder.java
new file mode 100644
index 00000000..533a13a9
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashMapBuilder.java
@@ -0,0 +1,122 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Generic Builder for Maps. Helperclass for being able to provide functional interfaces in
+ * extending maps. Using HashMap inside.
+ *
+ *
Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.builders.HashMapBuilder} of simple-builders-core so that
+ * codegen-core does not depend on the builders runtime module. The DTO builders committed in this
+ * module must work without forcing a simple-builders-core dependency onto codegen users.
+ *
+ * @param the type of keys in the targeting map
+ * @param the type of values in the targeting map
+ */
+public class HashMapBuilder {
+ private final Map mMap = new HashMap<>();
+
+ /** Creates an empty HashMapBuilder. */
+ public HashMapBuilder() {}
+
+ /**
+ * Creates a HashMapBuilder initialized with the mappings from the given map.
+ *
+ * @param initialMap map to initialize from
+ */
+ public HashMapBuilder(Map initialMap) {
+ if (initialMap != null) {
+ mMap.putAll(initialMap);
+ }
+ }
+
+ /**
+ * Associates the specified value with the specified key in this map. Using an inner HashMap
+ * implementation. If the key already exists in the map, the old value is replaced.
+ *
+ * @param key key with which the specified value is to be associated
+ * @param value value to be associated with the specified key
+ * @return Current instance of HashMapBuilder for using in stream-notation
+ */
+ public HashMapBuilder put(K key, V value) {
+ mMap.put(key, value);
+ return this;
+ }
+
+ /**
+ * Associates the specified value with the specified key in this map, if the specified key is not
+ * already associated. Using an inner HashMap implementation. If {@code null} is associated with
+ * the specific key, it will be replaced.
+ *
+ * @param key key with which the specified value is to be associated
+ * @param value value to be associated with the specified key
+ * @return Current instance of HashMapBuilder for using in stream-notation
+ */
+ public HashMapBuilder putIfAbsent(K key, V value) {
+ mMap.putIfAbsent(key, value);
+ return this;
+ }
+
+ /**
+ * Associates the specified value with the specified key in this map, if the specified value is
+ * not null. Using an inner HashMap implementation.
+ *
+ * @param key key with which the specified value is to be associated
+ * @param value value to be associated with the specified key
+ * @return Current instance of HashMapBuilder for using in stream-notation
+ */
+ public HashMapBuilder putIfValueNotNull(K key, V value) {
+ if (value != null) {
+ mMap.put(key, value);
+ }
+ return this;
+ }
+
+ /**
+ * Copies all of the mappings from the specified map to the inner map of Builder. Using an inner
+ * HashMap implementation. These mappings will replace any mappings that the inner map of
+ * HashMapBuilder had before.
+ *
+ * @param pMap mappings to be added to HashMapBuilder
+ * @return Current instance of HashMapBuilder for method chaining
+ */
+ public HashMapBuilder putAll(Map pMap) {
+ mMap.putAll(pMap);
+ return this;
+ }
+
+ /**
+ * Builds a new Map based on the mappings defined by the other functions.
+ *
+ * @return new HashMap holding all mappings which have been defined before
+ */
+ public Map build() {
+ return new HashMap<>(mMap);
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashSetBuilder.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashSetBuilder.java
new file mode 100644
index 00000000..4b4a7d3f
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashSetBuilder.java
@@ -0,0 +1,90 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Generic Builder for Sets. Helperclass for being able to provide stream-notation interfaces in
+ * extending setws. Using HashSet inside.
+ *
+ * Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.builders.HashSetBuilder} of simple-builders-core so that
+ * codegen-core does not depend on the builders runtime module. The DTO builders committed in this
+ * module must work without forcing a simple-builders-core dependency onto codegen users.
+ *
+ * @param the type of elements in the targeting Set
+ */
+public class HashSetBuilder {
+ private final Set mSet = new HashSet<>();
+
+ /** Creates an empty HashSetBuilder. */
+ public HashSetBuilder() {}
+
+ /**
+ * Creates a HashSetBuilder initialized with the elements from the given set.
+ *
+ * @param initialSet set to initialize from
+ */
+ public HashSetBuilder(Set initialSet) {
+ if (initialSet != null) {
+ mSet.addAll(initialSet);
+ }
+ }
+
+ /**
+ * Appends the element to the internal set. Calling add-function on inner HashSet field.
+ *
+ * @param element element to be appended
+ * @return current instance of ArrayListBuilder for using in stream-notation
+ */
+ public HashSetBuilder add(T element) {
+ mSet.add(element);
+ return this;
+ }
+
+ /**
+ * Appends a list of elements to the end of the internal list. Calling addAll-function on inner
+ * HashSet field.
+ *
+ * @param elements Set of elements to be appended
+ * @return current instance of HashSetBuilder for using in stream-notation
+ */
+ public HashSetBuilder addAll(Set elements) {
+ mSet.addAll(elements);
+ return this;
+ }
+
+ /**
+ * Builds a new Set containing all elements that have been added to this builder. The returned Set
+ * is a new instance, so subsequent modifications to the builder will not affect the returned Set.
+ *
+ * @return a new HashSet containing all elements added to this builder
+ */
+ public Set build() {
+ return new HashSet<>(mSet);
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashSetBuilderWithElementBuilders.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashSetBuilderWithElementBuilders.java
new file mode 100644
index 00000000..92de0ab2
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/HashSetBuilderWithElementBuilders.java
@@ -0,0 +1,113 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+/**
+ * Enhanced builder for Sets that supports adding elements via builder consumers. This class extends
+ * {@link HashSetBuilder} and adds methods to accept {@link Consumer} functions that configure
+ * element builders, eliminating the need to manually call {@code build()} on each element builder.
+ *
+ * Example usage:
+ *
+ *
{@code
+ * Set people = new HashSetBuilderWithElementBuilders<>(PersonBuilder::create)
+ * .add(personBuilder -> personBuilder
+ * .name("John Doe")
+ * .age(30))
+ * .add(personBuilder -> personBuilder
+ * .name("Jane Smith")
+ * .age(25))
+ * .build();
+ * }
+ *
+ * Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.builders.HashSetBuilderWithElementBuilders} of
+ * simple-builders-core so that codegen-core does not depend on the builders runtime module. The DTO
+ * builders committed in this module must work without forcing a simple-builders-core dependency
+ * onto codegen users.
+ *
+ * @param the type of elements in the targeting set
+ * @param the type of builder used to create elements, must implement {@link IBuilderBase} and
+ * building objects of type T
+ */
+public class HashSetBuilderWithElementBuilders>
+ extends HashSetBuilder {
+ private final Supplier elementBuilderProvider;
+
+ /**
+ * Creates an empty HashSetBuilderWithElementBuilders.
+ *
+ * @param elementBuilderProvider supplier that provides new instances of element builders
+ */
+ public HashSetBuilderWithElementBuilders(Supplier elementBuilderProvider) {
+ this.elementBuilderProvider = elementBuilderProvider;
+ }
+
+ /**
+ * Creates a HashSetBuilderWithElementBuilders initialized with the elements from the given set.
+ *
+ * @param initialSet set to initialize from
+ * @param elementBuilderProvider supplier that provides new instances of element builders
+ */
+ public HashSetBuilderWithElementBuilders(Set initialSet, Supplier elementBuilderProvider) {
+ super(initialSet);
+ this.elementBuilderProvider = elementBuilderProvider;
+ }
+
+ /**
+ * Adds an element to the set by providing a consumer that configures an element builder. The
+ * builder is automatically created using the elementBuilderProvider and built after
+ * configuration.
+ *
+ * @param elementBuilderConsumer consumer that configures the element builder
+ * @return this builder instance for method chaining
+ */
+ public HashSetBuilderWithElementBuilders add(Consumer elementBuilderConsumer) {
+ B elementBuilder = elementBuilderProvider.get();
+ elementBuilderConsumer.accept(elementBuilder);
+ super.add(elementBuilder.build());
+ return this;
+ }
+
+ /**
+ * Adds multiple elements to the set by providing consumers that configure element builders. Each
+ * builder is automatically created using the elementBuilderProvider and built after
+ * configuration.
+ *
+ * @param elementBuilderConsumers varargs of consumers that configure element builders
+ * @return this builder instance for method chaining
+ */
+ @SafeVarargs
+ public final HashSetBuilderWithElementBuilders add(Consumer... elementBuilderConsumers) {
+ for (Consumer elementBuilderConsumer : elementBuilderConsumers) {
+ this.add(elementBuilderConsumer);
+ }
+ return this;
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/IBuilderBase.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/IBuilderBase.java
new file mode 100644
index 00000000..30b48f91
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/IBuilderBase.java
@@ -0,0 +1,44 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+/**
+ * Interface for all generated builders.
+ *
+ * Origin: copied from {@code
+ * org.javahelpers.simple.builders.core.interfaces.IBuilderBase} of simple-builders-core so that
+ * codegen-core does not depend on the builders runtime module. The DTO builders committed in this
+ * module must work without forcing a simple-builders-core dependency onto codegen users.
+ *
+ * @param the type of build instances
+ */
+public interface IBuilderBase {
+ /**
+ * Baseinterface for all builders.
+ *
+ * @return building target of builder
+ */
+ T build();
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/builders/TrackedValue.java b/codegen-core/src/main/java/org/javahelpers/codegen/builders/TrackedValue.java
new file mode 100644
index 00000000..68275757
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/builders/TrackedValue.java
@@ -0,0 +1,154 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.builders;
+
+import java.util.function.Consumer;
+
+/**
+ * Represents a value together with a flag indicating whether it has been explicitly changed.
+ *
+ * This utility is used by generated builders to differentiate between:
+ *
+ *
+ * - an unset value (no change made),
+ *
- an initial value (derived from an existing instance), and
+ *
- a changed value (explicitly set via a builder method).
+ *
+ *
+ * The {@code isChanged} flag controls whether setter invocations should be performed during {@code
+ * build()}; only changed values are applied.
+ *
+ * Origin: copied from {@code org.javahelpers.simple.builders.core.util.TrackedValue} of
+ * simple-builders-core so that codegen-core does not depend on the builders runtime module. The DTO
+ * builders committed in this module must work without forcing a simple-builders-core dependency
+ * onto codegen users.
+ *
+ * @param the value type
+ * @param value the underlying value (may be {@code null})
+ * @param isChanged whether the value was explicitly changed by the builder API
+ * @param isInitial whether the value is an initial value from an existing instance
+ */
+public record TrackedValue(T value, boolean isChanged, boolean isInitial) {
+
+ /**
+ * Checks if this value has been set (either as initial value or changed).
+ *
+ * @return true if the value is set (initial or changed), false if unset
+ */
+ public boolean isSet() {
+ return isChanged || isInitial;
+ }
+
+ /**
+ * Returns the value if set, otherwise the given default.
+ *
+ * @param defaultValue the default to return if unset
+ * @return the value if set, otherwise the default
+ */
+ public T valueOr(T defaultValue) {
+ return isSet() ? value : defaultValue;
+ }
+
+ /**
+ * Executes the provided {@link Consumer} only if this value has been set (initial value or
+ * changed). Returns a {@link DefaultValueApplier} that can fluently provide a default via {@code
+ * .orElse(default)} if the value was unset.
+ *
+ * Existing code that ignores the return value (e.g. {@code tracked.ifSet(consumer);})
+ * continues to work unchanged.
+ *
+ * @param consumer action to perform with the current {@link #value()}
+ * @return a {@link DefaultValueApplier} for fluent default handling
+ */
+ public DefaultValueApplier ifSet(Consumer consumer) {
+ if (isSet()) {
+ consumer.accept(value);
+ }
+ return new DefaultValueApplier<>(isSet(), consumer);
+ }
+
+ /**
+ * Intermediate result returned by {@link #ifSet(Consumer)} to support fluent default-value
+ * application via {@code .orElse(default)}.
+ *
+ * When {@link #ifSet(Consumer)} is called on a set {@link TrackedValue}, the consumer is
+ * invoked immediately and {@code alreadyApplied} is {@code true}, making the subsequent {@link
+ * #orElse(Object)} call a no-op. When called on an unset value, the consumer is not invoked and
+ * {@code alreadyApplied} is {@code false}, so {@link #orElse(Object)} applies the default value
+ * to the same consumer.
+ *
+ * @param the value type
+ * @param alreadyApplied whether the consumer has already been invoked
+ * @param consumer the consumer to apply the default value to if not already applied
+ */
+ public record DefaultValueApplier(boolean alreadyApplied, Consumer consumer) {
+
+ /**
+ * Applies the given default value to the consumer if the original value was unset.
+ *
+ * @param defaultValue the default value to apply
+ */
+ public void orElse(T defaultValue) {
+ if (!alreadyApplied) {
+ consumer.accept(defaultValue);
+ }
+ }
+ }
+
+ /**
+ * Creates a tracked value representing an unset state (no change made).
+ *
+ * @param the value type
+ * @return an instance with {@code value == null}, {@code isChanged == false}, and {@code
+ * isInitial == false}
+ */
+ public static TrackedValue unsetValue() {
+ return new TrackedValue<>(null, false, false);
+ }
+
+ /**
+ * Creates a tracked value representing an initial value copied from an existing instance. The
+ * value is present but is not considered a change initiated by the builder.
+ *
+ * @param the value type
+ * @param value the initial value (may be {@code null})
+ * @return an instance with the given value, {@code isChanged == false}, and {@code isInitial ==
+ * true}
+ */
+ public static TrackedValue initialValue(T value) {
+ return new TrackedValue<>(value, false, true);
+ }
+
+ /**
+ * Creates a tracked value representing an explicit change performed via the builder API.
+ *
+ * @param the value type
+ * @param value the changed value (may be {@code null})
+ * @return an instance with the given value and {@code isChanged == true}
+ */
+ public static TrackedValue changedValue(T value) {
+ return new TrackedValue<>(value, true, false);
+ }
+}
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDto.java b/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDto.java
index 73bfc2a8..9f0fff49 100644
--- a/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDto.java
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDto.java
@@ -26,6 +26,7 @@
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Objects;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.javahelpers.codegen.model.type.TypeName;
@@ -34,7 +35,8 @@
* DTO representing an annotation to be generated in the output class. Contains the annotation type
* and its members in a plain format suitable for code generation.
*/
-public class AnnotationDto {
+public class AnnotationDto implements AnnotationDtoBuilder.With {
+
/** The annotation type (fully qualified name). */
private TypeName annotationType;
@@ -82,6 +84,18 @@ public void addMember(String name, String value) {
this.members.put(name, value);
}
+ /**
+ * Replaces members with the given collection; the DTO retains its own mutable collection.
+ *
+ * @param members the replacement collection (not null)
+ * @throws NullPointerException if members is null
+ */
+ public void setMembers(Map members) {
+ Map copy = new LinkedHashMap<>(Objects.requireNonNull(members));
+ this.members.clear();
+ this.members.putAll(copy);
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
diff --git a/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDtoBuilder.java b/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDtoBuilder.java
new file mode 100644
index 00000000..dc1c0d3b
--- /dev/null
+++ b/codegen-core/src/main/java/org/javahelpers/codegen/model/annotation/AnnotationDtoBuilder.java
@@ -0,0 +1,346 @@
+/*
+ * MIT License
+ *
+ * Copyright (c) 2025-2026 Andreas Igel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.javahelpers.codegen.model.annotation;
+
+import static org.javahelpers.codegen.builders.TrackedValue.changedValue;
+import static org.javahelpers.codegen.builders.TrackedValue.initialValue;
+import static org.javahelpers.codegen.builders.TrackedValue.unsetValue;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.function.BooleanSupplier;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.javahelpers.codegen.builders.BuilderToStringStyle;
+import org.javahelpers.codegen.builders.HashMapBuilder;
+import org.javahelpers.codegen.builders.IBuilderBase;
+import org.javahelpers.codegen.builders.TrackedValue;
+import org.javahelpers.codegen.model.type.TypeName;
+
+/**
+ * Builder for {@code org.javahelpers.codegen.model.annotation.AnnotationDto}.
+ *
+ * This builder provides a fluent API for creating instances of
+ * org.javahelpers.codegen.model.annotation.AnnotationDto with method chaining and validation. Use
+ * the static {@code create()} method to obtain a new builder instance, configure the desired
+ * properties using the setter methods, and then call {@code build()} to create the final DTO.
+ *
+ *
Example:
+ *
+ * {@code
+ * AnnotationDto result = AnnotationDtoBuilder.create()
+ * .members(Map.of("example members", "example members"))
+ * .members(() -> Map.of("example members", "example members"))
+ * .members(Map.entry("key", "example members"))
+ * .build();
+ * }
+ */
+public class AnnotationDtoBuilder implements IBuilderBase {
+
+ /** Tracked value for annotationType: the type of the annotation. */
+ private TrackedValue annotationType = unsetValue();
+
+ /** Tracked value for members: the replacement collection (not null). */
+ private TrackedValue