T
- The type of value associated with the configuration option.@Public public class ConfigOption<T> extends Object
ConfigOption
describes a configuration parameter. It encapsulates the configuration
key, deprecated older versions of the key, and an optional default value for the configuration
parameter.
ConfigOptions
are built via the ConfigOptions
class. Once created, a config
option is immutable.
Modifier and Type | Method and Description |
---|---|
T |
defaultValue()
Returns the default value, or null, if there is no default value.
|
Iterable<String> |
deprecatedKeys()
Deprecated.
Replaced by
fallbackKeys() |
Description |
description()
Returns the description of this option.
|
boolean |
equals(Object o) |
Iterable<FallbackKey> |
fallbackKeys()
Gets the fallback keys, in the order to be checked.
|
boolean |
hasDefaultValue()
Checks if this option has a default value.
|
boolean |
hasDeprecatedKeys()
Deprecated.
Replaced by
hasFallbackKeys() |
boolean |
hasFallbackKeys()
Checks whether this option has fallback keys.
|
int |
hashCode() |
String |
key()
Gets the configuration key.
|
String |
toString() |
ConfigOption<T> |
withDescription(Description description)
Creates a new config option, using this option's key and default value, and adding the given
description.
|
ConfigOption<T> |
withDescription(String description)
Creates a new config option, using this option's key and default value, and adding the given
description.
|
ConfigOption<T> |
withFallbackKeys(String... fallbackKeys)
Creates a new config option, using this option's key and default value, and adding the given
fallback keys.
|
public ConfigOption<T> withFallbackKeys(String... fallbackKeys)
When obtaining a value from the configuration via Options.get(ConfigOption)
, the
fallback keys will be checked in the order provided to this method. The first key for which a
value is found will be used - that value will be returned.
fallbackKeys
- The fallback keys, in the order in which they should be checked.public ConfigOption<T> withDescription(String description)
description
- The description for this option.public ConfigOption<T> withDescription(Description description)
description
- The description for this option.public String key()
public boolean hasDefaultValue()
public T defaultValue()
@Deprecated public boolean hasDeprecatedKeys()
hasFallbackKeys()
@Deprecated public Iterable<String> deprecatedKeys()
fallbackKeys()
public boolean hasFallbackKeys()
public Iterable<FallbackKey> fallbackKeys()
public Description description()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.