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 classGenerated 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) Manually register initial bindings for some of the services in the registry.booleanWhether to allow binding via methods, such asServices.set(Class, Object[]).allowLateBinding(boolean allowLateBinding) Whether to allow binding via methods, such asServices.set(Class, Object[]).Clear all runLevels.Clear all serviceDescriptors.booleanWhether to discover services from the class path.discoverServices(boolean discoverServices) Whether to discover services from the class path.booleanWhether 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.booleanFlag 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 toPostConstructetc.).limitActivationPhase(ActivationPhase limitActivationPhase) In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstructetc.).booleanFlag 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.intSize of the lookup cache whenServiceRegistryConfig.lookupCacheEnabled()is set totrue.lookupCacheSize(int lookupCacheSize) Size of the lookup cache whenServiceRegistryConfig.lookupCacheEnabled()is set totrue.doubleMaximal run level to handle when starting fromServiceRegistryManager.start(Binding).maxRunLevel(double maxRunLevel) Maximal run level to handle when starting fromServiceRegistryManager.start(Binding).protected voidHandles 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> BUILDERputServiceInstance(ServiceDescriptor<TYPE> key, TYPE serviceInstance) Manually register initial bindings for some of the services in the registry.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) Manually register initial bindings for some of the services in the registry.toString()booleanFlag 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 voidValidates required properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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 JavaServiceLoaderservices 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:
-
clearServiceDescriptors
Clear all serviceDescriptors.- 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- add single services to register- Returns:
- updated builder instance
- See Also:
-
serviceInstances
Manually register initial bindings for some of the services in the registry. This method replaces all values with the new ones.- Parameters:
serviceInstances- service instances to register- Returns:
- updated builder instance
- See Also:
-
addServiceInstances
Manually register initial bindings for some of the services in the registry. 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
Manually register initial bindings for some of the services in the registry. This method adds a new value to the map, or replaces it if the key already exists.- Type Parameters:
TYPE- The key and value has to use the same generic type.- 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 whenServiceRegistryConfig.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 toPostConstructetc.). 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:
-
clearRunLevels
Clear all runLevels.- Returns:
- updated builder instance
- See Also:
-
runLevels
Run levels that should be initialized at startup. GeneratedBindingwill 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. GeneratedBindingwill 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. GeneratedBindingwill 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- add single 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:
- whether to discover services from classpath, defaults to
true
-
discoverServicesFromServiceLoader
public boolean discoverServicesFromServiceLoader()Whether to discover services from Java service loader. SeeServiceDiscovery.SERVICES_LOADER_RESOURCE.- Returns:
- whether to discover Java
ServiceLoaderservices from classpath (a curated list only), defaults totrue
-
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:
- whether late binding is enabled, defaults to
true
-
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:
- services to register
-
serviceInstances
Manually register initial bindings for some of the services in the registry.- Returns:
- service instances to register
-
lookupCacheEnabled
public boolean lookupCacheEnabled()Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)) are cached.- Returns:
- the flag indicating whether service lookups are cached, defaults to
false
-
lookupCacheSize
public int lookupCacheSize()Size of the lookup cache whenServiceRegistryConfig.lookupCacheEnabled()is set totrue.- Returns:
- 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:
- whether to intercept calls at runtime, defaults to
true
-
limitActivationPhase
In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstructetc.). This can be used in special cases where the normal Injection startup should limit lifecycle up to a given phase.- Returns:
- the phase to stop at during lifecycle
-
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 flag indicating whether the provider is permitted to use binding generated code from compile-time,
defaults to
true - 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:
- maximal run level to lookup during application startup when using generated binding
-
runLevels
Run levels that should be initialized at startup. GeneratedBindingwill 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:
- run levels to initialize, up to
maxRunLevel(), only used when starting the registry throughServiceRegistryManager.start(Binding)orServiceRegistryManager.start(Binding, ServiceRegistryConfig)
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-