@@ -25,37 +25,38 @@ fluent-builder-parent/
2525### 1. Add dependencies to your project
2626
2727``` xml
28+
2829<dependencies >
29- <dependency >
30- <groupId >stream.header.fluentbuilder</groupId >
31- <artifactId >fluent-builder-annotations</artifactId >
32- <version >0.1.0 </version >
33- </dependency >
34- <dependency >
35- <groupId >stream.header.fluentbuilder</groupId >
36- <artifactId >fluent-builder-processor</artifactId >
37- <version >0.1.0 </version >
38- <scope >provided</scope >
39- </dependency >
30+ <dependency >
31+ <groupId >stream.header.fluentbuilder</groupId >
32+ <artifactId >fluent-builder-annotations</artifactId >
33+ <version >0.1.2 </version >
34+ </dependency >
35+ <dependency >
36+ <groupId >stream.header.fluentbuilder</groupId >
37+ <artifactId >fluent-builder-processor</artifactId >
38+ <version >0.1.2 </version >
39+ <scope >provided</scope >
40+ </dependency >
4041</dependencies >
4142
4243<build >
43- <plugins >
44- <plugin >
45- <groupId >org.apache.maven.plugins</groupId >
46- <artifactId >maven-compiler-plugin</artifactId >
47- <version >3.11.0</version >
48- <configuration >
49- <annotationProcessorPaths >
50- <path >
51- <groupId >stream.header.fluentbuilder</groupId >
52- <artifactId >fluent-builder-processor</artifactId >
53- <version >0.1.0 </version >
54- </path >
55- </annotationProcessorPaths >
56- </configuration >
57- </plugin >
58- </plugins >
44+ <plugins >
45+ <plugin >
46+ <groupId >org.apache.maven.plugins</groupId >
47+ <artifactId >maven-compiler-plugin</artifactId >
48+ <version >3.11.0</version >
49+ <configuration >
50+ <annotationProcessorPaths >
51+ <path >
52+ <groupId >stream.header.fluentbuilder</groupId >
53+ <artifactId >fluent-builder-processor</artifactId >
54+ <version >0.1.2 </version >
55+ </path >
56+ </annotationProcessorPaths >
57+ </configuration >
58+ </plugin >
59+ </plugins >
5960</build >
6061```
6162
@@ -68,13 +69,13 @@ import stream.header.fluentbuilder.FluentBuilder.Ignore;
6869
6970@FluentBuilder
7071public record Person(
71- @Mandatory String firstName,
72- @Mandatory String lastName,
73- @Mandatory int age,
74- String email,
75- String phoneNumber,
76- String address,
77- @Ignore String internalId // Ignored - not part of builder, will be null
72+ @Mandatory String firstName,
73+ @Mandatory String lastName,
74+ @Mandatory int age,
75+ String email,
76+ String phoneNumber,
77+ String address,
78+ @Ignore String internalId // Ignored - not part of builder, will be null
7879) {
7980}
8081```
@@ -84,28 +85,28 @@ public record Person(
8485``` java
8586// All mandatory fields must be set before build() is available
8687Person person1 = PersonBuilder . builder()
87- .firstName(" John" )
88- .lastName(" Doe" )
89- .age(30 )
90- .email(" john.doe@example.com" )
91- .phoneNumber(" 123-456-7890" )
92- .build();
88+ .firstName(" John" )
89+ .lastName(" Doe" )
90+ .age(30 )
91+ .email(" john.doe@example.com" )
92+ .phoneNumber(" 123-456-7890" )
93+ .build();
9394
9495// Mandatory fields can be set in any order
9596Person person2 = PersonBuilder . builder()
96- .lastName(" Smith" )
97- .email(" jane.smith@example.com" ) // Optional field can be set anytime
98- .firstName(" Jane" )
99- .address(" 123 Main St" )
100- .age(25 )
101- .build();
97+ .lastName(" Smith" )
98+ .email(" jane.smith@example.com" ) // Optional field can be set anytime
99+ .firstName(" Jane" )
100+ .address(" 123 Main St" )
101+ .age(25 )
102+ .build();
102103
103104// Only mandatory fields
104105Person person3 = PersonBuilder . builder()
105- .age(40 )
106- .firstName(" Bob" )
107- .lastName(" Johnson" )
108- .build();
106+ .age(40 )
107+ .firstName(" Bob" )
108+ .lastName(" Johnson" )
109+ .build();
109110```
110111
111112## How It Works
@@ -122,13 +123,17 @@ This ensures at compile time that you cannot call `build()` until all mandatory
122123## Annotations
123124
124125### @FluentBuilder
126+
125127Place on a record to generate a fluent builder for it.
126128
127129### @FluentBuilder .Mandatory
130+
128131Mark record components that must be set before ` build() ` can be called. These fields enforce compile-time type safety.
129132
130133### @FluentBuilder .Ignore
134+
131135Mark record components to exclude them from the builder entirely. Ignored fields will be set to ` null ` when the record is constructed. Useful for:
136+
132137- Internal/computed fields
133138- Fields set by factory methods
134139- Metadata fields not relevant during construction
0 commit comments