Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fff0ff1
Make @SimpleBuilder @Inherited to match documentation (#244)
AndreasIgel Aug 15, 2026
13a8fc8
Rename to BuilderAnnotationInheritanceTest and cover Template inherit…
AndreasIgel Aug 15, 2026
105310a
Refactoring code to move assertNoBuilderGenerated to common asserts
AndreasIgel Aug 15, 2026
2c83b78
fixing codeformat
AndreasIgel Aug 15, 2026
aca9ef6
Document @Inherited behavior of @SimpleBuilder.Template
AndreasIgel Aug 15, 2026
bd3bf93
Document options-inheritance limitation for inherited subclass builders
AndreasIgel Aug 15, 2026
e8e0352
Fix issue reference: #245 -> #248
AndreasIgel Aug 15, 2026
9776343
Clarify @SimpleBuilder vs @SimpleBuilder.Template usage in docs
AndreasIgel Aug 15, 2026
4b7723a
Link issue #248 from @SimpleBuilder.Template inheritance Javadoc
AndreasIgel Aug 15, 2026
218ea79
Remove redundant troubleshooting item about @SimpleBuilder.Template t…
AndreasIgel Aug 15, 2026
bd6020d
Merge remote-tracking branch 'upstream/main'
devin-ai-integration[bot] Aug 16, 2026
62d1269
Merge remote-tracking branch 'upstream/main'
devin-ai-integration[bot] Aug 16, 2026
ec99605
Merge upstream main
devin-ai-integration[bot] Aug 22, 2026
77bfb8b
feat: add generateJavaDoc option to disable Javadoc generation (#262)
devin-ai-integration[bot] Aug 22, 2026
25c5fa4
fix(#262): move generateJavaDoc gating from RoasterCodeGenerator to B…
devin-ai-integration[bot] Aug 23, 2026
ba774bf
refactor(#262): address PR feedback on generateJavaDoc implementation
devin-ai-integration[bot] Aug 23, 2026
9b48214
refactor: remove cached generateJavaDoc flag and add full expected so…
devin-ai-integration[bot] Aug 24, 2026
77091e0
Merge branch 'main' into devin/fix-issue-262-generate-javadoc
AndreasIgel Aug 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 numberDiff line numberDiff line change
Expand Up@@ -61,6 +61,7 @@
* usingArrayListBuilderWithElementBuilders, usingHashSetBuilder,
* usingHashSetBuilderWithElementBuilders, usingHashMapBuilder (all default: true)
* <li><b>Integration:</b> generateWithInterface (default: true)
* <li><b>Documentation:</b> generateJavaDoc (default: true)
* </ul>
*
* <p>This annotation is itself a built-in {@link Template}: it is meta-annotated with
Expand DownExpand Up@@ -666,6 +667,18 @@
*/
String jacksonModulePackage() default "";

/**
* Generate Javadoc comments on the generated builder class and its members. <br>
* When disabled, no class, field, constructor or method Javadoc is emitted, producing smaller
* generated files.
*
* <p>Default: ENABLED <br>
* Compiler option: -Asimplebuilder.generateJavaDoc
*
* @return the option state for generating Javadoc
*/
OptionState generateJavaDoc() default OptionState.UNSET;

// === Naming ===
/**
* Suffix to append to the DTO name to generate the builder class name. <br>
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,6 +90,7 @@
usingBuilderImplementationAnnotation = OptionState.DISABLED,
usingJacksonDeserializerAnnotation = OptionState.DISABLED,
generateJacksonModule = OptionState.DISABLED,
generateJavaDoc = OptionState.DISABLED,
copyTypeAnnotations = OptionState.DISABLED,
implementsBuilderBase = OptionState.DISABLED,
builderSuffix = "Builder",
Expand Down
39 changes: 36 additions & 3 deletions docs/CONFIGURATION.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,7 @@ Simple-builders supports fine-grained configuration through the `@SimpleBuilder.
- [Collection Helpers](#collection-helpers)
- [Component Filtering](#component-filtering)
- [Integration](#integration)
- [Documentation](#documentation)
- [Reliability](#reliability)
- [Performance Tracking](#performance-tracking)
- [Examples](#examples)
Expand DownExpand Up@@ -112,7 +113,8 @@ Create reusable configuration presets with custom template annotations. The buil
usingBuilderImplementationAnnotation = OptionState.DISABLED,
implementsBuilderBase = OptionState.DISABLED,
usingJacksonDeserializerAnnotation = OptionState.DISABLED,
generateJacksonModule = OptionState.DISABLED
generateJacksonModule = OptionState.DISABLED,
generateJavaDoc = OptionState.DISABLED
Comment thread
AndreasIgel marked this conversation as resolved.
))
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
Expand DownExpand Up@@ -858,6 +860,30 @@ This is highly recommended to ensure deterministic output location and avoid spl

---

### Documentation

#### `generateJavaDoc`

**Default**: `ENABLED` | **Compiler Option**: `-Asimplebuilder.generateJavaDoc=ENABLED|DISABLED`

Controls whether the processor emits Javadoc comments on the generated builder class, its fields, constructors and methods.

**When ENABLED** (default):
The generated builder contains Javadoc blocks explaining the purpose of the class, setters, `build()`, `create()` and any helper methods.

**When DISABLED**:
No Javadoc is emitted. This produces smaller generated source files and is useful when generated code is committed to version control and Javadoc noise is undesirable.

**Example**:
```java
@SimpleBuilder(options = @SimpleBuilder.Options(generateJavaDoc = OptionState.DISABLED))
public class PersonDto {
private String name;
}
```

---

### Naming

#### `builderSuffix`
Expand DownExpand Up@@ -1069,7 +1095,8 @@ The built-in `@SimpleMinimalBuilder` is the simplest way to get a lightweight bu
usingBuilderImplementationAnnotation = OptionState.DISABLED,
implementsBuilderBase = OptionState.DISABLED,
usingJacksonDeserializerAnnotation = OptionState.DISABLED,
generateJacksonModule = OptionState.DISABLED
generateJacksonModule = OptionState.DISABLED,
generateJavaDoc = OptionState.DISABLED
))
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
Expand DownExpand Up@@ -1337,6 +1364,9 @@ methodAccess = AccessModifier.PRIVATE
-Asimplebuilder.usingGeneratedAnnotation=ENABLED|DISABLED
-Asimplebuilder.usingBuilderImplementationAnnotation=ENABLED|DISABLED

# Documentation
-Asimplebuilder.generateJavaDoc=ENABLED|DISABLED

# Naming
-Asimplebuilder.builderSuffix=CustomSuffix
-Asimplebuilder.setterSuffix=customPrefix
Expand DownExpand Up@@ -1385,7 +1415,10 @@ methodAccess = AccessModifier.PRIVATE
usingGeneratedAnnotation = OptionState.ENABLED,
usingBuilderImplementationAnnotation = OptionState.ENABLED,
usingJacksonDeserializerAnnotation = OptionState.ENABLED,


// Documentation
generateJavaDoc = OptionState.ENABLED,

// Naming
builderSuffix = "Builder",
setterSuffix = ""
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,191 +8,61 @@
import org.javahelpers.simple.builders.core.util.BuilderToStringStyle;
import org.javahelpers.simple.builders.core.util.TrackedValue;

/**
* Builder for {@code org.javahelpers.simple.builders.example.CustomerDto}.
* <p>
* This builder provides a fluent API for creating instances of org.javahelpers.simple.builders.example.CustomerDto 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.
*
* <h4>Example:</h4>
*
* <pre>{@code
* CustomerDto result = CustomerDtoBuilder.create()
* .email("example value")
* .id(42L)
* .name("example value")
* .tags(List.of("example value"))
* .build();
* }</pre>
*/
public class CustomerDtoBuilder {

/**
* Tracked value for <code>email</code>: email.
*/
private TrackedValue<String> email = unsetValue();
/**
* Tracked value for <code>id</code>: id.
*/
private TrackedValue<Long> id = unsetValue();
/**
* Tracked value for <code>name</code>: name.
*/
private TrackedValue<String> name = unsetValue();
/**
* Tracked value for <code>tags</code>: tags.
*/
private TrackedValue<List<String>> tags = unsetValue();

/**
* Empty constructor of builder for {@code org.javahelpers.simple.builders.example.CustomerDto}.
*/
public CustomerDtoBuilder() {
}

/**
* Initialisation of builder for {@code org.javahelpers.simple.builders.example.CustomerDto} by a instance.
*
* @param instance object instance for initialisiation
*/
public CustomerDtoBuilder(CustomerDto instance) {
this.email = initialValue(instance.getEmail());
this.id = initialValue(instance.getId());
this.name = initialValue(instance.getName());
this.tags = initialValue(instance.getTags());
}

/**
* Creating a new builder for {@code org.javahelpers.simple.builders.example.CustomerDto}.
*
* <h4>Example:</h4>
*
* <pre>{@code
* CustomerDtoBuilder builder = CustomerDtoBuilder.create();
* }</pre>
*
* @return builder for {@code org.javahelpers.simple.builders.example.CustomerDto}
*/
public static CustomerDtoBuilder create() {
return new CustomerDtoBuilder();
}

/**
* Sets the value for <code>email</code>.
* <p>
* Generated from setter {@link CustomerDto#setEmail(String) setEmail(String email)}
*
* <h4>Example:</h4>
*
* <pre>{@code
* builder.email("example value");
* }</pre>
*
* @param email email
* @return current instance of builder
*/
public CustomerDtoBuilder email(String email) {
this.email = changedValue(email);
return this;
}

/**
* Sets the value for <code>id</code>.
* <p>
* Generated from setter {@link CustomerDto#setId(Long) setId(Long id)}
*
* <h4>Example:</h4>
*
* <pre>{@code
* builder.id(42L);
* }</pre>
*
* @param id id
* @return current instance of builder
*/
public CustomerDtoBuilder id(Long id) {
this.id = changedValue(id);
return this;
}

/**
* Sets the value for <code>name</code>.
* <p>
* Generated from setter {@link CustomerDto#setName(String) setName(String name)}
*
* <h4>Example:</h4>
*
* <pre>{@code
* builder.name("example value");
* }</pre>
*
* @param name name
* @return current instance of builder
*/
public CustomerDtoBuilder name(String name) {
this.name = changedValue(name);
return this;
}

/**
* Sets the value for <code>tags</code>.
* <p>
* Generated from setter {@link CustomerDto#setTags(List) setTags(List<String> tags)}
*
* <h4>Example:</h4>
*
* <pre>{@code
* builder.tags(List.of("example value"));
* }</pre>
*
* @param tags tags
* @return current instance of builder
*/
public CustomerDtoBuilder tags(List<String> tags) {
this.tags = changedValue(tags);
return this;
}

/**
* Validates that the email field is not null or empty.
* <p>
* Generated from setter {@link CustomerDto#setEmail(String) setEmail(String email)}
*
* @return this builder instance for chaining
* @throws IllegalArgumentException if email is null or empty
*/
CustomerDtoBuilder validateEmail() {
if (!email.isSet() || email.value().trim().isEmpty()) {
throw new IllegalArgumentException("Email cannot be null or empty");
}
return this;
}

/**
* Validates that the name field is not null or empty.
* <p>
* Generated from setter {@link CustomerDto#setName(String) setName(String name)}
*
* @return this builder instance for chaining
* @throws IllegalArgumentException if name is null or empty
*/
CustomerDtoBuilder validateName() {
if (!name.isSet() || name.value().trim().isEmpty()) {
throw new IllegalArgumentException("Name cannot be null or empty");
}
return this;
}

/**
* Builds the configured DTO instance.
*
* <h4>Example:</h4>
*
* <pre>{@code
* CustomerDto result = builder.build();
* }</pre>
*/
public CustomerDto build() {
CustomerDto result = new CustomerDto();
this.email.ifSet(result::setEmail);
Expand All@@ -202,11 +72,6 @@ public CustomerDto build() {
return result;
}

/**
* Returns a string representation of this builder, including only fields that have been set.
*
* @return string representation of the builder
*/
@Override
public String toString() {
return new ToStringBuilder(this, BuilderToStringStyle.INSTANCE).append("email", this.email)
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,6 @@

package org.javahelpers.simple.builders.processor;

import static org.javahelpers.simple.builders.processor.model.core.BuilderToGenerationTypeMapper.toRenderingDto;
import static org.javahelpers.simple.builders.processor.processing.BuilderDefinitionCreator.extractFromElement;
import static org.javahelpers.simple.builders.processor.processing.logging.PerformanceTracker.PHASE_BUILDER_DEFINITION_EXTRACTION;
import static org.javahelpers.simple.builders.processor.processing.logging.PerformanceTracker.PHASE_CODE_GENERATION;
Expand DownExpand Up@@ -55,6 +54,7 @@
import org.javahelpers.simple.builders.processor.generators.integration.JacksonModuleGenerator;
import org.javahelpers.simple.builders.processor.model.core.BuilderConfiguration;
import org.javahelpers.simple.builders.processor.model.core.BuilderDefinitionDto;
import org.javahelpers.simple.builders.processor.model.core.BuilderToGenerationTypeMapper;
import org.javahelpers.simple.builders.processor.model.core.GenerationTargetClassDto;
import org.javahelpers.simple.builders.processor.model.type.TypeNameList;
import org.javahelpers.simple.builders.processor.model.type.TypeNameMap;
Expand DownExpand Up@@ -263,11 +263,13 @@ private void process(Element annotatedElement, BuilderConfiguration config)

// Track DTO Mapping
tracker.startPhase();
GenerationTargetClassDto renderingDto = toRenderingDto(builderDef);
GenerationTargetClassDto renderingDto =
new BuilderToGenerationTypeMapper(config).toRenderingDto(builderDef);
tracker.endPhase(PHASE_DTO_MAPPING);

// Track Code Generation (parent phase; sub-phases tracked inside RoasterCodeGenerator)
tracker.startPhase();

codeGenerator.generateClass(renderingDto);
tracker.endPhase(PHASE_CODE_GENERATION);

Expand Down
Loading