Class ConfigUtils


  • @Internal
    public class ConfigUtils
    extends Object
    General utilities for parsing values to configuration options.
    • Method Detail

      • encodeArrayToConfig

        public static <IN,​OUT> void encodeArrayToConfig​(WritableConfig configuration,
                                                              ConfigOption<List<OUT>> key,
                                                              @Nullable
                                                              IN[] values,
                                                              Function<IN,​OUT> mapper)
        Puts an array of values of type IN in a WritableConfig as a ConfigOption of type List of type OUT. If the values is null or empty, then nothing is put in the configuration.
        Parameters:
        configuration - the configuration object to put the list in
        key - the option to serve as the key for the list in the configuration
        values - the array of values to put as value for the key
        mapper - the transformation function from IN to OUT.
      • encodeCollectionToConfig

        public static <IN,​OUT> void encodeCollectionToConfig​(WritableConfig configuration,
                                                                   ConfigOption<List<OUT>> key,
                                                                   @Nullable
                                                                   Collection<IN> values,
                                                                   Function<IN,​OUT> mapper)
        Puts a Collection of values of type IN in a WritableConfig as a ConfigOption of type List of type OUT. If the values is null or empty, then nothing is put in the configuration.
        Parameters:
        configuration - the configuration object to put the list in
        key - the option to serve as the key for the list in the configuration
        values - the collection of values to put as value for the key
        mapper - the transformation function from IN to OUT.
      • decodeListFromConfig

        public static <IN,​OUT,​E extends ThrowableList<OUT> decodeListFromConfig​(ReadableConfig configuration,
                                                                                              ConfigOption<List<IN>> key,
                                                                                              org.apache.flink.util.function.FunctionWithException<IN,​OUT,​E> mapper)
                                                                                       throws E extends Throwable
        Gets a List of values of type IN from a ReadableConfig and transforms it to a List of type OUT based on the provided mapper function.
        Parameters:
        configuration - the configuration object to get the value out of
        key - the option to serve as the key for the list in the configuration
        mapper - the transformation function from IN to OUT.
        Returns:
        the transformed values in a list of type OUT.
        Throws:
        E extends Throwable