Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
209deae
feat: derive String Javadoc example values from field names (#412)
AndreasIgelCC Nov 18, 2026
112fa4a
feat: generate fluent builders for codegen model DTOs (#415)
AndreasIgelCC Nov 18, 2026
548373a
fix: do not abort generation on reserved-word property names (#418)
AndreasIgelCC Nov 21, 2026
6c9d39d
Require field names for Javadoc example value helpers
devin-ai-integration[bot] Nov 22, 2026
6aab31d
fix: derive reserved builder property names from getters
devin-ai-integration[bot] Nov 22, 2026
8d92286
Merge reserved property naming dependency for DTO builders
devin-ai-integration[bot] Nov 22, 2026
e2ae12f
Merge field-name example dependency for DTO builders
devin-ai-integration[bot] Nov 22, 2026
f9a8d39
fix: preserve wildcard type arguments in generated builders
devin-ai-integration[bot] Nov 22, 2026
ece0289
Merge wildcard type argument prerequisite for DTO builders
devin-ai-integration[bot] Nov 22, 2026
60ed4ef
feat: complete and reproducibly regenerate codegen DTO builders
devin-ai-integration[bot] Nov 22, 2026
e76889d
Merge remote-tracking branch 'upstream/main' into feat/issue-415-code…
devin-ai-integration[bot] Nov 22, 2026
29936cf
Merge remote-tracking branch 'upstream/main' into feat/issue-415-code…
devin-ai-integration[bot] Nov 23, 2026
960c5d5
codegen-core: copy needed core runtime classes, drop simple-builders-…
devin-ai-integration[bot] Nov 24, 2026
c118e2c
codegen-core: drop @Generated/@BuilderImplementation from committed D…
devin-ai-integration[bot] Nov 24, 2026
42743a4
codegen-core: TypeName convenience overloads + one-stream builder test
devin-ai-integration[bot] Nov 24, 2026
2a8370e
codegen-core: DTOs implement their builder's With interface
devin-ai-integration[bot] Nov 24, 2026
cbeb930
Merge remote-tracking branch 'upstream/main' into feat/issue-415-code…
devin-ai-integration[bot] Nov 24, 2026
31083f0
merge upstream/main; drop stale processor JavadocExampleValuesTest (m…
devin-ai-integration[bot] Nov 24, 2026
f8e7037
processor: add committed builders for internal DTOs
devin-ai-integration[bot] Nov 24, 2026
350149a
builders: add Class-based overloads for TypeName setters
devin-ai-integration[bot] Nov 24, 2026
b25a6c5
builders: add type-specific shortcuts for TypeName setters
devin-ai-integration[bot] Nov 24, 2026
d02f70f
Use streamed DTO builders for all GenerationTargetClassDto test fixtures
devin-ai-integration[bot] Nov 24, 2026
af1d0f4
Use simple-builders-core helpers in processor DTO builders
devin-ai-integration[bot] Nov 24, 2026
964850b
Drop defensive copy in collection setters; guard self-assignment instead
devin-ai-integration[bot] Nov 24, 2026
1ca6b7f
Processor DTO builders: collection suites, setX setters, TypeName sho…
devin-ai-integration[bot] Nov 24, 2026
e7ff406
refactor(processor): construct DTOs via streamed XxxDtoBuilder API at…
devin-ai-integration[bot] Nov 24, 2026
5710b0a
docs(codegen-core): note origin and reason on classes copied from sim…
devin-ai-integration[bot] Nov 24, 2026
6dbbb9b
docs(codegen-core): fix javadoc tag order on copied-class origin notes
devin-ai-integration[bot] Nov 24, 2026
cca66b9
refactor(codegen-core): flatten copied helper package, add import/mem…
devin-ai-integration[bot] Nov 24, 2026
97e2bce
test(codegen-core): use star imports per project convention in Codege…
devin-ai-integration[bot] Nov 24, 2026
4e24e15
refactor(simple-processor): construct DTOs via XxxDtoBuilder in mappe…
devin-ai-integration[bot] Nov 24, 2026
2377bf3
fix: add missing license header, revert redundant ImportCollector wil…
devin-ai-integration[bot] Nov 24, 2026
1e27d49
refactor: flat single-element/varargs consumer API for DTO builders
devin-ai-integration[bot] Nov 24, 2026
194a4f3
fix: preserve argument order in set-valued varargs builder methods
devin-ai-integration[bot] Nov 25, 2026
232209d
refactor: remove xUpdate methods from committed DTO builders
devin-ai-integration[bot] Nov 25, 2026
def6302
chore: broaden sonar cpd exclusions to whole model packages
devin-ai-integration[bot] Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
*
* <p><b>Origin:</b> 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 <T> the type of elements in the targeting list
*/
public class ArrayListBuilder<T> {
private final List<T> 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<T> 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<T> 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<T> addAll(List<T> 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<T> build() {
return new ArrayList<>(mList);
}
}
Original file line number Diff line number Diff line change
@@ -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.
*
* <p>Example usage:
*
* <pre>{@code
* List<Person> people = new ArrayListBuilderWithElementBuilders<>(PersonBuilder::create)
* .add(personBuilder -> personBuilder
* .name("John Doe")
* .age(30))
* .add(personBuilder -> personBuilder
* .name("Jane Smith")
* .age(25))
* .build();
* }</pre>
*
* <p><b>Origin:</b> 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 <T> the type of elements in the targeting list
* @param <B> the type of builder used to create elements, must implement {@link IBuilderBase} and
* building objects of type T
*/
public class ArrayListBuilderWithElementBuilders<T, B extends IBuilderBase<T>>
extends ArrayListBuilder<T> {
private final Supplier<B> elementBuilderProvider;

/**
* Creates an empty ArrayListBuilderWithElementBuilders.
*
* @param elementBuilderProvider supplier that provides new instances of element builders
*/
public ArrayListBuilderWithElementBuilders(Supplier<B> 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<T> initialList, Supplier<B> 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<T, B> add(Consumer<B> 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<T, B> add(
Consumer<B>... elementBuilderConsumers) {
for (Consumer<B> elementBuilderConsumer : elementBuilderConsumers) {
this.add(elementBuilderConsumer);
}
return this;
}
}
Original file line number Diff line number Diff line change
@@ -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.
*
* <p><b>Origin:</b> 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) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be an exact @Override: ReflectionToStringBuilder dispatches to append(StringBuffer, String, Object, Boolean) and the style intercepts that call to unwrap TrackedValue fields (only set values are rendered). Renaming would silently break the mechanism — callers reach it through the supertype signature by design. Suppressed inline with codeql[java/confusing-method-signature] plus a justification comment.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead drop this format here and just use the default style. Tracker value style should be solved in toString method of trackedvalue!?

if (value instanceof TrackedValue<?> trackedValue) {
if (trackedValue.isSet()) {
super.append(buffer, fieldName, trackedValue.value(), fullDetail);
}
} else {
super.append(buffer, fieldName, value, fullDetail);
}
}
}
Original file line number Diff line number Diff line change
@@ -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.
*
* <p><b>Origin:</b> 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 <K> the type of keys in the targeting map
* @param <V> the type of values in the targeting map
*/
public class HashMapBuilder<K, V> {
private final Map<K, V> 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<K, V> 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<K, V> 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<K, V> 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<K, V> 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<K, V> putAll(Map<K, V> 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<K, V> build() {
return new HashMap<>(mMap);
}
}
Loading