# Package groovy.transform.builder

package groovy.transform.builder
Builder pattern generation via AST transformation.

`@Builder` annotation with pluggable strategies: SimpleStrategy (chained setters), DefaultStrategy (nested helper), InitializerStrategy (type-safe), ExternalStrategy (separate class).

- Related Packages
  Package
  Description
  groovy.transform
  Compile-time AST transformations for code generation and type checking.
  groovy.transform.options
  Customizable property handlers for transform-related property processing.
  groovy.transform.stc
  Static type checking support with closure signature hints and validation.
- Class
  Description
  Builder
  The `@Builder` AST transformation is used to help write classes that can be created using fluent api calls. The transform supports multiple building strategies to cover a range of cases and there are a number of configuration options to customize the building process.
  BuilderASTStubber
  Joint-compilation stubber for `Builder`, covering the two most common shapes: `DefaultStrategy` on a class-level annotation: emits the inner builder class with fluent setters and a `build()` method, plus a static `Foo.builder()` factory on the buildee. `SimpleStrategy` with a non-default `prefix`: emits chained `Foo prefixName(T value)` setters on the buildee itself.
  DefaultStrategy
  This strategy is used with the `Builder` AST transform to create a builder helper class for the fluent creation of instances of a specified class. It can be used at the class, static method or constructor levels.
  ExternalStrategy
  This strategy is used with the `Builder` AST transform to populate a builder helper class so that it can be used for the fluent creation of instances of a specified class. The specified class is not modified in any way and may be a Java class.
  InitializerStrategy
  This strategy is used with the `Builder` AST transform to create a builder helper class for the fluent and type-safe creation of instances of a specified class.
  InitializerStrategy.SET
  Internal phantom type used by the `InitializerStrategy` to indicate that a property has been set.
  InitializerStrategy.UNSET
  Internal phantom type used by the `InitializerStrategy` to indicate that a property remains unset.
  SimpleStrategy
  This strategy is used with the `Builder` AST transform to modify your Groovy objects so that the setter methods for properties return the original object, thus allowing chained usage of the setters.