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).

  • Class
    Description
    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.
    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.
    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.
    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.
    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.
    Internal phantom type used by the InitializerStrategy to indicate that a property has been set.
    Internal phantom type used by the InitializerStrategy to indicate that a property remains unset.
    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.