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

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

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

    • BuilderBase

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

    • from

      public BUILDER from(Lookup 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(Lookup.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
    • addContract

      public BUILDER addContract(Class<?> contract)
      The managed services advertised types (i.e., typically its interfaces).
      Parameters:
      contract - the service contracts implemented
      Returns:
      updated builder instance
      See Also:
      • LookupBlueprint.contracts()
    • addContract

      public BUILDER addContract(TypeName contract)
      The managed services advertised types (i.e., typically its interfaces).
      Parameters:
      contract - contract the service implements
      Returns:
      updated builder instance
      See Also:
      • LookupBlueprint.contracts()
    • serviceType

      public BUILDER serviceType(Class<?> contract)
      The managed service implementation type.
      Parameters:
      contract - the service type
      Returns:
      updated builder instance
    • named

      public BUILDER named(String name)
      Only lookup services with the provided named qualifier.
      Parameters:
      name - the name qualifier (use Service.Named.WILDCARD_NAME to find all
      Returns:
      updated builder instance
    • named

      public BUILDER named(Class<?> clazz)
      Only lookup services with the provided named qualifier, where name is the fully qualified name of the class.
      Parameters:
      clazz - fully qualified name of the class is the name qualifier to use
      Returns:
      updated builder instance
      See Also:
    • clearServiceType

      public BUILDER clearServiceType()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • serviceType

      public BUILDER serviceType(TypeName serviceType)
      The managed service implementation type name.
      Parameters:
      serviceType - the service type name
      Returns:
      updated builder instance
      See Also:
    • serviceType

      public BUILDER serviceType(Consumer<TypeName.Builder> consumer)
      The managed service implementation type name.
      Parameters:
      consumer - the service type name
      Returns:
      updated builder instance
      See Also:
    • scopes

      public BUILDER scopes(Set<? extends TypeName> scopes)
      The managed service assigned Scope. If empty, any scope is matched. If more than one value, any service in one of these scopes is matched.
      Parameters:
      scopes - the service scope type name
      Returns:
      updated builder instance
      See Also:
    • addScopes

      public BUILDER addScopes(Set<? extends TypeName> scopes)
      The managed service assigned Scope. If empty, any scope is matched. If more than one value, any service in one of these scopes is matched.
      Parameters:
      scopes - the service scope type name
      Returns:
      updated builder instance
      See Also:
    • addScope

      public BUILDER addScope(TypeName scope)
      The managed service assigned Scope. If empty, any scope is matched. If more than one value, any service in one of these scopes is matched.
      Parameters:
      scope - the service scope type name
      Returns:
      updated builder instance
      See Also:
    • addScope

      public BUILDER addScope(Consumer<TypeName.Builder> consumer)
      The managed service assigned Scope. If empty, any scope is matched. If more than one value, any service in one of these scopes is matched.
      Parameters:
      consumer - the service scope type name
      Returns:
      updated builder instance
      See Also:
    • qualifiers

      public BUILDER qualifiers(Set<? extends Qualifier> qualifiers)
      The managed service assigned Qualifier's.
      Parameters:
      qualifiers - the service qualifiers
      Returns:
      updated builder instance
      See Also:
    • addQualifiers

      public BUILDER addQualifiers(Set<? extends Qualifier> qualifiers)
      The managed service assigned Qualifier's.
      Parameters:
      qualifiers - the service qualifiers
      Returns:
      updated builder instance
      See Also:
    • addQualifier

      public BUILDER addQualifier(Qualifier qualifier)
      The managed service assigned Qualifier's.
      Parameters:
      qualifier - the service qualifiers
      Returns:
      updated builder instance
      See Also:
    • addQualifier

      public BUILDER addQualifier(Consumer<Qualifier.Builder> consumer)
      The managed service assigned Qualifier's.
      Parameters:
      consumer - the service qualifiers
      Returns:
      updated builder instance
      See Also:
    • contracts

      public BUILDER contracts(Set<? extends ResolvedType> contracts)
      The managed services advertised types (i.e., typically its interfaces, can be through Service.ExternalContracts).
      Parameters:
      contracts - the service contracts implemented
      Returns:
      updated builder instance
      See Also:
    • addContracts

      public BUILDER addContracts(Set<? extends ResolvedType> contracts)
      The managed services advertised types (i.e., typically its interfaces, can be through Service.ExternalContracts).
      Parameters:
      contracts - the service contracts implemented
      Returns:
      updated builder instance
      See Also:
    • addContract

      public BUILDER addContract(ResolvedType contract)
      The managed services advertised types (i.e., typically its interfaces, can be through Service.ExternalContracts).
      Parameters:
      contract - the service contracts implemented
      Returns:
      updated builder instance
      See Also:
    • clearContractType

      public BUILDER clearContractType()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • contractType

      public BUILDER contractType(GenericType<?> contractType)
      A single GenericType can be defined if the lookup should also honor Service.QualifiedFactory services that can handle any type. This would be the target type to convert to. If not specified, Object will be used.
      Parameters:
      contractType - generic type of the contract, if only one contract is desired
      Returns:
      updated builder instance
      See Also:
    • clearRunLevel

      public BUILDER clearRunLevel()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • runLevel

      public BUILDER runLevel(double runLevel)
      The optional Service.RunLevel ascribed to the service.
      Parameters:
      runLevel - the service's run level
      Returns:
      updated builder instance
      See Also:
    • clearWeight

      public BUILDER clearWeight()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • weight

      public BUILDER weight(double weight)
      Weight that was declared on the type itself.
      Parameters:
      weight - the declared weight
      Returns:
      updated builder instance
      See Also:
    • includeAbstract

      public BUILDER includeAbstract(boolean includeAbstract)
      Whether to include abstract type service descriptors.
      Parameters:
      includeAbstract - whether to include abstract classes and interfaces
      Returns:
      updated builder instance
      See Also:
    • clearDependency

      public BUILDER clearDependency()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • dependency

      public BUILDER dependency(Dependency dependency)
      Optionally, the injection point search applies to. There are some service factories (such as Service.InjectionPointFactory) that provide instances for a specific injection point. Such factories may require an injection point to be present, and may fail otherwise.

      Injection points of each service are generated as public constants on their respective service descriptors.

      Parameters:
      dependency - the optional injection point context info
      Returns:
      updated builder instance
      See Also:
    • dependency

      public BUILDER dependency(Consumer<Dependency.Builder> consumer)
      Optionally, the injection point search applies to. There are some service factories (such as Service.InjectionPointFactory) that provide instances for a specific injection point. Such factories may require an injection point to be present, and may fail otherwise.

      Injection points of each service are generated as public constants on their respective service descriptors.

      Parameters:
      consumer - the optional injection point context info
      Returns:
      updated builder instance
      See Also:
    • factoryTypes

      public BUILDER factoryTypes(Set<? extends FactoryType> factoryTypes)
      If configured, the lookup will return service factories of the chosen types. If no factory types are defined, service instances are returned.

      Otherwise only service factories of the chosen types are returned, as follows:

      Parameters:
      factoryTypes - desired factory types
      Returns:
      updated builder instance
      See Also:
    • addFactoryTypes

      public BUILDER addFactoryTypes(Set<? extends FactoryType> factoryTypes)
      If configured, the lookup will return service factories of the chosen types. If no factory types are defined, service instances are returned.

      Otherwise only service factories of the chosen types are returned, as follows:

      Parameters:
      factoryTypes - desired factory types
      Returns:
      updated builder instance
      See Also:
    • addFactoryType

      public BUILDER addFactoryType(FactoryType factoryType)
      If configured, the lookup will return service factories of the chosen types. If no factory types are defined, service instances are returned.

      Otherwise only service factories of the chosen types are returned, as follows:

      Parameters:
      factoryType - desired factory types
      Returns:
      updated builder instance
      See Also:
    • serviceType

      public Optional<TypeName> serviceType()
      The managed service implementation type name.
      Returns:
      the service type
    • scopes

      public Set<TypeName> scopes()
      The managed service assigned Scope. If empty, any scope is matched. If more than one value, any service in one of these scopes is matched.
      Returns:
      the scopes
    • qualifiers

      public Set<Qualifier> qualifiers()
      The managed service assigned Qualifier's.
      Returns:
      the qualifiers
    • contracts

      public Set<ResolvedType> contracts()
      The managed services advertised types (i.e., typically its interfaces, can be through Service.ExternalContracts).
      Returns:
      the contracts
    • contractType

      public Optional<GenericType<?>> contractType()
      A single GenericType can be defined if the lookup should also honor Service.QualifiedFactory services that can handle any type. This would be the target type to convert to. If not specified, Object will be used.
      Returns:
      the contract type
    • runLevel

      public Optional<Double> runLevel()
      The optional Service.RunLevel ascribed to the service.
      Returns:
      the run level
    • weight

      public Optional<Double> weight()
      Weight that was declared on the type itself.
      Returns:
      the weight
    • includeAbstract

      public boolean includeAbstract()
      Whether to include abstract type service descriptors.
      Returns:
      the include abstract
    • dependency

      public Optional<Dependency> dependency()
      Optionally, the injection point search applies to. There are some service factories (such as Service.InjectionPointFactory) that provide instances for a specific injection point. Such factories may require an injection point to be present, and may fail otherwise.

      Injection points of each service are generated as public constants on their respective service descriptors.

      Returns:
      the dependency
    • factoryTypes

      public Set<FactoryType> factoryTypes()
      If configured, the lookup will return service factories of the chosen types. If no factory types are defined, service instances are returned.

      Otherwise only service factories of the chosen types are returned, as follows:

      Returns:
      the factory types
    • toString

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

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

      protected void validatePrototype()
      Validates required properties.