Annotation Interface StagedBuilder


@Documented @Retention(RUNTIME) @Target({ANNOTATION_TYPE,TYPE}) public @interface StagedBuilder
The staged builder annotation on a bean should create a builder that initializes the required properties in stages.

Every required property gets its own stage interface declaring the single method that assigns it and returns the next stage, so the build method is only reachable once all of them are assigned. A property is required unless the builder can leave it unassigned: it is nullable, it declares a default value with Bindable.defaultValue() or it accumulates values with Singular. Those are assigned in any order on the final stage.

Since:
2.2
Author:
Denis Stepanov
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Annotation>[]
    Define what annotations should be added to the generated builder.
  • Element Details

    • annotatedWith

      Class<? extends Annotation>[] annotatedWith
      Define what annotations should be added to the generated builder. By default, the builder will have Introspected annotation so that introspection can be created for it.
      Returns:
      Array of annotations to apply on the builder
      Default:
      {io.micronaut.core.annotation.Introspected.class}