Interface PrototypeInfo

All Superinterfaces:
Annotated, Prototype.Api
All Known Implementing Classes:
PrototypeInfo.BuilderBase.PrototypeInfoImpl

public interface PrototypeInfo extends Prototype.Api, Annotated
Information about the prototype we are going to build.
See Also:
  • Method Details

    • builder

      static PrototypeInfo.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static PrototypeInfo.Builder builder(PrototypeInfo instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • 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.
      Returns:
      blueprint type information
    • runtimeType

      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

      Javadoc javadoc()
      Javadoc for the generated prototype.
      Returns:
      prototype javadoc
    • builderBaseJavadoc

      Javadoc builderBaseJavadoc()
      Javadoc for the builder base.
      Returns:
      builder base javadoc
    • builderJavadoc

      Javadoc builderJavadoc()
      Javadoc for the builder class.
      Returns:
      builder javadoc
    • builderDecorator

      Optional<TypeName> builderDecorator()
      Builder decorator, if configured.
      Returns:
      type of the builder decorator, if present
    • 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.
      Returns:
      type of the prototype interface
    • 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
      Returns:
      predicate for method names
    • accessModifier

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

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

      boolean createEmptyCreate()
      Whether to create an empty create() method.
      Returns:
      whether to create an empty create() method, defaults to true
    • 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)
      Returns:
      whether to use record style accessors, defaults to true
    • configured

      Prototype configuration details.
      Returns:
      prototype configuration details, if configured
    • registrySupport

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

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

      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

      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

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

      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

      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

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

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

      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

      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