public interface DriverExecutionProfile extends OngoingConfigOptions<DriverExecutionProfile>
It is a collection of typed options.
Getters (such as getBoolean(DriverOption)
) are self-explanatory.
withXxx
methods (such as withBoolean(DriverOption, boolean)
) create a
"derived" profile, which is an on-the-fly copy of the profile with the new value (which
might be a new option, or overwrite an existing one). If the original configuration is reloaded,
all derived profiles get updated as well. For best performance, such derived profiles should be
used sparingly; it is better to have built-in profiles for common scenarios.
DriverConfig
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NAME
The name of the default profile (the string "default").
|
withClass
static final String DEFAULT_NAME
Named profiles can't use this name. If you try to declare such a profile, a runtime error will be thrown.
@NonNull String getName()
Derived profiles inherit the name of their parent.
boolean isDefined(@NonNull DriverOption option)
boolean getBoolean(@NonNull DriverOption option)
default boolean getBoolean(@NonNull DriverOption option, boolean defaultValue)
@NonNull List<Boolean> getBooleanList(@NonNull DriverOption option)
@Nullable default List<Boolean> getBooleanList(@NonNull DriverOption option, @Nullable List<Boolean> defaultValue)
int getInt(@NonNull DriverOption option)
default int getInt(@NonNull DriverOption option, int defaultValue)
@NonNull List<Integer> getIntList(@NonNull DriverOption option)
@Nullable default List<Integer> getIntList(@NonNull DriverOption option, @Nullable List<Integer> defaultValue)
long getLong(@NonNull DriverOption option)
default long getLong(@NonNull DriverOption option, long defaultValue)
@NonNull List<Long> getLongList(@NonNull DriverOption option)
@Nullable default List<Long> getLongList(@NonNull DriverOption option, @Nullable List<Long> defaultValue)
double getDouble(@NonNull DriverOption option)
default double getDouble(@NonNull DriverOption option, double defaultValue)
@NonNull List<Double> getDoubleList(@NonNull DriverOption option)
@Nullable default List<Double> getDoubleList(@NonNull DriverOption option, @Nullable List<Double> defaultValue)
@NonNull String getString(@NonNull DriverOption option)
@Nullable default String getString(@NonNull DriverOption option, @Nullable String defaultValue)
@NonNull List<String> getStringList(@NonNull DriverOption option)
@Nullable default List<String> getStringList(@NonNull DriverOption option, @Nullable List<String> defaultValue)
@NonNull Map<String,String> getStringMap(@NonNull DriverOption option)
@Nullable default Map<String,String> getStringMap(@NonNull DriverOption option, @Nullable Map<String,String> defaultValue)
long getBytes(@NonNull DriverOption option)
getLong(DriverOption)
, in case
implementations want to allow users to provide sizes in a more human-readable way, for
example "256 MB".default long getBytes(@NonNull DriverOption option, long defaultValue)
@NonNull List<Long> getBytesList(DriverOption option)
getBytes(DriverOption)
@Nullable default List<Long> getBytesList(DriverOption option, @Nullable List<Long> defaultValue)
@NonNull Duration getDuration(@NonNull DriverOption option)
@Nullable default Duration getDuration(@NonNull DriverOption option, @Nullable Duration defaultValue)
@NonNull List<Duration> getDurationList(@NonNull DriverOption option)
@Nullable default List<Duration> getDurationList(@NonNull DriverOption option, @Nullable List<Duration> defaultValue)
@NonNull default Object getComparisonKey(@NonNull DriverOption option)
This is used by the driver at initialization time, to compare profiles and determine if it
must create per-profile policies. For example, if two profiles have the same options in the
basic.load-balancing-policy
section, they will share the same policy instance. But if
their options differ, two separate instances will be created.
The runtime return type does not matter, as long as identical sections (same options with
same values, regardless of order) compare as equal and have the same hashCode()
. The
default implementation builds a map based on the entries from entrySet()
, it should be
good for most cases.
@NonNull SortedSet<Map.Entry<String,Object>> entrySet()
The keys are raw strings that match DriverOption.getPath()
.
The values are implementation-dependent. With the driver's default implementation, the
possible types are String
, Number
, Boolean
, Map<String,Object>
,
List<Object>
, or null
.
@NonNull default DriverExecutionProfile withBoolean(@NonNull DriverOption option, boolean value)
withBoolean
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withBooleanList(@NonNull DriverOption option, @NonNull List<Boolean> value)
withBooleanList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withInt(@NonNull DriverOption option, int value)
withInt
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withIntList(@NonNull DriverOption option, @NonNull List<Integer> value)
withIntList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withLong(@NonNull DriverOption option, long value)
withLong
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withLongList(@NonNull DriverOption option, @NonNull List<Long> value)
withLongList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withDouble(@NonNull DriverOption option, double value)
withDouble
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withDoubleList(@NonNull DriverOption option, @NonNull List<Double> value)
withDoubleList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withString(@NonNull DriverOption option, @NonNull String value)
withString
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withStringList(@NonNull DriverOption option, @NonNull List<String> value)
withStringList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withStringMap(@NonNull DriverOption option, @NonNull Map<String,String> value)
withStringMap
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withBytes(@NonNull DriverOption option, long value)
withBytes
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withBytesList(@NonNull DriverOption option, @NonNull List<Long> value)
withBytesList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withDuration(@NonNull DriverOption option, @NonNull Duration value)
withDuration
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile withDurationList(@NonNull DriverOption option, @NonNull List<Duration> value)
withDurationList
in interface OngoingConfigOptions<DriverExecutionProfile>
@NonNull default DriverExecutionProfile without(@NonNull DriverOption option)
without
in interface OngoingConfigOptions<DriverExecutionProfile>
Copyright © 2017–2024. All rights reserved.