Module io.helidon.dbclient
Package io.helidon.dbclient
Class DbClientServiceBase.BuilderBase<B extends DbClientServiceBase.BuilderBase<B,T>,T extends DbClientServiceBase>
java.lang.Object
io.helidon.dbclient.DbClientServiceBase.BuilderBase<B,T>
- Type Parameters:
B
- type of the builder extending this classT
- Type of the builtDbClientServiceBase
instance
- Direct Known Subclasses:
DbClientMetricBuilder
,DbClientTracing.Builder
- Enclosing class:
DbClientServiceBase
public abstract static class DbClientServiceBase.BuilderBase<B extends DbClientServiceBase.BuilderBase<B,T>,T extends DbClientServiceBase>
extends Object
implements Builder<B,T>
A base class for builders of
DbClientServiceBase
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConfigure this client service from config.void
enabled
(boolean enabled) Configure whether this service is enabled or not.protected Predicate
<DbClientServiceContext> Predicate used to build a client service.Set of statement name patterns.statementNames
(String... names) Configure statement name patterns this service will be triggered for.protected B
statementNames
(List<String> names) Configures statement name patterns from configuration.statementPredicate
(Predicate<DbClientServiceContext> predicate) Configure a predicate whose result will be used to decide whether to trigger this service or not.protected Set
<DbStatementType> Set of statement types.statementTypes
(DbStatementType... types) Configure statement types this service will be triggered for.protected B
statementTypes
(List<DbStatementType> types) Configures statement types from configuration.
-
Constructor Details
-
BuilderBase
protected BuilderBase()Default constructor.
-
-
Method Details
-
config
Configure this client service from config.Supported keys:
Database Client Service configuration options key default value description statement-names An array of statement name patterns to apply this service for. If undefined, service would be executed for all statements. See statementNames(String...)
andPattern
statement-types An array of statement types to apply this service for. If undefined, service would be executed for all statements. See statementTypes(io.helidon.dbclient.DbStatementType...)
.enabled true
Whether this client service is enabled. See enabled(boolean)
- Parameters:
config
- configuration on the node of this service- Returns:
- updated builder instance
-
statementPredicate
Configure a predicate whose result will be used to decide whether to trigger this service or not.When a predicate is explicitly configured,
statementNames(String...)
andstatementTypes(io.helidon.dbclient.DbStatementType...)
is ignored.- Parameters:
predicate
- predicate that should returntrue
to enable this service, orfalse
to disable it- Returns:
- updated builder instance
-
statementTypes
Configure statement types this service will be triggered for. If an explicitstatementPredicate(java.util.function.Predicate)
is configured, this method is ignored.- Parameters:
types
- types that trigger this service- Returns:
- updated builder instance
-
statementNames
Configure statement name patterns this service will be triggered for. If an explicitstatementPredicate(java.util.function.Predicate)
is configured, this method is ignored.- Parameters:
names
- name patterns (as inPattern
) that trigger this service- Returns:
- updated builder instance
-
enabled
public void enabled(boolean enabled) Configure whether this service is enabled or not.- Parameters:
enabled
- whether to enable this service or disable it,true
by default
-
statementTypes
Configures statement types from configuration.- Parameters:
types
- types to add for this service- Returns:
- updated builder instance
-
statementNames
Configures statement name patterns from configuration.- Parameters:
names
- names to add for this service- Returns:
- updated builder instance
-
statementNames
Set of statement name patterns.- Returns:
- configured statement names
-
statementTypes
Set of statement types.- Returns:
- configured statement types
-
predicate
Predicate used to build a client service.The predicate always returns
false
if service is disabled.The predicate is obtained from the configured predicate using
statementPredicate(java.util.function.Predicate)
, if none is configured, it is created from configured statement types and statement names. If none are configured, the predicate just returnstrue
.- Returns:
- predicate to check whether this service should be invoked for current statement context
-