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_r262567347
 
 

 ##########
 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);
+               } catch (final IllegalArgumentException | NullPointerException 
e) {
+                       final String errorMessage = String.format("Value for 
config option %s must be one of %s (was %s)",
+                               configOption.key(),
+                               Arrays.asList(enumClass.getEnumConstants()),
 
 Review comment:
   That's better. Fixed 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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to