You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternate staged builders that handle optional, etc.
A variant of staged builders is available that only stages required record components. Any optional components
(when `addConcreteSettersForOptional` is enabled) are not staged and are added to the final stage. Additionally, if Collection options are enabled, those too are
added to the final stage.
Closes#170
Copy file name to clipboardExpand all lines: options.md
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,12 @@ Use `@RecordBuilder.Options(builderMode = BuilderMode.STAGED)` or `@RecordBuilde
74
74
builders. Staged builders require that each record component is built in order and that each component is specified. The generated builder ensures
75
75
this via individual staged builders. See [TestStagedBuilder](record-builder-test/src/test/java/io/soabase/recordbuilder/test/staged/TestStagedBuilder.java) for examples.
76
76
77
+
A variant of staged builders is available that only stages required record components. Use `BuilderMode.STAGED_REQUIRED_ONLY` or `BuilderMode.STANDARD_AND_STAGED_REQUIRED_ONLY`.
78
+
The following are not staged and are added to the final stage:
79
+
- optional components (when `addConcreteSettersForOptional` is enabled)
80
+
- Any collections matching enabled [Collection options](#collections)
81
+
- Any annotated compontents that match the `nullablePattern()` pattern option (e.g. `@Nullable`)
|`@RecordBuilder.Options(interpretNotNulls = true/false)`| Add not-null checks for record components annotated with any null-pattern annotation. The default is `false`. |
94
-
|`@RecordBuilder.Options(interpretNotNullsPattern = "regex")`| The regex pattern used to determine if an annotation name means non-null. |
95
-
|`@RecordBuilder.Options(allowNullableCollections = true/false)`| Adds special null handling for record collectioncomponents. The default is `false`. |
|`@RecordBuilder.Options(interpretNotNulls = true/false)`| Add not-null checks for record components annotated with any null-pattern annotation. The default is `false`. |
100
+
|`@RecordBuilder.Options(interpretNotNullsPattern = "regex")`| The regex pattern used to determine if an annotation name means non-null. |
101
+
|`@RecordBuilder.Options(allowNullableCollections = true/false)`| Adds special null handling for record collectioncomponents. The default is `false`. |
102
+
|`@RecordBuilder.Options(nullablePattern = "regex")`| Regex pattern to use for `BuilderMode.STAGED_REQUIRED_ONLY` and `BuilderMode.STANDARD_AND_STAGED_REQUIRED_ONLY`. |
Copy file name to clipboardExpand all lines: record-builder-processor/src/main/java/io/soabase/recordbuilder/processor/InternalRecordBuilderProcessor.java
+71-33Lines changed: 71 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -48,8 +48,10 @@ class InternalRecordBuilderProcessor {
0 commit comments