Class PrototypeInfo.BuilderBase<BUILDER extends PrototypeInfo.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends PrototypeInfo>

java.lang.Object
io.helidon.builder.codegen.PrototypeInfo.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
PrototypeInfo.Builder
Enclosing interface:
PrototypeInfo

public abstract static class PrototypeInfo.BuilderBase<BUILDER extends PrototypeInfo.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends PrototypeInfo> extends Object implements Prototype.Builder<BUILDER,PROTOTYPE>
Fluent API builder base for PrototypeInfo.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(PrototypeInfo prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(PrototypeInfo.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • blueprint

      public BUILDER blueprint(TypeInfo blueprint)
      Blueprint type info. A new prototype cannot be generated without a blueprint to base it on, so this is a required option.
      Parameters:
      blueprint - blueprint type information
      Returns:
      updated builder instance
      See Also:
    • blueprint

      public BUILDER blueprint(Consumer<TypeInfo.Builder> consumer)
      Blueprint type info. A new prototype cannot be generated without a blueprint to base it on, so this is a required option.
      Parameters:
      consumer - consumer of builder of blueprint type information
      Returns:
      updated builder instance
      See Also:
    • blueprint

      public BUILDER blueprint(Supplier<? extends TypeInfo> supplier)
      Blueprint type info. A new prototype cannot be generated without a blueprint to base it on, so this is a required option.
      Parameters:
      supplier - supplier of blueprint type information
      Returns:
      updated builder instance
      See Also:
    • clearRuntimeType

      public BUILDER clearRuntimeType()
      Clear existing value of runtimeType.
      Returns:
      updated builder instance
      See Also:
    • runtimeType

      public BUILDER runtimeType(TypeName runtimeType)
      If the builder should act as a factory for another type, this is the type.

      Method Prototype.Builder.buildPrototype() builds the prototype, while method Builder.build() builds the runtime type.

      Parameters:
      runtimeType - runtime type, if configured
      Returns:
      updated builder instance
      See Also:
    • runtimeType

      public BUILDER runtimeType(Consumer<TypeName.Builder> consumer)
      If the builder should act as a factory for another type, this is the type.

      Method Prototype.Builder.buildPrototype() builds the prototype, while method Builder.build() builds the runtime type.

      Parameters:
      consumer - consumer of builder of runtime type, if configured
      Returns:
      updated builder instance
      See Also:
    • runtimeType

      public BUILDER runtimeType(Supplier<? extends TypeName> supplier)
      If the builder should act as a factory for another type, this is the type.

      Method Prototype.Builder.buildPrototype() builds the prototype, while method Builder.build() builds the runtime type.

      Parameters:
      supplier - supplier of runtime type, if configured
      Returns:
      updated builder instance
      See Also:
    • javadoc

      public BUILDER javadoc(Javadoc javadoc)
      Javadoc for the generated prototype.
      Parameters:
      javadoc - prototype javadoc
      Returns:
      updated builder instance
      See Also:
    • javadoc

      public BUILDER javadoc(Consumer<Javadoc.Builder> consumer)
      Javadoc for the generated prototype.
      Parameters:
      consumer - consumer of builder of prototype javadoc
      Returns:
      updated builder instance
      See Also:
    • javadoc

      public BUILDER javadoc(Supplier<? extends Javadoc> supplier)
      Javadoc for the generated prototype.
      Parameters:
      supplier - supplier of prototype javadoc
      Returns:
      updated builder instance
      See Also:
    • builderBaseJavadoc

      public BUILDER builderBaseJavadoc(Javadoc builderBaseJavadoc)
      Javadoc for the builder base.
      Parameters:
      builderBaseJavadoc - builder base javadoc
      Returns:
      updated builder instance
      See Also:
    • builderBaseJavadoc

      public BUILDER builderBaseJavadoc(Consumer<Javadoc.Builder> consumer)
      Javadoc for the builder base.
      Parameters:
      consumer - consumer of builder of builder base javadoc
      Returns:
      updated builder instance
      See Also:
    • builderBaseJavadoc

      public BUILDER builderBaseJavadoc(Supplier<? extends Javadoc> supplier)
      Javadoc for the builder base.
      Parameters:
      supplier - supplier of builder base javadoc
      Returns:
      updated builder instance
      See Also:
    • builderJavadoc

      public BUILDER builderJavadoc(Javadoc builderJavadoc)
      Javadoc for the builder class.
      Parameters:
      builderJavadoc - builder javadoc
      Returns:
      updated builder instance
      See Also:
    • builderJavadoc

      public BUILDER builderJavadoc(Consumer<Javadoc.Builder> consumer)
      Javadoc for the builder class.
      Parameters:
      consumer - consumer of builder of builder javadoc
      Returns:
      updated builder instance
      See Also:
    • builderJavadoc

      public BUILDER builderJavadoc(Supplier<? extends Javadoc> supplier)
      Javadoc for the builder class.
      Parameters:
      supplier - supplier of builder javadoc
      Returns:
      updated builder instance
      See Also:
    • clearBuilderDecorator

      public BUILDER clearBuilderDecorator()
      Clear existing value of builderDecorator.
      Returns:
      updated builder instance
      See Also:
    • builderDecorator

      public BUILDER builderDecorator(TypeName builderDecorator)
      Builder decorator, if configured.
      Parameters:
      builderDecorator - type of the builder decorator, if present
      Returns:
      updated builder instance
      See Also:
    • builderDecorator

      public BUILDER builderDecorator(Consumer<TypeName.Builder> consumer)
      Builder decorator, if configured.
      Parameters:
      consumer - consumer of builder of type of the builder decorator, if present
      Returns:
      updated builder instance
      See Also:
    • builderDecorator

      public BUILDER builderDecorator(Supplier<? extends TypeName> supplier)
      Builder decorator, if configured.
      Parameters:
      supplier - supplier of type of the builder decorator, if present
      Returns:
      updated builder instance
      See Also:
    • prototypeType

      public BUILDER prototypeType(TypeName prototypeType)
      Type name of the generated prototype interface.

      This interface will contain the following inner classes:

      • BuilderBase - base of the builder with all setters, to support prototype inheritance
      • Builder - builder extending the builder base that builds the prototype instance
      • implementation - prototype implementation class, supports inheritance as well
      If you modify the type name to be generated, the result will not support inheritance.
      Parameters:
      prototypeType - type of the prototype interface
      Returns:
      updated builder instance
      See Also:
    • prototypeType

      public BUILDER prototypeType(Consumer<TypeName.Builder> consumer)
      Type name of the generated prototype interface.

      This interface will contain the following inner classes:

      • BuilderBase - base of the builder with all setters, to support prototype inheritance
      • Builder - builder extending the builder base that builds the prototype instance
      • implementation - prototype implementation class, supports inheritance as well
      If you modify the type name to be generated, the result will not support inheritance.
      Parameters:
      consumer - consumer of builder of type of the prototype interface
      Returns:
      updated builder instance
      See Also:
    • prototypeType

      public BUILDER prototypeType(Supplier<? extends TypeName> supplier)
      Type name of the generated prototype interface.

      This interface will contain the following inner classes:

      • BuilderBase - base of the builder with all setters, to support prototype inheritance
      • Builder - builder extending the builder base that builds the prototype instance
      • implementation - prototype implementation class, supports inheritance as well
      If you modify the type name to be generated, the result will not support inheritance.
      Parameters:
      supplier - supplier of type of the prototype interface
      Returns:
      updated builder instance
      See Also:
    • defaultMethodsPredicate

      public BUILDER defaultMethodsPredicate(Predicate<String> defaultMethodsPredicate)
      A predicate to include possible interface default methods as options. The default behavior is to exclude all default methods.

      Sequence of checking if a default method should be an option method:

      • Check the method signature (i.e. process(java.lang.String), if accepted, use it as an option
      • Check the method name (i.e. process, if accepted, use it as an option
      • Otherwise the default method will not be an option
      Parameters:
      defaultMethodsPredicate - predicate for method names
      Returns:
      updated builder instance
      See Also:
    • accessModifier

      public BUILDER accessModifier(AccessModifier accessModifier)
      Access modifier for the generated prototype.
      Parameters:
      accessModifier - access modifier, defaults to public
      Returns:
      updated builder instance
      See Also:
    • builderAccessModifier

      public BUILDER builderAccessModifier(AccessModifier builderAccessModifier)
      Access modifier for the generated builder.
      Parameters:
      builderAccessModifier - access modifier, defaults to public
      Returns:
      updated builder instance
      See Also:
    • createEmptyCreate

      public BUILDER createEmptyCreate(boolean createEmptyCreate)
      Whether to create an empty create() method.
      Parameters:
      createEmptyCreate - whether to create an empty create() method, defaults to true
      Returns:
      updated builder instance
      See Also:
    • recordStyle

      public BUILDER recordStyle(boolean recordStyle)
      Whether to use record style or bean style accessors.

      Let's consider option accessModifier of type AccessModifier.

      Record style:

      • Getter: AccessModifier accessModifier()
      • Setter: Builder accessModifier(AccessModifier)
      Bean style:
      • Getter: AccessModifier getAccessModifier()
      • Setter: Builder setAccessModifier(AccessModifier)
      Parameters:
      recordStyle - whether to use record style accessors, defaults to true
      Returns:
      updated builder instance
      See Also:
    • clearConfigured

      public BUILDER clearConfigured()
      Clear existing value of configured.
      Returns:
      updated builder instance
      See Also:
    • configured

      public BUILDER configured(PrototypeConfigured configured)
      Prototype configuration details.
      Parameters:
      configured - prototype configuration details, if configured
      Returns:
      updated builder instance
      See Also:
    • configured

      public BUILDER configured(Consumer<PrototypeConfigured.Builder> consumer)
      Prototype configuration details.
      Parameters:
      consumer - consumer of builder of prototype configuration details, if configured
      Returns:
      updated builder instance
      See Also:
    • configured

      public BUILDER configured(Supplier<? extends PrototypeConfigured> supplier)
      Prototype configuration details.
      Parameters:
      supplier - supplier of prototype configuration details, if configured
      Returns:
      updated builder instance
      See Also:
    • registrySupport

      public BUILDER registrySupport(boolean registrySupport)
      Whether to use the service registry to discover providers.
      Parameters:
      registrySupport - whether to support service registry, defaults to false
      Returns:
      updated builder instance
      See Also:
    • detachBlueprint

      public BUILDER detachBlueprint(boolean detachBlueprint)
      Whether to detach the blueprint from the generated prototype.
      Parameters:
      detachBlueprint - true if the blueprint should not be extended by the prototype
      Returns:
      updated builder instance
      See Also:
    • clearSuperPrototype

      public BUILDER clearSuperPrototype()
      Clear existing value of superPrototype.
      Returns:
      updated builder instance
      See Also:
    • superPrototype

      public BUILDER superPrototype(TypeName superPrototype)
      If the blueprint extends an existing prototype (or blueprint), we must extend that prototype and also that prototype's builder.
      Parameters:
      superPrototype - super prototype, if present
      Returns:
      updated builder instance
      See Also:
    • superPrototype

      public BUILDER superPrototype(Consumer<TypeName.Builder> consumer)
      If the blueprint extends an existing prototype (or blueprint), we must extend that prototype and also that prototype's builder.
      Parameters:
      consumer - consumer of builder of super prototype, if present
      Returns:
      updated builder instance
      See Also:
    • superPrototype

      public BUILDER superPrototype(Supplier<? extends TypeName> supplier)
      If the blueprint extends an existing prototype (or blueprint), we must extend that prototype and also that prototype's builder.
      Parameters:
      supplier - supplier of super prototype, if present
      Returns:
      updated builder instance
      See Also:
    • clearSuperTypes

      public BUILDER clearSuperTypes()
      Clear all superTypes.
      Returns:
      updated builder instance
      See Also:
    • superTypes

      public BUILDER superTypes(Set<? extends TypeName> superTypes)
      List of types the prototype should extend. This list will always contain the blueprint interface, and Prototype.Api. This list also contains superPrototype() if present.
      Parameters:
      superTypes - types the prototype must extend
      Returns:
      updated builder instance
      See Also:
    • addSuperTypes

      public BUILDER addSuperTypes(Set<? extends TypeName> superTypes)
      List of types the prototype should extend. This list will always contain the blueprint interface, and Prototype.Api. This list also contains superPrototype() if present.
      Parameters:
      superTypes - types the prototype must extend
      Returns:
      updated builder instance
      See Also:
    • addSuperType

      public BUILDER addSuperType(TypeName superType)
      List of types the prototype should extend. This list will always contain the blueprint interface, and Prototype.Api. This list also contains superPrototype() if present.
      Parameters:
      superType - add single types the prototype must extend
      Returns:
      updated builder instance
      See Also:
    • addSuperType

      public BUILDER addSuperType(Consumer<TypeName.Builder> consumer)
      List of types the prototype should extend. This list will always contain the blueprint interface, and Prototype.Api. This list also contains superPrototype() if present.
      Parameters:
      consumer - consumer of builder for types the prototype must extend
      Returns:
      updated builder instance
      See Also:
    • clearProviderProvides

      public BUILDER clearProviderProvides()
      Clear all providerProvides.
      Returns:
      updated builder instance
      See Also:
    • providerProvides

      public BUILDER providerProvides(Set<? extends TypeName> providerProvides)
      Types the generated prototype should provide, if this prototype is/configures a service provider.
      Parameters:
      providerProvides - provider provides types
      Returns:
      updated builder instance
      See Also:
    • addProviderProvides

      public BUILDER addProviderProvides(Set<? extends TypeName> providerProvides)
      Types the generated prototype should provide, if this prototype is/configures a service provider.
      Parameters:
      providerProvides - provider provides types
      Returns:
      updated builder instance
      See Also:
    • addProviderProvide

      public BUILDER addProviderProvide(TypeName providerProvide)
      Types the generated prototype should provide, if this prototype is/configures a service provider.
      Parameters:
      providerProvide - add single provider provides types
      Returns:
      updated builder instance
      See Also:
    • addProviderProvide

      public BUILDER addProviderProvide(Consumer<TypeName.Builder> consumer)
      Types the generated prototype should provide, if this prototype is/configures a service provider.
      Parameters:
      consumer - consumer of builder for provider provides types
      Returns:
      updated builder instance
      See Also:
    • clearConstants

      public BUILDER clearConstants()
      Clear all constants.
      Returns:
      updated builder instance
      See Also:
    • constants

      public BUILDER constants(List<? extends PrototypeConstant> constants)
      Constants to be defined on the prototype. A constant may be either a reference to another constant or a generated value.
      Parameters:
      constants - constants to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addConstants

      public BUILDER addConstants(List<? extends PrototypeConstant> constants)
      Constants to be defined on the prototype. A constant may be either a reference to another constant or a generated value.
      Parameters:
      constants - constants to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addConstant

      public BUILDER addConstant(PrototypeConstant constant)
      Constants to be defined on the prototype. A constant may be either a reference to another constant or a generated value.
      Parameters:
      constant - add single constants to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addConstant

      public BUILDER addConstant(Consumer<PrototypeConstant.Builder> consumer)
      Constants to be defined on the prototype. A constant may be either a reference to another constant or a generated value.
      Parameters:
      consumer - consumer of builder for constants to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • clearPrototypeMethods

      public BUILDER clearPrototypeMethods()
      Clear all prototypeMethods.
      Returns:
      updated builder instance
      See Also:
    • prototypeMethods

      public BUILDER prototypeMethods(List<? extends GeneratedMethod> prototypeMethods)
      Additional methods to be added to the prototype as default methods.

      Non-default interface methods cannot be added, as the implementation is not customizable. This list does NOT contain option methods.

      Parameters:
      prototypeMethods - custom methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addPrototypeMethods

      public BUILDER addPrototypeMethods(List<? extends GeneratedMethod> prototypeMethods)
      Additional methods to be added to the prototype as default methods.

      Non-default interface methods cannot be added, as the implementation is not customizable. This list does NOT contain option methods.

      Parameters:
      prototypeMethods - custom methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addPrototypeMethod

      public BUILDER addPrototypeMethod(GeneratedMethod prototypeMethod)
      Additional methods to be added to the prototype as default methods.

      Non-default interface methods cannot be added, as the implementation is not customizable. This list does NOT contain option methods.

      Parameters:
      prototypeMethod - add single custom methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addPrototypeMethod

      public BUILDER addPrototypeMethod(Consumer<GeneratedMethod.Builder> consumer)
      Additional methods to be added to the prototype as default methods.

      Non-default interface methods cannot be added, as the implementation is not customizable. This list does NOT contain option methods.

      Parameters:
      consumer - consumer of builder for custom methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • clearBuilderMethods

      public BUILDER clearBuilderMethods()
      Clear all builderMethods.
      Returns:
      updated builder instance
      See Also:
    • builderMethods

      public BUILDER builderMethods(List<? extends GeneratedMethod> builderMethods)
      Additional methods to be added to the prototype builder base. It is your responsibility to ensure these methods do not conflict with option methods. This list does NOT contain option methods.
      Parameters:
      builderMethods - custom methods to add to the prototype builder base
      Returns:
      updated builder instance
      See Also:
    • addBuilderMethods

      public BUILDER addBuilderMethods(List<? extends GeneratedMethod> builderMethods)
      Additional methods to be added to the prototype builder base. It is your responsibility to ensure these methods do not conflict with option methods. This list does NOT contain option methods.
      Parameters:
      builderMethods - custom methods to add to the prototype builder base
      Returns:
      updated builder instance
      See Also:
    • addBuilderMethod

      public BUILDER addBuilderMethod(GeneratedMethod builderMethod)
      Additional methods to be added to the prototype builder base. It is your responsibility to ensure these methods do not conflict with option methods. This list does NOT contain option methods.
      Parameters:
      builderMethod - add single custom methods to add to the prototype builder base
      Returns:
      updated builder instance
      See Also:
    • addBuilderMethod

      public BUILDER addBuilderMethod(Consumer<GeneratedMethod.Builder> consumer)
      Additional methods to be added to the prototype builder base. It is your responsibility to ensure these methods do not conflict with option methods. This list does NOT contain option methods.
      Parameters:
      consumer - consumer of builder for custom methods to add to the prototype builder base
      Returns:
      updated builder instance
      See Also:
    • clearDeprecatedFactoryMethods

      @Deprecated(since="4.4.0", forRemoval=true) public BUILDER clearDeprecatedFactoryMethods()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use prototypeFactories(), or runtimeTypeFactories(), or configFactories() instead, only present for backwards compatibility
      Clear all deprecatedFactoryMethods.
      Returns:
      updated builder instance
      See Also:
    • deprecatedFactoryMethods

      @Deprecated(since="4.4.0", forRemoval=true) public BUILDER deprecatedFactoryMethods(List<? extends DeprecatedFactoryMethod> deprecatedFactoryMethods)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use prototypeFactories(), or runtimeTypeFactories(), or configFactories() instead, only present for backwards compatibility
      Static factory methods to be added to the prototype, or runtime type factory methods.

      This method exists only for backwards compatibility and will be removed in a future major version.

      Parameters:
      deprecatedFactoryMethods - a list of factory methods declared on the blueprint or a reference custom methods type
      Returns:
      updated builder instance
      See Also:
    • addDeprecatedFactoryMethods

      @Deprecated(since="4.4.0", forRemoval=true) public BUILDER addDeprecatedFactoryMethods(List<? extends DeprecatedFactoryMethod> deprecatedFactoryMethods)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use prototypeFactories(), or runtimeTypeFactories(), or configFactories() instead, only present for backwards compatibility
      Static factory methods to be added to the prototype, or runtime type factory methods.

      This method exists only for backwards compatibility and will be removed in a future major version.

      Parameters:
      deprecatedFactoryMethods - a list of factory methods declared on the blueprint or a reference custom methods type
      Returns:
      updated builder instance
      See Also:
    • clearPrototypeFactories

      public BUILDER clearPrototypeFactories()
      Clear all prototypeFactories.
      Returns:
      updated builder instance
      See Also:
    • prototypeFactories

      public BUILDER prototypeFactories(List<? extends GeneratedMethod> prototypeFactories)
      Static factory methods to be added to the prototype.
      Parameters:
      prototypeFactories - a list of factory methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addPrototypeFactories

      public BUILDER addPrototypeFactories(List<? extends GeneratedMethod> prototypeFactories)
      Static factory methods to be added to the prototype.
      Parameters:
      prototypeFactories - a list of factory methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addPrototypeFactory

      public BUILDER addPrototypeFactory(GeneratedMethod prototypeFactory)
      Static factory methods to be added to the prototype.
      Parameters:
      prototypeFactory - add single a list of factory methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • addPrototypeFactory

      public BUILDER addPrototypeFactory(Consumer<GeneratedMethod.Builder> consumer)
      Static factory methods to be added to the prototype.
      Parameters:
      consumer - consumer of builder for a list of factory methods to add to the prototype
      Returns:
      updated builder instance
      See Also:
    • clearConfigFactories

      public BUILDER clearConfigFactories()
      Clear all configFactories.
      Returns:
      updated builder instance
      See Also:
    • configFactories

      public BUILDER configFactories(List<? extends FactoryMethod> configFactories)
      Factory methods to be used when mapping config to types. These methods will never be made public.

      Config factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      configFactories - factory methods to use when mapping config to types
      Returns:
      updated builder instance
      See Also:
    • addConfigFactories

      public BUILDER addConfigFactories(List<? extends FactoryMethod> configFactories)
      Factory methods to be used when mapping config to types. These methods will never be made public.

      Config factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      configFactories - factory methods to use when mapping config to types
      Returns:
      updated builder instance
      See Also:
    • addConfigFactory

      public BUILDER addConfigFactory(FactoryMethod configFactory)
      Factory methods to be used when mapping config to types. These methods will never be made public.

      Config factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      configFactory - add single factory methods to use when mapping config to types
      Returns:
      updated builder instance
      See Also:
    • addConfigFactory

      public BUILDER addConfigFactory(Consumer<FactoryMethod.Builder> consumer)
      Factory methods to be used when mapping config to types. These methods will never be made public.

      Config factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      consumer - consumer of builder for factory methods to use when mapping config to types
      Returns:
      updated builder instance
      See Also:
    • clearRuntimeTypeFactories

      public BUILDER clearRuntimeTypeFactories()
      Clear all runtimeTypeFactories.
      Returns:
      updated builder instance
      See Also:
    • runtimeTypeFactories

      public BUILDER runtimeTypeFactories(List<? extends RuntimeTypeInfo> runtimeTypeFactories)
      Factory methods to create runtime types from a builder. If a method is available for a specific option and matches its types, a setter with a parameter of consumer of the builder type will be added to the builder base.

      Runtime factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      runtimeTypeFactories - factory methods to create runtime types from a builder
      Returns:
      updated builder instance
      See Also:
    • addRuntimeTypeFactories

      public BUILDER addRuntimeTypeFactories(List<? extends RuntimeTypeInfo> runtimeTypeFactories)
      Factory methods to create runtime types from a builder. If a method is available for a specific option and matches its types, a setter with a parameter of consumer of the builder type will be added to the builder base.

      Runtime factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      runtimeTypeFactories - factory methods to create runtime types from a builder
      Returns:
      updated builder instance
      See Also:
    • addRuntimeTypeFactory

      public BUILDER addRuntimeTypeFactory(RuntimeTypeInfo runtimeTypeFactory)
      Factory methods to create runtime types from a builder. If a method is available for a specific option and matches its types, a setter with a parameter of consumer of the builder type will be added to the builder base.

      Runtime factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      runtimeTypeFactory - add single factory methods to create runtime types from a builder
      Returns:
      updated builder instance
      See Also:
    • addRuntimeTypeFactory

      public BUILDER addRuntimeTypeFactory(Consumer<RuntimeTypeInfo.Builder> consumer)
      Factory methods to create runtime types from a builder. If a method is available for a specific option and matches its types, a setter with a parameter of consumer of the builder type will be added to the builder base.

      Runtime factory methods may exist for a specific option, or for any option that matches the type.

      Parameters:
      consumer - consumer of builder for factory methods to create runtime types from a builder
      Returns:
      updated builder instance
      See Also:
    • clearAnnotations

      public BUILDER clearAnnotations()
      Clear all annotations.
      Returns:
      updated builder instance
      See Also:
    • annotations

      public BUILDER annotations(List<? extends Annotation> annotations)
      Annotations option. Defined in Annotated.annotations()
      Parameters:
      annotations - the annotations option
      Returns:
      updated builder instance
      See Also:
    • addAnnotations

      public BUILDER addAnnotations(List<? extends Annotation> annotations)
      Annotations option. Defined in Annotated.annotations()
      Parameters:
      annotations - the annotations option
      Returns:
      updated builder instance
      See Also:
    • addAnnotation

      public BUILDER addAnnotation(Annotation annotation)
      Annotations option. Defined in Annotated.annotations()
      Parameters:
      annotation - add single the annotations option
      Returns:
      updated builder instance
      See Also:
    • addAnnotation

      public BUILDER addAnnotation(Consumer<Annotation.Builder> consumer)
      Annotations option. Defined in Annotated.annotations()
      Parameters:
      consumer - consumer of builder for the annotations option
      Returns:
      updated builder instance
      See Also:
    • clearInheritedAnnotations

      public BUILDER clearInheritedAnnotations()
      Clear all inheritedAnnotations.
      Returns:
      updated builder instance
      See Also:
    • inheritedAnnotations

      public BUILDER inheritedAnnotations(List<? extends Annotation> inheritedAnnotations)
      InheritedAnnotations option. Defined in Annotated.inheritedAnnotations()
      Parameters:
      inheritedAnnotations - the inheritedAnnotations option
      Returns:
      updated builder instance
      See Also:
    • addInheritedAnnotations

      public BUILDER addInheritedAnnotations(List<? extends Annotation> inheritedAnnotations)
      InheritedAnnotations option. Defined in Annotated.inheritedAnnotations()
      Parameters:
      inheritedAnnotations - the inheritedAnnotations option
      Returns:
      updated builder instance
      See Also:
    • addInheritedAnnotation

      public BUILDER addInheritedAnnotation(Annotation inheritedAnnotation)
      InheritedAnnotations option. Defined in Annotated.inheritedAnnotations()
      Parameters:
      inheritedAnnotation - add single the inheritedAnnotations option
      Returns:
      updated builder instance
      See Also:
    • addInheritedAnnotation

      public BUILDER addInheritedAnnotation(Consumer<Annotation.Builder> consumer)
      InheritedAnnotations option. Defined in Annotated.inheritedAnnotations()
      Parameters:
      consumer - consumer of builder for the inheritedAnnotations option
      Returns:
      updated builder instance
      See Also:
    • blueprint

      public Optional<TypeInfo> blueprint()
      Blueprint type info. A new prototype cannot be generated without a blueprint to base it on, so this is a required option.
      Returns:
      blueprint type information
    • runtimeType

      public Optional<TypeName> runtimeType()
      If the builder should act as a factory for another type, this is the type.

      Method Prototype.Builder.buildPrototype() builds the prototype, while method Builder.build() builds the runtime type.

      Returns:
      runtime type, if configured
    • javadoc

      public Optional<Javadoc> javadoc()
      Javadoc for the generated prototype.
      Returns:
      prototype javadoc
    • builderBaseJavadoc

      public Optional<Javadoc> builderBaseJavadoc()
      Javadoc for the builder base.
      Returns:
      builder base javadoc
    • builderJavadoc

      public Optional<Javadoc> builderJavadoc()
      Javadoc for the builder class.
      Returns:
      builder javadoc
    • builderDecorator

      public Optional<TypeName> builderDecorator()
      Builder decorator, if configured.
      Returns:
      type of the builder decorator, if present
    • prototypeType

      public Optional<TypeName> prototypeType()
      Type name of the generated prototype interface.

      This interface will contain the following inner classes:

      • BuilderBase - base of the builder with all setters, to support prototype inheritance
      • Builder - builder extending the builder base that builds the prototype instance
      • implementation - prototype implementation class, supports inheritance as well
      If you modify the type name to be generated, the result will not support inheritance.
      Returns:
      type of the prototype interface
    • defaultMethodsPredicate

      public Predicate<String> defaultMethodsPredicate()
      A predicate to include possible interface default methods as options. The default behavior is to exclude all default methods.

      Sequence of checking if a default method should be an option method:

      • Check the method signature (i.e. process(java.lang.String), if accepted, use it as an option
      • Check the method name (i.e. process, if accepted, use it as an option
      • Otherwise the default method will not be an option
      Returns:
      predicate for method names
    • accessModifier

      public AccessModifier accessModifier()
      Access modifier for the generated prototype.
      Returns:
      access modifier, defaults to public
    • builderAccessModifier

      public AccessModifier builderAccessModifier()
      Access modifier for the generated builder.
      Returns:
      access modifier, defaults to public
    • createEmptyCreate

      public boolean createEmptyCreate()
      Whether to create an empty create() method.
      Returns:
      whether to create an empty create() method, defaults to true
    • recordStyle

      public boolean recordStyle()
      Whether to use record style or bean style accessors.

      Let's consider option accessModifier of type AccessModifier.

      Record style:

      • Getter: AccessModifier accessModifier()
      • Setter: Builder accessModifier(AccessModifier)
      Bean style:
      • Getter: AccessModifier getAccessModifier()
      • Setter: Builder setAccessModifier(AccessModifier)
      Returns:
      whether to use record style accessors, defaults to true
    • configured

      public Optional<PrototypeConfigured> configured()
      Prototype configuration details.
      Returns:
      prototype configuration details, if configured
    • registrySupport

      public boolean registrySupport()
      Whether to use the service registry to discover providers.
      Returns:
      whether to support service registry, defaults to false
    • detachBlueprint

      public boolean detachBlueprint()
      Whether to detach the blueprint from the generated prototype.
      Returns:
      true if the blueprint should not be extended by the prototype
    • superPrototype

      public Optional<TypeName> superPrototype()
      If the blueprint extends an existing prototype (or blueprint), we must extend that prototype and also that prototype's builder.
      Returns:
      super prototype, if present
    • superTypes

      public Set<TypeName> superTypes()
      List of types the prototype should extend. This list will always contain the blueprint interface, and Prototype.Api. This list also contains superPrototype() if present.
      Returns:
      types the prototype must extend
    • providerProvides

      public Set<TypeName> providerProvides()
      Types the generated prototype should provide, if this prototype is/configures a service provider.
      Returns:
      provider provides types
    • constants

      public List<PrototypeConstant> constants()
      Constants to be defined on the prototype. A constant may be either a reference to another constant or a generated value.
      Returns:
      constants to add to the prototype
    • prototypeMethods

      public List<GeneratedMethod> prototypeMethods()
      Additional methods to be added to the prototype as default methods.

      Non-default interface methods cannot be added, as the implementation is not customizable. This list does NOT contain option methods.

      Returns:
      custom methods to add to the prototype
    • builderMethods

      public List<GeneratedMethod> builderMethods()
      Additional methods to be added to the prototype builder base. It is your responsibility to ensure these methods do not conflict with option methods. This list does NOT contain option methods.
      Returns:
      custom methods to add to the prototype builder base
    • deprecatedFactoryMethods

      @Deprecated(since="4.4.0", forRemoval=true) public List<DeprecatedFactoryMethod> deprecatedFactoryMethods()
      Deprecated, for removal: This API element is subject to removal in a future version.
      use prototypeFactories(), or runtimeTypeFactories(), or configFactories() instead, only present for backwards compatibility
      Static factory methods to be added to the prototype, or runtime type factory methods.

      This method exists only for backwards compatibility and will be removed in a future major version.

      Returns:
      a list of factory methods declared on the blueprint or a reference custom methods type
    • prototypeFactories

      public List<GeneratedMethod> prototypeFactories()
      Static factory methods to be added to the prototype.
      Returns:
      a list of factory methods to add to the prototype
    • configFactories

      public List<FactoryMethod> configFactories()
      Factory methods to be used when mapping config to types. These methods will never be made public.

      Config factory methods may exist for a specific option, or for any option that matches the type.

      Returns:
      factory methods to use when mapping config to types
    • runtimeTypeFactories

      public List<RuntimeTypeInfo> runtimeTypeFactories()
      Factory methods to create runtime types from a builder. If a method is available for a specific option and matches its types, a setter with a parameter of consumer of the builder type will be added to the builder base.

      Runtime factory methods may exist for a specific option, or for any option that matches the type.

      Returns:
      factory methods to create runtime types from a builder
    • annotations

      public List<Annotation> annotations()
      Annotations option. Defined in Annotated.annotations()
      Returns:
      the annotations option
    • inheritedAnnotations

      public List<Annotation> inheritedAnnotations()
      InheritedAnnotations option. Defined in Annotated.inheritedAnnotations()
      Returns:
      the inheritedAnnotations option
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.