You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fa...@apache.org on 2024/01/19 06:05:30 UTC
(flink) 03/03: [FLINK-34080][configuration] Remove the `@Deprecated` for `getString(String key, String defaultValue)` of Configuration
This is an automated email from the ASF dual-hosted git repository.
fanrui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 725b3edc05a1f3f186626038f8a7e60c1d8dd4fb
Author: Rui Fan <19...@gmail.com>
AuthorDate: Fri Jan 12 16:35:39 2024 +0800
[FLINK-34080][configuration] Remove the `@Deprecated` for `getString(String key, String defaultValue)` of Configuration
---
.../org/apache/flink/configuration/Configuration.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java b/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
index 24c3971dc51..88fd93c0d72 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
@@ -160,16 +160,17 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters
}
/**
- * Returns the value associated with the given key as a string.
+ * 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
- * @deprecated use {@link #getString(ConfigOption, String)} or {@link
- * #getOptional(ConfigOption)}
*/
- @Deprecated
public String getString(String key, String defaultValue) {
return getRawValue(key)
.map(o -> ConfigurationUtils.convertToString(o, standardYaml))
@@ -205,7 +206,11 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters
}
/**
- * Adds the given key/value pair to the configuration object.
+ * 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