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 a2cc47a71e17cb22a86fb19ddadcbf1fb4308274 Author: Rui Fan <[email protected]> AuthorDate: Fri Jan 12 16:20:12 2024 +0800 [FLINK-34080][configuration] Deprecate all getXxx and setXxx methods for Configuration --- .../apache/flink/configuration/Configuration.java | 61 ++++++++++++++++++++-- 1 file changed, 56 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 04f975d801d..24c3971dc51 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 @@ -125,6 +125,7 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @return The value associated with the given key, or the default value, if to entry for the * key exists. */ + @Deprecated @SuppressWarnings("unchecked") public <T> Class<T> getClass( String key, Class<? extends T> defaultValue, ClassLoader classLoader) @@ -153,6 +154,7 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @param klazz The value of the pair to be added * @see #getClass(String, Class, ClassLoader) */ + @Deprecated public void setClass(String key, Class<?> klazz) { setValueInternal(key, klazz.getName()); } @@ -179,7 +181,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption)} or {@link #getOptional(ConfigOption)} */ + @Deprecated @PublicEvolving public String getString(ConfigOption<String> configOption) { return getOptional(configOption).orElseGet(configOption::defaultValue); @@ -192,7 +196,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public String getString(ConfigOption<String> configOption, String overrideDefault) { return getOptional(configOption).orElse(overrideDefault); @@ -214,7 +220,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the option specifying the key to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public void setString(ConfigOption<String> key, String value) { setValueInternal(key.key(), value); @@ -227,7 +235,8 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @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 #getInteger(ConfigOption, int)} or {@link #getOptional(ConfigOption)} + * @deprecated use {@link #get(ConfigOption)}, {@link #get(ConfigOption, Object)} or {@link + * #getOptional(ConfigOption)} */ @Deprecated public int getInteger(String key, int defaultValue) { @@ -239,7 +248,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption)} or {@link #getOptional(ConfigOption)} */ + @Deprecated @PublicEvolving public int getInteger(ConfigOption<Integer> configOption) { return getOptional(configOption).orElseGet(configOption::defaultValue); @@ -253,7 +264,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @param configOption The configuration option * @param overrideDefault The value to return if no value was mapper for any key of the option * @return the configured value associated with the given config option, or the overrideDefault + * @deprecated use {@link #get(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public int getInteger(ConfigOption<Integer> configOption, int overrideDefault) { return getOptional(configOption).orElse(overrideDefault); @@ -264,7 +277,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the key of the key/value pair to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated public void setInteger(String key, int value) { setValueInternal(key, value); } @@ -275,7 +290,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the option specifying the key to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public void setInteger(ConfigOption<Integer> key, int value) { setValueInternal(key.key(), value); @@ -288,7 +305,8 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @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 #getLong(ConfigOption, long)} or {@link #getOptional(ConfigOption)} + * @deprecated use {@link #get(ConfigOption)}, {@link #get(ConfigOption, Object)} or {@link + * #getOptional(ConfigOption)} */ @Deprecated public long getLong(String key, long defaultValue) { @@ -300,7 +318,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption)} or {@link #getOptional(ConfigOption)} */ + @Deprecated @PublicEvolving public long getLong(ConfigOption<Long> configOption) { return getOptional(configOption).orElseGet(configOption::defaultValue); @@ -314,7 +334,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @param configOption The configuration option * @param overrideDefault The value to return if no value was mapper for any key of the option * @return the configured value associated with the given config option, or the overrideDefault + * @deprecated use {@link #get(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public long getLong(ConfigOption<Long> configOption, long overrideDefault) { return getOptional(configOption).orElse(overrideDefault); @@ -325,7 +347,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the key of the key/value pair to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated public void setLong(String key, long value) { setValueInternal(key, value); } @@ -336,7 +360,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the option specifying the key to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public void setLong(ConfigOption<Long> key, long value) { setValueInternal(key.key(), value); @@ -349,7 +375,7 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @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 #getBoolean(ConfigOption, boolean)} or {@link + * @deprecated use {@link #get(ConfigOption)}, {@link #get(ConfigOption, Object)} or {@link * #getOptional(ConfigOption)} */ @Deprecated @@ -362,7 +388,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption)} or {@link #getOptional(ConfigOption)} */ + @Deprecated @PublicEvolving public boolean getBoolean(ConfigOption<Boolean> configOption) { return getOptional(configOption).orElseGet(configOption::defaultValue); @@ -376,7 +404,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @param configOption The configuration option * @param overrideDefault The value to return if no value was mapper for any key of the option * @return the configured value associated with the given config option, or the overrideDefault + * @deprecated use {@link #get(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public boolean getBoolean(ConfigOption<Boolean> configOption, boolean overrideDefault) { return getOptional(configOption).orElse(overrideDefault); @@ -387,7 +417,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the key of the key/value pair to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated public void setBoolean(String key, boolean value) { setValueInternal(key, value); } @@ -398,7 +430,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the option specifying the key to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public void setBoolean(ConfigOption<Boolean> key, boolean value) { setValueInternal(key.key(), value); @@ -411,7 +445,8 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @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 #getFloat(ConfigOption, float)} or {@link #getOptional(ConfigOption)} + * @deprecated use {@link #get(ConfigOption)}, {@link #get(ConfigOption, Object)} or {@link + * #getOptional(ConfigOption)} */ @Deprecated public float getFloat(String key, float defaultValue) { @@ -423,7 +458,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption)} or {@link #getOptional(ConfigOption)} */ + @Deprecated @PublicEvolving public float getFloat(ConfigOption<Float> configOption) { return getOptional(configOption).orElseGet(configOption::defaultValue); @@ -437,7 +474,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @param configOption The configuration option * @param overrideDefault The value to return if no value was mapper for any key of the option * @return the configured value associated with the given config option, or the overrideDefault + * @deprecated use {@link #get(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public float getFloat(ConfigOption<Float> configOption, float overrideDefault) { return getOptional(configOption).orElse(overrideDefault); @@ -448,7 +487,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the key of the key/value pair to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated public void setFloat(String key, float value) { setValueInternal(key, value); } @@ -459,7 +500,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the option specifying the key to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public void setFloat(ConfigOption<Float> key, float value) { setValueInternal(key.key(), value); @@ -472,7 +515,7 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @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 #getDouble(ConfigOption, double)} or {@link + * @deprecated use {@link #get(ConfigOption)}, {@link #get(ConfigOption, Object)} or {@link * #getOptional(ConfigOption)} */ @Deprecated @@ -485,7 +528,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param configOption The configuration option * @return the (default) value associated with the given config option + * @deprecated use {@link #get(ConfigOption)} or {@link #getOptional(ConfigOption)} */ + @Deprecated @PublicEvolving public double getDouble(ConfigOption<Double> configOption) { return getOptional(configOption).orElseGet(configOption::defaultValue); @@ -499,7 +544,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * @param configOption The configuration option * @param overrideDefault The value to return if no value was mapper for any key of the option * @return the configured value associated with the given config option, or the overrideDefault + * @deprecated use {@link #get(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public double getDouble(ConfigOption<Double> configOption, double overrideDefault) { return getOptional(configOption).orElse(overrideDefault); @@ -510,7 +557,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the key of the key/value pair to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated public void setDouble(String key, double value) { setValueInternal(key, value); } @@ -521,7 +570,9 @@ public class Configuration extends ExecutionConfig.GlobalJobParameters * * @param key the option specifying the key to be added * @param value the value of the key/value pair to be added + * @deprecated use {@link #set(ConfigOption, Object)} */ + @Deprecated @PublicEvolving public void setDouble(ConfigOption<Double> key, double value) { setValueInternal(key.key(), value);
