Annotation Type BuilderClass


  • @Retention(RUNTIME)
    @Target(TYPE)
    @Beta
    @PublicAPI
    public @interface BuilderClass
    This annotation gives information about the associated ParameterBuilder for this class.

    It is expected that the referenced ParameterBuilder should have a nullary constructor for the default values and a copy constructor with an argument of the built class.

    Usually immutable parameter classes have associated builder classes. To allow easy reflection based management (API discovery, persistence, etc) it is desirable to have a "mutable version" of this object. Builder pattern helps to provide easy to use type safe creation for such immutable objects. The reflection based approaches usually needs "reverse builder" functionality: to create a mutable version from the immutable. An elegant way is to provide an association to the builder class and provide a copy constructor

    Usually a public nullary constructor of the built class should be provided which initializes deafult values.

    Please note that this annotation is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      Class<? extends ParameterBuilder<?>> builderClass
      Associated builder class for this immutable object.
    • Element Detail

      • builderClass

        Class<? extends ParameterBuilder<?>> builderClass
        Associated builder class for this immutable object.

        The referenced builder class is expected to have a single argument constructor which is an instance of the annotated (immutable, built) class. This constructor is expected to initialize the builder based on the passed reference

        Returns:
        Associated builder