Interface BuilderCodegenExtension


public interface BuilderCodegenExtension
Extension to modify the builder and prototype that is generated.
  • Method Details

    • prototypeInfo

      default PrototypeInfo prototypeInfo(PrototypeInfo prototypeInfo)
      An extension can update the prototype information, add annotations to types, add custom methods etc.

      NOTE: this method CANNOT modify options

      Parameters:
      prototypeInfo - prototype information from blueprint and previous extensions
      Returns:
      updated prototype information
    • options

      default List<OptionInfo> options(PrototypeInfo prototypeInfo, List<OptionInfo> existingOptions)
      A list of (updated) options to be used during code generation.

      An option is a property of the prototype, that has a prototype accessor, builder field, builder setter, and builder getter. All of these methods will be code generated. If an option is inherited from a blueprint, it is still code generated, with Override annotation.

      Parameters:
      prototypeInfo - prototype information from blueprint and previous extensions
      existingOptions - list of options from blueprint and previous extensions
      Returns:
      list of builder options
    • updatePrototype

      default void updatePrototype(PrototypeInfo prototypeInfo, List<OptionInfo> options, ClassModel.Builder classModel)
      Update the prototype interface. This can add additional factory methods, constants, etc.

      Do not add properties through this method, use options(io.helidon.builder.codegen.PrototypeInfo, java.util.List) instead.

      Parameters:
      prototypeInfo - prototype information
      options - list of options
      classModel - prototype interface class model
    • updateBuilderBase

      default void updateBuilderBase(PrototypeInfo prototypeInfo, List<OptionInfo> options, ClassBase.Builder<?,?> classModel)
      Update the builder base. This can add additional fields, methods, constants, etc.
      Parameters:
      prototypeInfo - prototype information
      options - list of options
      classModel - builder base class model
    • updatePreBuildPrototype

      default void updatePreBuildPrototype(PrototypeInfo prototypeInfo, List<OptionInfo> options, Method.Builder method)
      Update the preBuildPrototype method of builder base. This method is called first in the builder hierarchy to handle decorators.
      Parameters:
      prototypeInfo - prototype information
      options - list of options
      method - method builder
    • updateValidatePrototype

      default void updateValidatePrototype(PrototypeInfo prototypeInfo, List<OptionInfo> options, Method.Builder method)
      Update the validatePrototype method of builder base. This method is called last in the builder hierarchy to handle validation, right before calling the build method.
      Parameters:
      prototypeInfo - prototype information
      options - list of options
      method - method builder
    • updateBuilder

      default void updateBuilder(PrototypeInfo prototypeInfo, List<OptionInfo> options, ClassBase.Builder<?,?> classModel)
      Update the builder.
      Parameters:
      prototypeInfo - prototype information
      options - list of options
      classModel - builder class model
    • updateImplementation

      default void updateImplementation(PrototypeInfo prototypeInfo, List<OptionInfo> options, ClassBase.Builder<?,?> classModel)
      Update the implementation class.

      Do not add properties through this method, use options(io.helidon.builder.codegen.PrototypeInfo, java.util.List) instead.

      Parameters:
      prototypeInfo - prototype information
      options - list of options
      classModel - implementation class model
    • method

      default Optional<GeneratedMethod> method(OptionInfo option, GeneratedMethod method, OptionMethodType methodType)
      This allows modification to the methods generated for options by the default builder code generator. To add additional methods to any of the generated code, use prototypeInfo(io.helidon.builder.codegen.PrototypeInfo).

      Important note: we may add new method types in minor versions of Helidon, please make sure this would not break your extension.

      Parameters:
      option - option information
      method - method to modify, possibly remove, or return
      methodType - type of the method being processed
      Returns:
      updated generated method