Add @Ignore4BuilderGeneration opt-out for DTO builder generation - #242
Open
AndreasIgel wants to merge 1 commit into
Open
Add @Ignore4BuilderGeneration opt-out for DTO builder generation#242AndreasIgel wants to merge 1 commit into
AndreasIgel wants to merge 1 commit into
Conversation
- new TYPE-level annotation @Ignore4BuilderGeneration with CLASS retention - BuilderProcessor filters out elements carrying the annotation directly, logging a debug message; inheritance not checked so it does not cascade - JavaLangMapper skips builder type and element-builder references for opted-out TypeElements, preventing other DTOs from emitting nested-builder consumers for them - add Ignore4BuilderGenerationTest covering inherited template opt-out, referenced opted-out field fallback, and regression for normal DTOs - document in CONFIGURATION.md and SimpleBuilder class-level Javadoc Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
devin-ai-integration
Bot
force-pushed
the
feature/ignore4builder-generation
branch
from
August 9, 2026 13:45
44ad09d to
f78aaee
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
Introduces
@Ignore4BuilderGenerationso a class/record can opt out of builder generation even when it inherits@SimpleBuilderor an@SimpleBuilder.Templateannotation from a parent type. Opted-out DTOs are treated as "no builder available", so other builders fall back to plain setters instead of emitting nested-builder consumers that would reference a non-existent builder.What's changed
org.javahelpers.simple.builders.core.annotations.Ignore4BuilderGeneration@Target(ElementType.TYPE),@Retention(RetentionPolicy.CLASS)@Inherited; it suppresses only the exact type it is placed on.BuilderProcessor.process(...)now filters theelementsToProcessset, removing any element that directly carries@Ignore4BuilderGenerationand logging a debug message. The check uses the element's own annotation mirrors, so a parent's opt-out never leaks to subclasses.JavaLangMappercentralises the "no builder" decision:setBuilderTypeIfAnnotated(...)returns early for@Ignore4BuilderGenerationtypes.setElementBuilderTypeForGenericCollections(...)likewise skips element-builder generation when the element type is opted out.Ignore4BuilderGenerationTestwith three scenarios:@Inherited@SimpleBuilder.Templatefrom its parent and is annotated with@Ignore4BuilderGeneration— parent's builder is generated, child's is not.@Ignore4BuilderGeneration— the referencing builder uses a plainignored(IgnoredDto)setter and does not mentionIgnoredDtoBuilderorConsumer<IgnoredDtoBuilder>.docs/CONFIGURATION.md: new "Excluding Types from Builder Generation" section.SimpleBuilderclass-level Javadoc: added related-annotations summary linking toIgnoreInBuilderandIgnore4BuilderGeneration.mvn clean verifypasses for the full project and all 286 processor tests pass.