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()
Gets the deprecated keys, in the order to be checked.
|
Description |
description()
Returns the description of this option.
|
boolean |
equals(Object o) |
boolean |
hasDefaultValue()
Checks if this option has a default value.
|
boolean |
hasDeprecatedKeys()
Checks whether this option has deprecated 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)
Deprecated.
use version with
Description |
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.@Deprecated public ConfigOption<T> withDescription(String description)
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()
public boolean hasDeprecatedKeys()
public Iterable<String> deprecatedKeys()
public Description description()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.