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

java.lang.Object
io.helidon.service.registry.Dependency.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:
Dependency.Builder
Enclosing interface:
Dependency

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

    • BuilderBase

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

    • from

      public BUILDER from(Dependency 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(Dependency.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
    • service

      public BUILDER service(TypeName service)
      Type name of the service that uses this dependency.
      Parameters:
      service - the service declaring this dependency
      Returns:
      updated builder instance
      See Also:
    • service

      public BUILDER service(Consumer<TypeName.Builder> consumer)
      Type name of the service that uses this dependency.
      Parameters:
      consumer - consumer of builder for the service declaring this dependency
      Returns:
      updated builder instance
      See Also:
    • service

      public BUILDER service(Supplier<? extends TypeName> supplier)
      Type name of the service that uses this dependency.
      Parameters:
      supplier - supplier of the service declaring this dependency
      Returns:
      updated builder instance
      See Also:
    • name

      public BUILDER name(String name)
      Name of the constructor parameter.
      Parameters:
      name - unique name of the parameter
      Returns:
      updated builder instance
      See Also:
    • contract

      public BUILDER contract(TypeName contract)
      Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example for List<MyService>, the contract is MyService.
      Parameters:
      contract - contract of the service we depend on
      Returns:
      updated builder instance
      See Also:
    • contract

      public BUILDER contract(Consumer<TypeName.Builder> consumer)
      Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example for List<MyService>, the contract is MyService.
      Parameters:
      consumer - consumer of builder for contract of the service we depend on
      Returns:
      updated builder instance
      See Also:
    • contract

      public BUILDER contract(Supplier<? extends TypeName> supplier)
      Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example for List<MyService>, the contract is MyService.
      Parameters:
      supplier - supplier of contract of the service we depend on
      Returns:
      updated builder instance
      See Also:
    • contractType

      public BUILDER contractType(GenericType<?> contractType)
      Generic type equivalent to DependencyBlueprint.contract(). We need both, to prevent reflection at runtime.
      Parameters:
      contractType - generic type of the dependency
      Returns:
      updated builder instance
      See Also:
    • descriptor

      public BUILDER descriptor(TypeName descriptor)
      Descriptor declaring this dependency. Descriptor is always public.
      Parameters:
      descriptor - descriptor
      Returns:
      updated builder instance
      See Also:
    • descriptor

      public BUILDER descriptor(Consumer<TypeName.Builder> consumer)
      Descriptor declaring this dependency. Descriptor is always public.
      Parameters:
      consumer - consumer of builder for descriptor
      Returns:
      updated builder instance
      See Also:
    • descriptor

      public BUILDER descriptor(Supplier<? extends TypeName> supplier)
      Descriptor declaring this dependency. Descriptor is always public.
      Parameters:
      supplier - supplier of descriptor
      Returns:
      updated builder instance
      See Also:
    • descriptorConstant

      public BUILDER descriptorConstant(String descriptorConstant)
      Field name that declares this dependency in the DependencyBlueprint.descriptor(). Can be used for code generation. This field is always a public constant.
      Parameters:
      descriptorConstant - field that has the dependency on the descriptor type
      Returns:
      updated builder instance
      See Also:
    • typeName

      public BUILDER typeName(TypeName typeName)
      Type of the dependency (exact parameter type with all generics).
      Parameters:
      typeName - type of the dependency as TypeName
      Returns:
      updated builder instance
      See Also:
    • typeName

      public BUILDER typeName(Consumer<TypeName.Builder> consumer)
      Type of the dependency (exact parameter type with all generics).
      Parameters:
      consumer - consumer of builder for type of the dependency as TypeName
      Returns:
      updated builder instance
      See Also:
    • typeName

      public BUILDER typeName(Supplier<? extends TypeName> supplier)
      Type of the dependency (exact parameter type with all generics).
      Parameters:
      supplier - supplier of type of the dependency as TypeName
      Returns:
      updated builder instance
      See Also:
    • service

      public Optional<TypeName> service()
      Type name of the service that uses this dependency.
      Returns:
      the service
    • name

      public Optional<String> name()
      Name of the constructor parameter.
      Returns:
      the name
    • contract

      public Optional<TypeName> contract()
      Each dependency ia a specific contract. Each service provides one or more contracts for dependencies. For example for List<MyService>, the contract is MyService.
      Returns:
      the contract
    • contractType

      public GenericType<?> contractType()
      Generic type equivalent to DependencyBlueprint.contract(). We need both, to prevent reflection at runtime.
      Returns:
      the contract type
    • descriptor

      public Optional<TypeName> descriptor()
      Descriptor declaring this dependency. Descriptor is always public.
      Returns:
      the descriptor
    • descriptorConstant

      public Optional<String> descriptorConstant()
      Field name that declares this dependency in the DependencyBlueprint.descriptor(). Can be used for code generation. This field is always a public constant.
      Returns:
      the descriptor constant
    • typeName

      public Optional<TypeName> typeName()
      Type of the dependency (exact parameter type with all generics).
      Returns:
      the type name
    • toString

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

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

      protected void validatePrototype()
      Validates required properties.