T
- The type of value associated with the configuration option.@PublicEvolving 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> |
withDeprecatedKeys(String... deprecatedKeys)
Creates a new config option, using this option's key and default value, and adding the given
deprecated keys.
|
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 Configuration.getValue(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> withDeprecatedKeys(String... deprecatedKeys)
When obtaining a value from the configuration via Configuration.getValue(ConfigOption)
, the deprecated 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.
deprecatedKeys
- The deprecated 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 © 2014–2024 The Apache Software Foundation. All rights reserved.