Module io.helidon.service.registry
Package io.helidon.service.registry
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 builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.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
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddContract
(ResolvedType contract) The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).addContract
(TypeName contract) The managed services advertised types (i.e., typically its interfaces).addContract
(Class<?> contract) The managed services advertised types (i.e., typically its interfaces).addContracts
(Set<? extends ResolvedType> contracts) The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).addFactoryType
(FactoryType factoryType) If configured, the lookup will return service factories of the chosen types.addFactoryTypes
(Set<? extends FactoryType> factoryTypes) If configured, the lookup will return service factories of the chosen types.addQualifier
(Qualifier qualifier) The managed service assigned Qualifier's.addQualifier
(Consumer<Qualifier.Builder> consumer) The managed service assigned Qualifier's.addQualifiers
(Set<? extends Qualifier> qualifiers) The managed service assigned Qualifier's.The managed service assigned Scope.addScope
(Consumer<TypeName.Builder> consumer) The managed service assigned Scope.The managed service assigned Scope.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.Clear existing value of this property.The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).contracts
(Set<? extends ResolvedType> contracts) The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).Optional
<GenericType<?>> A singleGenericType
can be defined if the lookup should also honorService.QualifiedFactory
services that can handle any type.contractType
(GenericType<?> contractType) A singleGenericType
can be defined if the lookup should also honorService.QualifiedFactory
services that can handle any type.Optionally, the injection point search applies to.dependency
(Dependency dependency) Optionally, the injection point search applies to.dependency
(Consumer<Dependency.Builder> consumer) Optionally, the injection point search applies to.If configured, the lookup will return service factories of the chosen types.factoryTypes
(Set<? extends FactoryType> factoryTypes) If configured, the lookup will return service factories of the chosen types.Update this builder from an existing prototype instance.from
(Lookup.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.boolean
Whether to include abstract type service descriptors.includeAbstract
(boolean includeAbstract) Whether to include abstract type service descriptors.Only lookup services with the provided named qualifier, where name is the fully qualified name of the class.Only lookup services with the provided named qualifier.protected void
Handles providers and decorators.The managed service assigned Qualifier's.qualifiers
(Set<? extends Qualifier> qualifiers) The managed service assigned Qualifier's.runLevel()
The optionalService.RunLevel
ascribed to the service.runLevel
(double runLevel) The optionalService.RunLevel
ascribed to the service.scopes()
The managed service assigned Scope.The managed service assigned Scope.The managed service implementation type name.serviceType
(TypeName serviceType) The managed service implementation type name.serviceType
(Class<?> contract) The managed service implementation type.serviceType
(Consumer<TypeName.Builder> consumer) The managed service implementation type name.toString()
protected void
Validates required properties.weight()
Weight that was declared on the type itself.weight
(double weight) Weight that was declared on the type itself.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
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
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
addContract
The managed services advertised types (i.e., typically its interfaces).- Parameters:
contract
- the service contracts implemented- Returns:
- updated builder instance
- See Also:
-
addContract
The managed services advertised types (i.e., typically its interfaces).- Parameters:
contract
- contract the service implements- Returns:
- updated builder instance
- See Also:
-
serviceType
The managed service implementation type.- Parameters:
contract
- the service type- Returns:
- updated builder instance
-
named
Only lookup services with the provided named qualifier.- Parameters:
name
- the name qualifier (useService.Named.WILDCARD_NAME
to find all- Returns:
- updated builder instance
-
named
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
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
serviceType
The managed service implementation type name.- Parameters:
serviceType
- the service type name- Returns:
- updated builder instance
- See Also:
-
serviceType
The managed service implementation type name.- Parameters:
consumer
- the service type name- Returns:
- updated builder instance
- See Also:
-
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
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
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
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
The managed service assigned Qualifier's.- Parameters:
qualifiers
- the service qualifiers- Returns:
- updated builder instance
- See Also:
-
addQualifiers
The managed service assigned Qualifier's.- Parameters:
qualifiers
- the service qualifiers- Returns:
- updated builder instance
- See Also:
-
addQualifier
The managed service assigned Qualifier's.- Parameters:
qualifier
- the service qualifiers- Returns:
- updated builder instance
- See Also:
-
addQualifier
The managed service assigned Qualifier's.- Parameters:
consumer
- the service qualifiers- Returns:
- updated builder instance
- See Also:
-
contracts
The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).- Parameters:
contracts
- the service contracts implemented- Returns:
- updated builder instance
- See Also:
-
addContracts
The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).- Parameters:
contracts
- the service contracts implemented- Returns:
- updated builder instance
- See Also:
-
addContract
The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).- Parameters:
contract
- the service contracts implemented- Returns:
- updated builder instance
- See Also:
-
clearContractType
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
contractType
A singleGenericType
can be defined if the lookup should also honorService.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
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
runLevel
The optionalService.RunLevel
ascribed to the service.- Parameters:
runLevel
- the service's run level- Returns:
- updated builder instance
- See Also:
-
clearWeight
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
weight
Weight that was declared on the type itself.- Parameters:
weight
- the declared weight- Returns:
- updated builder instance
- See Also:
-
includeAbstract
Whether to include abstract type service descriptors.- Parameters:
includeAbstract
- whether to include abstract classes and interfaces- Returns:
- updated builder instance
- See Also:
-
clearDependency
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
dependency
Optionally, the injection point search applies to. There are some service factories (such asService.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
Optionally, the injection point search applies to. There are some service factories (such asService.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
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:
FactoryType.SERVICE
- only services that directly implement the contractFactoryType.SUPPLIER
- only that areSupplier
of the contractFactoryType.QUALIFIED
- services that areService.QualifiedFactory
of the contractFactoryType.SERVICES
- services that areService.ServicesFactory
of the contractFactoryType.INJECTION_POINT
- services that areService.InjectionPointFactory
of the contractFactoryType.NONE
- this has no effect and will not modify the lookup
- Parameters:
factoryTypes
- desired factory types- Returns:
- updated builder instance
- See Also:
-
addFactoryTypes
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:
FactoryType.SERVICE
- only services that directly implement the contractFactoryType.SUPPLIER
- only that areSupplier
of the contractFactoryType.QUALIFIED
- services that areService.QualifiedFactory
of the contractFactoryType.SERVICES
- services that areService.ServicesFactory
of the contractFactoryType.INJECTION_POINT
- services that areService.InjectionPointFactory
of the contractFactoryType.NONE
- this has no effect and will not modify the lookup
- Parameters:
factoryTypes
- desired factory types- Returns:
- updated builder instance
- See Also:
-
addFactoryType
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:
FactoryType.SERVICE
- only services that directly implement the contractFactoryType.SUPPLIER
- only that areSupplier
of the contractFactoryType.QUALIFIED
- services that areService.QualifiedFactory
of the contractFactoryType.SERVICES
- services that areService.ServicesFactory
of the contractFactoryType.INJECTION_POINT
- services that areService.InjectionPointFactory
of the contractFactoryType.NONE
- this has no effect and will not modify the lookup
- Parameters:
factoryType
- desired factory types- Returns:
- updated builder instance
- See Also:
-
serviceType
The managed service implementation type name.- Returns:
- the service type
-
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
The managed service assigned Qualifier's.- Returns:
- the qualifiers
-
contracts
The managed services advertised types (i.e., typically its interfaces, can be throughService.ExternalContracts
).- Returns:
- the contracts
-
contractType
A singleGenericType
can be defined if the lookup should also honorService.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
The optionalService.RunLevel
ascribed to the service.- Returns:
- the run level
-
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
Optionally, the injection point search applies to. There are some service factories (such asService.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
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:
FactoryType.SERVICE
- only services that directly implement the contractFactoryType.SUPPLIER
- only that areSupplier
of the contractFactoryType.QUALIFIED
- services that areService.QualifiedFactory
of the contractFactoryType.SERVICES
- services that areService.ServicesFactory
of the contractFactoryType.INJECTION_POINT
- services that areService.InjectionPointFactory
of the contractFactoryType.NONE
- this has no effect and will not modify the lookup
- Returns:
- the factory types
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-