Module io.helidon.service.registry
Package io.helidon.service.registry
Class ServiceRegistryConfig.BuilderBase<BUILDER extends ServiceRegistryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends ServiceRegistryConfig>
java.lang.Object
io.helidon.service.registry.ServiceRegistryConfig.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> Prototype.ConfiguredBuilder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
ServiceRegistryConfig.Builder
- Enclosing interface:
ServiceRegistryConfig
public abstract static class ServiceRegistryConfig.BuilderBase<BUILDER extends ServiceRegistryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends ServiceRegistryConfig>
extends Object
implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
ServiceRegistryConfig
.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddServiceDescriptor
(GeneratedService.Descriptor<?> serviceDescriptor) Manually registered service descriptors to add to the registry.addServiceDescriptors
(List<GeneratedService.Descriptor<?>> serviceDescriptors) Manually registered service descriptors to add to the registry.addServiceInstances
(Map<GeneratedService.Descriptor<?>, ?> serviceInstances) This method keeps existing values, then puts all new values into the map.config()
If this instance was configured, this would be the config instance used.Update builder from configuration (node of this type).boolean
Whether to discover services from the class path.discoverServices
(boolean discoverServices) Whether to discover services from the class path.boolean
Whether to discover services from Java service loader.discoverServicesFromServiceLoader
(boolean discoverServicesFromServiceLoader) Whether to discover services from Java service loader.from
(ServiceRegistryConfig prototype) Update this builder from an existing prototype instance.from
(ServiceRegistryConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.protected void
Handles providers and decorators.putContractInstance
(TypeName contract, Object instance) Put an instance of a contract outside of service described services.putContractInstance
(Class<?> contract, Object instance) Put an instance of a contract outside of service described services.<TYPE> BUILDER
putServiceInstance
(GeneratedService.Descriptor<TYPE> key, TYPE serviceInstance) This method adds a new value to the map, or replaces it if the key already exists.Manually registered service descriptors to add to the registry.serviceDescriptors
(List<GeneratedService.Descriptor<?>> serviceDescriptors) Manually registered service descriptors to add to the registry.Manually register initial bindings for some of the services in the registry.serviceInstances
(Map<GeneratedService.Descriptor<?>, ?> serviceInstances) This method replaces all values with the new ones.toString()
protected void
Validates required properties.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
Methods inherited from interface io.helidon.builder.api.Prototype.ConfiguredBuilder
discoverService, discoverServices
-
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
-
putContractInstance
Put an instance of a contract outside of service described services. This will create a "virtual" service descriptor that will not be valid for metadata operations.- Parameters:
contract
- contract to add a specific instance forinstance
- instance of the contract- Returns:
- updated builder instance
-
putContractInstance
Put an instance of a contract outside of service described services. This will create a "virtual" service descriptor that will not be valid for metadata operations.- Parameters:
contract
- contract to add a specific instance forinstance
- instance of the contract- Returns:
- updated builder instance
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
config
in interfacePrototype.ConfiguredBuilder<BUILDER extends ServiceRegistryConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends ServiceRegistryConfig> - Parameters:
config
- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
discoverServices
Whether to discover services from the class path. When set tofalse
, only services added throughserviceDescriptors()
and/orserviceInstances()
would be available.- Parameters:
discoverServices
- whether to discover services from classpath, defaults totrue
- Returns:
- updated builder instance
- See Also:
-
discoverServicesFromServiceLoader
Whether to discover services from Java service loader. SeeServiceDiscovery.SERVICES_LOADER_RESOURCE
.- Parameters:
discoverServicesFromServiceLoader
- whether to discover JavaServiceLoader
services from classpath (a curated list only), defaults totrue
- Returns:
- updated builder instance
- See Also:
-
serviceDescriptors
Manually registered service descriptors to add to the registry. This is useful whendiscoverServices()
is set tofalse
, to register only hand-picked services into the registry.Even when service discovery is used, this can be used to add service descriptors that are not part of a service discovery mechanism (such as testing services).
- Parameters:
serviceDescriptors
- services to register- Returns:
- updated builder instance
- See Also:
-
addServiceDescriptors
Manually registered service descriptors to add to the registry. This is useful whendiscoverServices()
is set tofalse
, to register only hand-picked services into the registry.Even when service discovery is used, this can be used to add service descriptors that are not part of a service discovery mechanism (such as testing services).
- Parameters:
serviceDescriptors
- services to register- Returns:
- updated builder instance
- See Also:
-
addServiceDescriptor
Manually registered service descriptors to add to the registry. This is useful whendiscoverServices()
is set tofalse
, to register only hand-picked services into the registry.Even when service discovery is used, this can be used to add service descriptors that are not part of a service discovery mechanism (such as testing services).
- Parameters:
serviceDescriptor
- services to register- Returns:
- updated builder instance
- See Also:
-
serviceInstances
This method replaces all values with the new ones.- Parameters:
serviceInstances
- service instances to register- Returns:
- updated builder instance
- See Also:
-
addServiceInstances
This method keeps existing values, then puts all new values into the map.- Parameters:
serviceInstances
- service instances to register- Returns:
- updated builder instance
- See Also:
-
putServiceInstance
public <TYPE> BUILDER putServiceInstance(GeneratedService.Descriptor<TYPE> key, TYPE serviceInstance) This method adds a new value to the map, or replaces it if the key already exists.- Type Parameters:
TYPE
- Type to correctly map key and value- Parameters:
key
- key to add or replaceserviceInstance
- new value for the key- Returns:
- updated builder instance
- See Also:
-
discoverServices
public boolean discoverServices()Whether to discover services from the class path. When set tofalse
, only services added throughserviceDescriptors()
and/orserviceInstances()
would be available.- Returns:
- the discover services
-
discoverServicesFromServiceLoader
public boolean discoverServicesFromServiceLoader()Whether to discover services from Java service loader. SeeServiceDiscovery.SERVICES_LOADER_RESOURCE
.- Returns:
- the discover services from service loader
-
serviceDescriptors
Manually registered service descriptors to add to the registry. This is useful whendiscoverServices()
is set tofalse
, to register only hand-picked services into the registry.Even when service discovery is used, this can be used to add service descriptors that are not part of a service discovery mechanism (such as testing services).
- Returns:
- the service descriptors
-
serviceInstances
Manually register initial bindings for some of the services in the registry.- Returns:
- the service instances
-
config
If this instance was configured, this would be the config instance used.- Returns:
- config node used to configure this builder, or empty if not configured
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-