...
Page properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Document the state by adding a label to the FLIP page with one of "discussion", "accepted", "released", "rejected".
|
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
- Deprecate getXXX(String key, XXX defaultValue) and setXXX(String key, XXX value), discussed in the preview thread, except the following:
- getString(String key, String defaultValue)
- setString(String key, String value)
- getBytes(String key, byte[] defaultValue) will be marked as @Internal
- setBytes(String key, byte[] bytes) will be marked as @Internal
getClass(String key, Class<? extends T> defaultValue, ClassLoader classLoader) will be marked as @Internal - setClass(String key, Class<?> klazz) will be marked as @Internal
- Update the comment in getString(String key, String defaultValue) and setString(String key, String value) to encourage users to use ConfigOption.
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Public public class Configuration extends ExecutionConfig.GlobalJobParameters implements IOReadableWritable, java.io.Serializable, Cloneable, ReadableConfig, WritableConfig { ... /** * Returns the value associated with the given key as a string. We encourage users and * developers to always use ConfigOption for getting the configurations if possible, for its * rich description, type, default-value and other supports. The string-key-based getter should * only be used when ConfigOption is not applicable, e.g., the key is programmatically generated * in runtime. * * @param key the key pointing to the associated value * @param defaultValue the default value which is returned in case there is no value associated * with the given key * @return the (default) value associated with the given key */ public String getString(String key, String defaultValue) { ... } /** * Adds the given key/value pair to the configuration object. We encourage users and developers * to always use ConfigOption for setting the configurations if possible, for its rich * description, type, default-value and other supports. The string-key-based setter should only * be used when ConfigOption is not applicable, e.g., the key is programmatically generated in * runtime. * * @param key the key of the key/value pair to be added * @param value the value of the key/value pair to be added */ public void setString(String key, String value) { ... } ... } |
2.2.2 Introduce public <T> T get(ConfigOption<T> configOption,
...
T overrideDefault)
Code Block |
---|
/** * Returns the value associated with the given config option as a T. If no value is mapped * under any key of the option, it returns the specified default instead of the option's default * value. * * @param configOption The configuration option * @param overrideDefault The value to return if no value was mapper for any key of the option * @return the (default)configured value associated with the given config option , or the overrideDefault */ @Nonnull @PublicEvolving public <T> T get(ConfigOption<T> configOption, @Nonnull T overrideDefault) { return getOptional(configOption).orElse(overrideDefault); } |
...