Package io.jonasg.bob
Annotation Interface Buildable
Marks a class to be buildable, which will generate a builder for the class.
The builder will have a build method that will create an instance of the annotated class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceMarks a constructor as buildable. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionSpecifies the constructor policy to be applied when building an instance of the annotated class.String[]List of fields to be excluded to be included in the builder.The package name of the generated builder.The setterPrefix for the generated setters.
-
Element Details
-
excludeFields
String[] excludeFieldsList of fields to be excluded to be included in the builder.- Returns:
- the list of fields to be excluded to be included in the builder.
- Default:
- {}
-
setterPrefix
String setterPrefixThe setterPrefix for the generated setters. For example, "with" or "set" Defaults to no setterPrefix.- Returns:
- the setterPrefix for the generated setters.
- Default:
- ""
-
packageName
String packageNameThe package name of the generated builder. Defaults to the package of the annotated class.- Returns:
- the package name of the generated builder
- Default:
- ""
-
constructorPolicy
ConstructorPolicy constructorPolicySpecifies the constructor policy to be applied when building an instance of the annotated class. The policy controls how strictly the builder enforces the setting of fields during object instantiation.The default value is
ConstructorPolicy.PERMISSIVE, which allows for more flexibility in field initialization, permitting fields to be optionally set with defaults provided for unset fields. Alternatively, setting this toConstructorPolicy.ENFORCEDrequires all fields to be explicitly set, otherwise, the builder throws an exception.- Returns:
- the constructor policy used by the builder
- Default:
- PERMISSIVE
-