kl0u commented on a change in pull request #9976: [FLINK-14493][core] Introduce
data types to ConfigOptions.
URL: https://github.com/apache/flink/pull/9976#discussion_r338459038
##########
File path:
flink-core/src/main/java/org/apache/flink/configuration/ConfigOption.java
##########
@@ -57,51 +59,51 @@
/** The description for this option. */
private final Description description;
- //
------------------------------------------------------------------------
-
/**
- * Creates a new config option with no fallback keys.
- *
- * @param key The current key for that config option
- * @param defaultValue The default value for this option
+ * Type of the value that this ConfigOption describes.
+ * <ul>
+ * <li>typeClass == atomic class (e.g. {@code Integer.class}) ->
{@code ConfigOption<Integer>}</li>
+ * <li>typeClass == {@code Map.class} -> {@code
ConfigOption<Map<String, String>>}</li>
+ * <li>typeClass == atomic class and isList == true for {@code
ConfigOption<List<Integer>>}</li>
+ * </ul>
*/
- ConfigOption(String key, T defaultValue) {
- this.key = checkNotNull(key);
- this.description = Description.builder().text("").build();
- this.defaultValue = defaultValue;
- this.fallbackKeys = EMPTY;
+ private final Class clazz;
+
+ private final boolean isList;
+
+ //
------------------------------------------------------------------------
+
+ Class getClazz() {
+ return clazz;
}
- /**
- * Creates a new config option with fallback keys.
- *
- * @param key The current key for that config option
- * @param description Description for that option
- * @param defaultValue The default value for this option
- * @param fallbackKeys The list of fallback keys, in the order to be
checked
- * @deprecated use version with {@link Description} instead
- */
- @Deprecated
- ConfigOption(String key, String description, T defaultValue,
FallbackKey... fallbackKeys) {
- this.key = checkNotNull(key);
- this.description =
Description.builder().text(description).build();
- this.defaultValue = defaultValue;
- this.fallbackKeys = fallbackKeys == null || fallbackKeys.length
== 0 ? EMPTY : fallbackKeys;
+ boolean isList() {
+ return isList;
}
/**
* Creates a new config option with fallback keys.
*
* @param key The current key for that config option
+ * @param clazz describes type of the ConfigOption, see description of
the clazz field
* @param description Description for that option
* @param defaultValue The default value for this option
+ * @param isList tells if the ConfigOption describes a list option, see
description of the clazz field
* @param fallbackKeys The list of fallback keys, in the order to be
checked
*/
- ConfigOption(String key, Description description, T defaultValue,
FallbackKey... fallbackKeys) {
+ ConfigOption(
+ String key,
+ Class clazz,
+ Description description,
+ T defaultValue,
+ boolean isList,
+ FallbackKey... fallbackKeys) {
this.key = checkNotNull(key);
this.description = description;
this.defaultValue = defaultValue;
this.fallbackKeys = fallbackKeys == null || fallbackKeys.length
== 0 ? EMPTY : fallbackKeys;
+ this.clazz = clazz;
Review comment:
Can this be `null`? If not we can `checkNotNull` on it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services