public static Properties configToProperties(Config config, Optional<String> prefix) {
    Properties properties = new Properties();
    if (config != null) {
      Config resolvedConfig = config.resolve();
      for (Map.Entry<String, ConfigValue> entry : resolvedConfig.entrySet()) {
        if (!prefix.isPresent() || entry.getKey().startsWith(prefix.get())) {
          String propKey = desanitizeKey(entry.getKey());
          properties.setProperty(propKey, resolvedConfig.getString(entry.getKey()));
        }
      }
    }

    return properties;
  }
public static Properties configToProperties ( Config config , Optional < String > prefix ) { Properties properties = new Properties ( ) ; if ( config != null ) { Config resolvedConfig = config . resolve ( ) ; for ( Map . Entry < String , ConfigValue > entry : resolvedConfig . entrySet ( ) ) { if ( ! prefix . isPresent ( ) || entry . getKey ( ) . startsWith ( prefix . get ( ) ) ) { String propKey = desanitizeKey ( entry . getKey ( ) ) ; properties . setProperty ( propKey , resolvedConfig . getString ( entry . getKey ( ) ) ) ; } } } return properties ; }
Convert a given {@link Config} instance to a {@link Properties} instance.

@param config the given {@link Config} instance
@param prefix an optional prefix; if present, only properties whose name starts with the prefix
will be returned.
@return a {@link Properties} instance