Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
a723561
Extending SimpleBuilder annotation to support options and to have Acc…
AndreasIgel Nov 1, 2025
0667097
Switching simple.builders.* to simplebuilders.* compiler arguments
AndreasIgel Nov 1, 2025
ca19a28
Adding documentation for this feature
AndreasIgel Nov 1, 2025
d9972cd
Adding a record which contains all configurations, default values are…
AndreasIgel Nov 1, 2025
6ecd2f5
Adding BuilderConfiguration to ProcessingContext
AndreasIgel Nov 1, 2025
4a49f19
Refactoring Annotation options and BuilderConfiguration
AndreasIgel Nov 1, 2025
1672331
Putting all supported compiler-arguments into CompilerArgumentsEnum a…
AndreasIgel Nov 1, 2025
32642f2
Fixing codeformat
AndreasIgel Nov 1, 2025
bde54d5
Adding dynamic way of defining supported compiler-arguments
AndreasIgel Nov 1, 2025
0bc117d
Moving markdown files into docs folder
AndreasIgel Nov 1, 2025
358403c
Renaming OptionState.DEFAULT to OptionState.UNSET
AndreasIgel Nov 1, 2025
ed6ac3f
Adding reader for compilerArguments
AndreasIgel Nov 1, 2025
8a5997e
Adding functionality to read the options from Annotation and implemen…
AndreasIgel Nov 1, 2025
f2f1899
remove unused hasAnnotationOverride configuration
AndreasIgel Nov 1, 2025
4c7a6e6
Add a test for configuration processing
AndreasIgel Nov 1, 2025
8688a7e
Adding a minimal feature-test, the result should (at the end) only co…
AndreasIgel Nov 1, 2025
2229a4c
Implement configuration feature generateFieldSupplier (and refactorin…
AndreasIgel Nov 1, 2025
72cd758
Refactoring BuilderConfiguration to use better readable helper functions
AndreasIgel Nov 1, 2025
28e0c33
Implement configuration feature generateFieldConsumer
AndreasIgel Nov 1, 2025
9c71d93
Implementing further configurations
AndreasIgel Nov 1, 2025
1706170
Implementation of generateConditionalHelper=false
AndreasIgel Nov 1, 2025
997a3cf
Implementation of generateVarArgsHelpers=false
AndreasIgel Nov 1, 2025
fb9f199
Adding further asserts on generated functions
AndreasIgel Nov 1, 2025
3097fc2
Adding a new configuration: generateUnboxedOptional
AndreasIgel Nov 1, 2025
ccb070b
Adding a new configuration: usingGeneratedAnnotation
AndreasIgel Nov 1, 2025
9dc102d
Adding a new configuration: usingBuilderImplementationAnnotation
AndreasIgel Nov 1, 2025
9a6dc62
Adding a new configuration: generateStringFormatHelpers
AndreasIgel Nov 1, 2025
dabdc03
Adding a new configuration: implementsBuilderBase
AndreasIgel Nov 2, 2025
bd6de35
Adding a new configuration: builderConstructorAccess
AndreasIgel Nov 2, 2025
f133a35
Implementation of methodAccess and builderAccess
AndreasIgel Nov 2, 2025
dd849cd
Implementation of methodAccess and builderAccess
AndreasIgel Nov 2, 2025
0d5b0cb
Adding a new configuration: builderSuffix
AndreasIgel Nov 2, 2025
b40cf52
Adding a new configuration: setterSuffix
AndreasIgel Nov 2, 2025
f0482e4
Extending tests of ConfigurationProcessing
AndreasIgel Nov 2, 2025
5e45788
Merge branch 'feature/builder-configuration' of https://github.com/ja…
AndreasIgel Nov 2, 2025
05b9875
Updating documentation
AndreasIgel Nov 2, 2025
13de0f1
Removing unused functionality
AndreasIgel Nov 2, 2025
bb42dd1
Renaming generateBuilderProvider to generateBuilderConsumer
AndreasIgel Nov 2, 2025
71e0e42
Using helper functions of ProcessorTestUtils instead of duplicating it
AndreasIgel Nov 14, 2025
d50f96b
Adding tests for configuration reading in context of generation
AndreasIgel Nov 14, 2025
b3b6db3
Removing unused setter for configuration on ProcessingContext
AndreasIgel Nov 14, 2025
8345c52
Fixing tests and documentation
AndreasIgel Nov 14, 2025
b46faa1
Supporting processing of annotation-interfaces in ProcessorTestUtils
AndreasIgel Nov 14, 2025
da4f0e4
Switching from @SimpleBuilder.Options to @SimpleBuilder(options = ...…
AndreasIgel Nov 14, 2025
536ee89
Testing with existing annotation in test-context (not with annotation…
AndreasIgel Dec 7, 2025
5f92643
Refactoring way of processing configurations from annotation
AndreasIgel Dec 7, 2025
4d48ac2
Adept tests and testdata for correct behavior
AndreasIgel Dec 7, 2025
7383097
Changing behaviour (no pre-computing of configurations anymore)
AndreasIgel Dec 7, 2025
50c7a51
Refactoring to increase code quality
AndreasIgel Dec 7, 2025
f112030
Adding test for inline template handling
AndreasIgel Dec 7, 2025
178eadf
Changing test "resolveConfiguration_AllLayersTogether_CompleteChain" …
AndreasIgel Dec 7, 2025
63e1f9d
Update BuilderConfigurationReaderTest.java
AndreasIgel Dec 7, 2025
8d1ddab
Updating documentation
AndreasIgel Dec 7, 2025
b8f5c97
Adding validation of configuration which leads to broken builders
AndreasIgel Dec 7, 2025
fd129a9
Updating configuration with validation
AndreasIgel Dec 7, 2025
61b091b
Improving codequality
AndreasIgel Dec 7, 2025
e5c99d2
Updating javadoc in SimpleBuilder
AndreasIgel Dec 7, 2025
fc5db92
Refactoring code to increase code quality
AndreasIgel Dec 7, 2025
871ae61
Fixing handling of strings in configuration, trailing and leading spa…
AndreasIgel Dec 7, 2025
5497c4b
Adding an example of own Builder-Annotation in example project
AndreasIgel Dec 20, 2025
4ed5ebc
Adding generated builders to git for showing them and improving docum…
AndreasIgel Dec 20, 2025
fb064fa
Extending test in example to show functionality
AndreasIgel Dec 20, 2025
7abc814
Stabilize generation by sorting, so that the builder has its methods …
AndreasIgel Dec 20, 2025
cf0299b
Fixed codesmell on collection-creation by stream
AndreasIgel Dec 20, 2025
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
84 changes: 81 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
- [Conditional Builder Logic](#conditional-builder-logic)
- [Collections and Nested Objects](#collections-and-nested-objects)
- [With Interface Pattern](#with-interface-pattern)
- [Builder Configuration](#builder-configuration)
- [Compiler Arguments](#compiler-arguments)
- [Examples](#examples)
- [Elementary Builder Example](#elementary-builder-example)
- [Full-Featured Examples](#full-featured-examples)
- [Advanced Features](#advanced-features)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgements](#acknowledgements)
Expand Down Expand Up @@ -49,7 +55,7 @@ For Maven-based projects, add the following to your POM file in order to use Sim
```xml
...
<properties>
<simple-builders.version>0.1.0</simple-builders.version>
<simple-builders.version>0.2.0</simple-builders.version>
</properties>
...
<dependencies>
Expand Down Expand Up @@ -92,7 +98,7 @@ If you don't work with a dependency management tool, you can obtain a distributi
Annotate your class with `@SimpleBuilder` to generate a builder:

```java
import org.javahelpers.simple.builders.core.annotation.SimpleBuilder;
import org.javahelpers.simple.builders.core.annotations.SimpleBuilder;

@SimpleBuilder
public class Person {
Expand Down Expand Up @@ -257,9 +263,81 @@ Person youngerPerson = person.with(p -> p.age(29));

The `With` interface provides type-safe setter methods that mirror the builder's API, making it easy to create object variations without manually copying all fields.

### Builder Configuration

Simple Builders provides extensive configuration options to customize the generated builder code. You can control:

- Field setter generation (Supplier, Provider, Builder patterns)
- Conditional logic helpers
- Access modifiers for builders and methods
- Collection helper methods
- Integration features

Configuration can be applied per-class using `@SimpleBuilder.Options` annotation or project-wide using compiler options.

#### Compiler Arguments

All configuration options are available as compiler arguments using the `-A` flag. For example:

```bash
javac -Asimplebuilder.verbose=true \
-Asimplebuilder.generateFieldSupplier=false \
YourClass.java
```

Or in Maven:

```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Asimplebuilder.verbose=true</arg>
<arg>-Asimplebuilder.generateFieldSupplier=false</arg>
</compilerArgs>
</configuration>
</plugin>
```

📋 **For a complete list of all available compiler arguments, see [`CompilerArgumentsEnum`](processor/src/main/java/org/javahelpers/simple/builders/processor/enums/CompilerArgumentsEnum.java).**

📖 **For complete documentation, examples, and all available options, see the [Configuration Guide](docs/CONFIGURATION.md).**

## Examples

The `example` module contains real-world examples demonstrating various builder configurations and features. You can explore the source DTOs and their generated builders:

### Elementary Builder Example

A comprehensive example showcasing all fundamental Java property types with a minimal, setter-only builder configuration:

- **Source DTO**: [`BookDto.java`](example/src/main/java/org/javahelpers/simple/builders/example/BookDto.java) - Demonstrates all primitive types, collections, Optional, BigDecimal, date/time types, and nested objects
- **Custom Annotation**: [`@ElementaryBuilder`](example/src/main/java/org/javahelpers/simple/builders/example/ElementaryBuilder.java) - A template annotation that disables all advanced features (suppliers, consumers, collection builders, With interface, @Generated annotation)
- **Generated Builder**: [`BookDtoBuilder.java`](example/target/generated-sources/annotations/org/javahelpers/simple/builders/example/BookDtoBuilder.java) - Clean, minimal builder with only setter methods
- **Tests**: [`BookDtoBuilderTest.java`](example/src/test/java/org/javahelpers/simple/builders/example/BookDtoBuilderTest.java) - Usage examples

### Full-Featured Examples

Examples with all builder features enabled:

- **Person DTO**: [`PersonDto.java`](example/src/main/java/org/javahelpers/simple/builders/example/PersonDto.java) and [`PersonDtoBuilder.java`](example/target/generated-sources/annotations/org/javahelpers/simple/builders/example/PersonDtoBuilder.java) - Demonstrates nested objects, collections, suppliers, conditional logic, and various setter patterns
- **Usage Examples**: [`PersonDtoBuilderTest.java`](example/src/test/java/org/javahelpers/simple/builders/example/PersonDtoBuilderTest.java) - Shows supplier methods, collection builders, nested builder consumers, and conditional logic
- **Product Record**: [`ProductRecord.java`](example/src/main/java/org/javahelpers/simple/builders/example/ProductRecord.java) and [`ProductRecordBuilder.java`](example/target/generated-sources/annotations/org/javahelpers/simple/builders/example/ProductRecordBuilder.java) - Java Record support with full builder features and With interface pattern
- **Usage Examples**: [`ProductRecordTest.java`](example/src/test/java/org/javahelpers/simple/builders/example/ProductRecordTest.java) - Comprehensive tests demonstrating With interface for immutable Records, fluent modifications, and custom with methods

### Advanced Features

Examples demonstrating special annotations and nested object relationships:

- **Sponsor DTO**: [`SponsorDto.java`](example/src/main/java/org/javahelpers/simple/builders/example/SponsorDto.java) and [`SponsorDtoBuilder.java`](example/target/generated-sources/annotations/org/javahelpers/simple/builders/example/SponsorDtoBuilder.java) - Simple DTO used as nested object in other examples
- **Mannschaft DTO**: [`MannschaftDto.java`](example/src/main/java/org/javahelpers/simple/builders/example/MannschaftDto.java) and [`MannschaftDtoBuilder.java`](example/target/generated-sources/annotations/org/javahelpers/simple/builders/example/MannschaftDtoBuilder.java) - Demonstrates `@IgnoreInBuilder` annotation to exclude specific setter methods from the generated builder, plus Set collections with nested objects

These examples serve as both documentation and integration tests for the annotation processor.

## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
Contributions are welcome! Please see [CONTRIBUTING.md](docs/CONTRIBUTING.md) for:

- Development setup and project structure
- Building and testing strategies (important for annotation processor modules)
Expand Down
Loading
Loading