Motivation
Right now, tests and users that want a "minimal" builder must create a custom template and explicitly disable every optional feature. A dedicated built-in @SimpleMinimalBuilder annotation would make this common use-case a one-liner and give the project a canonical example of a template-based builder preset.
Proposed Solution
Introduce a new public annotation in core:
@SimpleBuilder.Template(options = @SimpleBuilder.Options(
generateFieldSupplier = OptionState.DISABLED,
generateFieldConsumer = OptionState.DISABLED,
generateBuilderConsumer = OptionState.DISABLED,
generateConditionalHelper = OptionState.DISABLED,
generateVarArgsHelpers = OptionState.DISABLED,
generateStringFormatHelpers = OptionState.DISABLED,
generateAddToCollectionHelpers = OptionState.DISABLED,
generateUnboxedOptional = OptionState.DISABLED,
generateWithInterface = OptionState.DISABLED,
usingArrayListBuilder = OptionState.DISABLED,
usingArrayListBuilderWithElementBuilders = OptionState.DISABLED,
usingHashSetBuilder = OptionState.DISABLED,
usingHashSetBuilderWithElementBuilders = OptionState.DISABLED,
usingHashMapBuilder = OptionState.DISABLED,
usingGeneratedAnnotation = OptionState.DISABLED,
usingBuilderImplementationAnnotation = OptionState.DISABLED,
usingJacksonDeserializerAnnotation = OptionState.DISABLED,
generateJacksonModule = OptionState.DISABLED,
builderSuffix = "MinimalBuilder",
setterSuffix = ""
))
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
@Inherited
public @interface SimpleMinimalBuilder {}
The exact name can be discussed (SimpleMinimalBuilder, MinimalBuilder, @SimpleBuilder.Minimal, etc.).
Requirements
-
Annotation definition (core/src/main/java/.../SimpleMinimalBuilder.java)
- Must be implemented purely as a
@SimpleBuilder.Template with all optional features disabled.
- Must be
@Inherited so subclasses get a builder too.
-
Dedicated test class (processor/src/test/java/.../SimpleMinimalBuilderTest.java)
- Follow the pattern of
BuilderConfigurationReaderTest.resolveConfiguration_AllLayersTogether_CompleteChain and assert the full generated source for a minimal builder.
- Cover standalone usage and inheritance from a parent annotated with
@SimpleMinimalBuilder.
- Existing tests that today create ad-hoc "minimal" templates should be migrated to use
@SimpleMinimalBuilder where appropriate.
-
Documentation (docs/CONFIGURATION.md)
- Add a section describing
@SimpleMinimalBuilder under ## Template Annotations or a new sub-section.
- List exactly which features are disabled and why.
-
Example usage (example/src/main/java/...)
- Add a small DTO annotated with
@SimpleMinimalBuilder to demonstrate usage.
- Ensure the
example module builds and its generated output is as expected.
Acceptance Criteria
@SimpleMinimalBuilder (or chosen name) is available in core.
- It generates only
build(), create(), and the field setters — no suppliers, consumers, varargs, collection helpers, with interface, Jackson, or generated annotations.
- New test class validates full generated source for minimal builders.
- Existing minimal-related tests prefer the new annotation.
- Example DTO in
example module.
- Documentation updated in
docs/CONFIGURATION.md, including link to example builder of example module
mvn test passes end-to-end.
Motivation
Right now, tests and users that want a "minimal" builder must create a custom template and explicitly disable every optional feature. A dedicated built-in
@SimpleMinimalBuilderannotation would make this common use-case a one-liner and give the project a canonical example of a template-based builder preset.Proposed Solution
Introduce a new public annotation in
core:The exact name can be discussed (
SimpleMinimalBuilder,MinimalBuilder,@SimpleBuilder.Minimal, etc.).Requirements
Annotation definition (
core/src/main/java/.../SimpleMinimalBuilder.java)@SimpleBuilder.Templatewith all optional features disabled.@Inheritedso subclasses get a builder too.Dedicated test class (
processor/src/test/java/.../SimpleMinimalBuilderTest.java)BuilderConfigurationReaderTest.resolveConfiguration_AllLayersTogether_CompleteChainand assert the full generated source for a minimal builder.@SimpleMinimalBuilder.@SimpleMinimalBuilderwhere appropriate.Documentation (
docs/CONFIGURATION.md)@SimpleMinimalBuilderunder## Template Annotationsor a new sub-section.Example usage (
example/src/main/java/...)@SimpleMinimalBuilderto demonstrate usage.examplemodule builds and its generated output is as expected.Acceptance Criteria
@SimpleMinimalBuilder(or chosen name) is available incore.build(),create(), and the field setters — no suppliers, consumers, varargs, collection helpers,withinterface, Jackson, or generated annotations.examplemodule.docs/CONFIGURATION.md, including link to example builder of example modulemvn testpasses end-to-end.