GJL commented on a change in pull request #7883: [FLINK-11781][yarn] Remove
"DISABLED" as possible value for yarn.per-job-cluster.include-user-jar
URL: https://github.com/apache/flink/pull/7883#discussion_r262569743
##########
File path:
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
##########
@@ -608,6 +610,33 @@ public String getValue(ConfigOption<?> configOption) {
return o == null ? null : o.toString();
}
+ /**
+ * Returns the value associated with the given config option as an enum.
+ *
+ * @param enumClass The return enum class
+ * @param configOption The configuration option
+ * @throws IllegalArgumentException If the string associated with the
given config option cannot
+ * be parsed as a value of the
provided enum class.
+ */
+ @PublicEvolving
+ public <T extends Enum<T>> T getAsEnum(
+ final Class<T> enumClass,
+ final ConfigOption<String> configOption) {
+ checkNotNull(enumClass, "enumClass must not be null");
+ checkNotNull(configOption, "configOption must not be null");
+
+ final String configValue = getString(configOption);
+ try {
+ return T.valueOf(enumClass, configValue);
Review comment:
You are right. I added a test case for this.
----------------------------------------------------------------
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