/** * Gets all original settings with the given prefix, stripping the prefix before adding it to the output. * * @param prefix the prefix to use as a filter * @return a Map containing the settings with the prefix */ public Map<String, Object> originalsWithPrefix(String prefix) { return originalsWithPrefix(prefix, true); }
/** * If at least one key with {@code prefix} exists, all prefixed values will be parsed and put into map. * If no value with {@code prefix} exists all unprefixed values will be returned. * * This is useful if one wants to allow prefixed configs to override default ones, but wants to use either * only prefixed configs or only regular configs, but not mix them. */ public Map<String, Object> valuesWithPrefixAllOrNothing(String prefix) { Map<String, Object> withPrefix = originalsWithPrefix(prefix, true); if (withPrefix.isEmpty()) { return new RecordingMap<>(values(), "", true); } else { Map<String, Object> result = new RecordingMap<>(prefix, true); for (Map.Entry<String, ?> entry : withPrefix.entrySet()) { ConfigDef.ConfigKey configKey = definition.configKeys().get(entry.getKey()); if (configKey != null) result.put(entry.getKey(), definition.parseValue(configKey, entry.getValue(), true)); } return result; } }
Map<String, Object> converterConfig = config.originalsWithPrefix(configPrefix); log.debug("Configuring the {} converter with configuration:{}{}", isKeyConverter ? "key" : "value", System.lineSeparator(), converterConfig);
Map<String, Object> converterConfig = config.originalsWithPrefix(configPrefix); converterConfig.put(ConverterConfig.TYPE_CONFIG, ConverterType.HEADER.getName()); log.debug("Configuring the header converter with configuration:{}{}", System.lineSeparator(), converterConfig);
Map<String, Object> configProviderConfig = config.originalsWithPrefix(configPrefix); plugin.configure(configProviderConfig); return plugin;