Module io.helidon.dbclient.common
Package io.helidon.dbclient.common
Class DbClientServiceBase.DbClientServiceBuilderBase<B extends DbClientServiceBase.DbClientServiceBuilderBase<B>>
- java.lang.Object
-
- io.helidon.dbclient.common.DbClientServiceBase.DbClientServiceBuilderBase<B>
-
- Type Parameters:
B
- type of the builder extending this class
- Direct Known Subclasses:
DbClientMetricBuilder
,DbClientTracing.Builder
- Enclosing class:
- DbClientServiceBase
public abstract static class DbClientServiceBase.DbClientServiceBuilderBase<B extends DbClientServiceBase.DbClientServiceBuilderBase<B>> extends Object
A base class for builders ofDbClientServiceBase
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DbClientServiceBuilderBase()
No-op constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description B
config(Config config)
Configure this client service from config.void
enabled(boolean enabled)
Configure whether this service is enabled or not.protected Predicate<DbClientServiceContext>
predicate()
Predicate used to build a client service.protected Set<String>
statementNames()
Set of statement name patterns.B
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.B
statementPredicate(Predicate<DbClientServiceContext> predicate)
Configure a predicate whose result will be used to decide whether to trigger this service or not.protected Set<DbStatementType>
statementTypes()
Set of statement types.B
statementTypes(DbStatementType... types)
Configure statement types this service will be triggered for.protected B
statementTypes(List<DbStatementType> types)
Configures statement types from configuration.
-
-
-
Method Detail
-
config
public B config(Config config)
Configure this client service from config.Supported keys:
DB 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
public B statementPredicate(Predicate<DbClientServiceContext> predicate)
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
public B statementTypes(DbStatementType... types)
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
public B statementNames(String... names)
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
protected B statementTypes(List<DbStatementType> types)
Configures statement types from configuration.- Parameters:
types
- types to add for this service- Returns:
- updated builder instance
-
statementNames
protected B statementNames(List<String> names)
Configures statement name patterns from configuration.- Parameters:
names
- names to add for this service- Returns:
- updated builder instance
-
statementNames
protected Set<String> statementNames()
Set of statement name patterns.- Returns:
- configured statement names
-
statementTypes
protected Set<DbStatementType> statementTypes()
Set of statement types.- Returns:
- configured statement types
-
predicate
protected Predicate<DbClientServiceContext> 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
-
-