Class ServiceRegistryConfig.BuilderBase<BUILDER extends ServiceRegistryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends ServiceRegistryConfig>
- 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:
ServiceRegistryConfig.Builder
- Enclosing interface:
ServiceRegistryConfig
ServiceRegistryConfig
.-
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 TypeMethodDescriptionaddRunLevel
(Double runLevel) Run levels that should be initialized at startup.addRunLevels
(List<Double> runLevels) Run levels that should be initialized at startup.addServiceDescriptor
(ServiceDescriptor<?> serviceDescriptor) Manually registered service descriptors to add to the registry.addServiceDescriptors
(List<ServiceDescriptor<?>> serviceDescriptors) Manually registered service descriptors to add to the registry.addServiceInstances
(Map<ServiceDescriptor<?>, ?> serviceInstances) This method keeps existing values, then puts all new values into the map.boolean
Whether to allow binding via methods, such asServices.set(Class, Object[])
.allowLateBinding
(boolean allowLateBinding) Whether to allow binding via methods, such asServices.set(Class, Object[])
.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.boolean
Flag indicating whether runtime interception is enabled.interceptionEnabled
(boolean interceptionEnabled) Flag indicating whether runtime interception is enabled.In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstruct
etc.).limitActivationPhase
(ActivationPhase limitActivationPhase) In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstruct
etc.).boolean
Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)
) are cached.lookupCacheEnabled
(boolean lookupCacheEnabled) Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)
) are cached.int
Size of the lookup cache whenServiceRegistryConfigBlueprint.lookupCacheEnabled()
is set totrue
.lookupCacheSize
(int lookupCacheSize) Size of the lookup cache whenServiceRegistryConfigBlueprint.lookupCacheEnabled()
is set totrue
.double
Maximal run level to handle when starting fromServiceRegistryManager.start(Binding)
.maxRunLevel
(double maxRunLevel) Maximal run level to handle when starting fromServiceRegistryManager.start(Binding)
.protected void
Handles providers and decorators.putContractInstance
(TypeName contract, Object instance) Put an instance of a contract.putContractInstance
(Class<?> contract, Object instance) Put an instance of a contract.<TYPE> BUILDER
putServiceInstance
(ServiceDescriptor<TYPE> key, TYPE serviceInstance) This method adds a new value to the map, or replaces it if the key already exists.Run levels that should be initialized at startup.Run levels that should be initialized at startup.Manually registered service descriptors to add to the registry.serviceDescriptors
(List<ServiceDescriptor<?>> serviceDescriptors) Manually registered service descriptors to add to the registry.Manually register initial bindings for some of the services in the registry.serviceInstances
(Map<ServiceDescriptor<?>, ?> serviceInstances) This method replaces all values with the new ones.toString()
boolean
Flag indicating whether compile-time generatedBinding
's should be used at initialization when starting the registry usingServiceRegistryManager.start(Binding)
.useBinding
(boolean useBinding) Flag indicating whether compile-time generatedBinding
's should be used at initialization when starting the registry usingServiceRegistryManager.start(Binding)
.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
-
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. In case there is a descriptor that matches the contract (i.e. the service type is the provided contract), the instance will be assigned that descriptor. The instance would be outside of service described services otherwise, creating a "virtual" service descriptor that will not be valid for metadata operations.If there is no descriptor for the contract, you will not be able to use our Maven plugin to code generate bindings and main classes.
- Parameters:
contract
- contract to add a specific instance forinstance
- instance of the contract- Returns:
- updated builder instance
-
putContractInstance
Put an instance of a contract. In case there is a descriptor that matches the contract (i.e. the service type is the provided contract), the instance will be assigned that descriptor. The instance would be outside of service described services otherwise, creating a "virtual" service descriptor that will not be valid for metadata operations.If there is no descriptor for the contract, you will not be able to use our Maven plugin to code generate bindings and main classes.
- Parameters:
contract
- contract to add a specific instance forinstance
- instance of the contract- 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:
-
allowLateBinding
Whether to allow binding via methods, such asServices.set(Class, Object[])
. When disabled, attempts at late binding will throw an exception.- Parameters:
allowLateBinding
- whether late binding is enabled, 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
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:
-
lookupCacheEnabled
Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)
) are cached.- Parameters:
lookupCacheEnabled
- the flag indicating whether service lookups are cached, defaults tofalse
- Returns:
- updated builder instance
- See Also:
-
lookupCacheSize
Size of the lookup cache whenServiceRegistryConfigBlueprint.lookupCacheEnabled()
is set totrue
.- Parameters:
lookupCacheSize
- cache size- Returns:
- updated builder instance
- See Also:
-
interceptionEnabled
Flag indicating whether runtime interception is enabled. If set tofalse
, methods will be invoked without any interceptors, even if interceptors are available.- Parameters:
interceptionEnabled
- whether to intercept calls at runtime, defaults totrue
- Returns:
- updated builder instance
- See Also:
-
limitActivationPhase
In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstruct
etc.). This can be used in special cases where the normal Injection startup should limit lifecycle up to a given phase.- Parameters:
limitActivationPhase
- the phase to stop at during lifecycle- Returns:
- updated builder instance
- See Also:
-
useBinding
Flag indicating whether compile-time generatedBinding
's should be used at initialization when starting the registry usingServiceRegistryManager.start(Binding)
.This option is ignored when starting the service registry in any other way.
- Parameters:
useBinding
- the flag indicating whether the provider is permitted to use binding generated code from compile-time, defaults totrue
- Returns:
- updated builder instance
- See Also:
-
maxRunLevel
Maximal run level to handle when starting fromServiceRegistryManager.start(Binding)
. This setting is ignored when starting registry using other means, as run levels are not handled by default.- Parameters:
maxRunLevel
- maximal run level to lookup during application startup when using generated binding- Returns:
- updated builder instance
- See Also:
-
runLevels
Run levels that should be initialized at startup. GeneratedBinding
will configure all declared run levels of services in the application.Note that the result WILL be ordered before use, so initialization will always be handled from the smallest run level to the highest.
- Parameters:
runLevels
- run levels to initialize, up tomaxRunLevel()
, only used when starting the registry throughServiceRegistryManager.start(Binding)
orServiceRegistryManager.start(Binding, ServiceRegistryConfig)
- Returns:
- updated builder instance
- See Also:
-
addRunLevels
Run levels that should be initialized at startup. GeneratedBinding
will configure all declared run levels of services in the application.Note that the result WILL be ordered before use, so initialization will always be handled from the smallest run level to the highest.
- Parameters:
runLevels
- run levels to initialize, up tomaxRunLevel()
, only used when starting the registry throughServiceRegistryManager.start(Binding)
orServiceRegistryManager.start(Binding, ServiceRegistryConfig)
- Returns:
- updated builder instance
- See Also:
-
addRunLevel
Run levels that should be initialized at startup. GeneratedBinding
will configure all declared run levels of services in the application.Note that the result WILL be ordered before use, so initialization will always be handled from the smallest run level to the highest.
- Parameters:
runLevel
- run levels to initialize, up tomaxRunLevel()
, only used when starting the registry throughServiceRegistryManager.start(Binding)
orServiceRegistryManager.start(Binding, ServiceRegistryConfig)
- 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
-
allowLateBinding
public boolean allowLateBinding()Whether to allow binding via methods, such asServices.set(Class, Object[])
. When disabled, attempts at late binding will throw an exception.- Returns:
- the allow late binding
-
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
-
lookupCacheEnabled
public boolean lookupCacheEnabled()Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)
) are cached.- Returns:
- the lookup cache enabled
-
lookupCacheSize
public int lookupCacheSize()Size of the lookup cache whenServiceRegistryConfigBlueprint.lookupCacheEnabled()
is set totrue
.- Returns:
- the lookup cache size
-
interceptionEnabled
public boolean interceptionEnabled()Flag indicating whether runtime interception is enabled. If set tofalse
, methods will be invoked without any interceptors, even if interceptors are available.- Returns:
- the interception enabled
-
limitActivationPhase
In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstruct
etc.). This can be used in special cases where the normal Injection startup should limit lifecycle up to a given phase.- Returns:
- the limit activation phase
-
useBinding
public boolean useBinding()Flag indicating whether compile-time generatedBinding
's should be used at initialization when starting the registry usingServiceRegistryManager.start(Binding)
.This option is ignored when starting the service registry in any other way.
- Returns:
- the use binding
- See Also:
-
maxRunLevel
public double maxRunLevel()Maximal run level to handle when starting fromServiceRegistryManager.start(Binding)
. This setting is ignored when starting registry using other means, as run levels are not handled by default.- Returns:
- the max run level
-
runLevels
Run levels that should be initialized at startup. GeneratedBinding
will configure all declared run levels of services in the application.Note that the result WILL be ordered before use, so initialization will always be handled from the smallest run level to the highest.
- Returns:
- the run levels
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-