Map<String, Object> result = new RecordingMap<>(values(), prefix, true); for (Map.Entry<String, ?> entry : originals.entrySet()) { if (entry.getKey().startsWith(prefix) && entry.getKey().length() > prefix.length()) {
Map<String, ?> configs; if (listenerName == null) configs = config.values(); else configs = config.valuesWithPrefixOverride(listenerName.configPrefix());
/** * 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; } }