Repository navigation
feat: derive String Javadoc example values from field names (#412) - #428
Merged
AndreasIgel merged 14 commits intoNov 23, 2026
Merged
AndreasIgel merged 14 commits into
AndreasIgel merged 14 commits into
Conversation
This was referenced Nov 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
AndreasIgel
reviewed
Nov 23, 2026
Parameterize over all primitives, wrappers, common JDK types, collection, map, array, Optional, empty-constructor and builder-backed examples, plus the unsupported-type cases.
Decouples the example-value resolver from processor types: the builder resolver now yields the snippet String directly instead of a ResolvedBuilder, so the class fits the generic codegen util package. The processor call sites adapt their ResolvedBuilder resolvers via MethodGeneratorUtil.builderBackedExample.
AndreasIgel
reviewed
Nov 23, 2026
AndreasIgel
reviewed
Nov 23, 2026
…t/Generic and inline builderBackedExample - TypeNameList.of / TypeNameSet.of for single element types (TypeName and Class overloads) - TypeNameGeneric.of for Class and TypeName varargs - JavadocExampleValuesTest uses the factories instead of private helpers - builderBackedExample inlined into builderBackedExampleResolver
AndreasIgel
reviewed
Nov 23, 2026
|
devin-ai-integration Bot
added a commit
to igel-devin-ai/simple-builders-devin-fork
that referenced
this pull request
Nov 24, 2026
…oved to codegen-core in java-helpers#428)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Closes #412.
Generated Javadoc String examples now derive from the field name (
.category("example category")) instead of the single"example value"constant — the prefixed variant from the issue's open point. Types with a resolved builder now render a builder-backed example (.sponsor(SponsorDtoBuilder.create().build())).Changes
JavadocExampleValuesmoved tocodegen-core(org.javahelpers.codegen.util, next toImportCollector):getExampleValue(TypeName, String fieldName, Function<TypeName, Optional<String>> exampleResolver)— only the String case uses the name; nested cases (List/Set/array elements, Optional inner, Map value — not the key) pass it through;null/blank falls back to"example value";resolveCustomExampleis the terminal fallback.MethodGeneratorUtil.builderBackedExampleResolver(builderResolver);UpdateHelperGeneratorpassescontext::resolveBuilderTypeas a method reference.addExampleChainFragment*overloads and their callers ingenerators/field/*receivefield.getOriginalFieldName()(not the builder method name, sosetterPrefixis not included).of()factories on the TypeName model:TypeNameList.of,TypeNameSet.of,TypeNameMap.of,TypeNameGeneric.of,TypeNameArray.of(Class and/or TypeName overloads); matching constructor call sites switched to them. The former constructors stay —JavaLangMapperneeds them to build from the mirror's raw type, and raw/unparameterized cases can't be expressed throughof."Hello %s", "World",sb.append("text"), Map key"key").JavadocExampleValuesTestcovers every supported value kind — all primitives/wrappers, common JDK types, List/Set/Map/array/Optional, empty-constructor and builder-backed — plus negative cases.example/generated-example-builder/tree regenerated.Verified:
mvn clean verifypasses; generated tree is in sync.