public class AbstractConfig extends Object
This class holds both the original configuration that was provided as well as the parsed
Constructor and Description |
---|
AbstractConfig(ConfigDef definition,
Map<?,?> originals) |
AbstractConfig(ConfigDef definition,
Map<?,?> originals,
boolean doLog) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
protected Object |
get(String key) |
Boolean |
getBoolean(String key) |
Class<?> |
getClass(String key) |
<T> T |
getConfiguredInstance(String key,
Class<T> t)
Get a configured instance of the give class specified by the given configuration key.
|
<T> List<T> |
getConfiguredInstances(String key,
Class<T> t)
Get a list of configured instances of the given class specified by the given configuration key.
|
<T> List<T> |
getConfiguredInstances(String key,
Class<T> t,
Map<String,Object> configOverrides)
Get a list of configured instances of the given class specified by the given configuration key.
|
Double |
getDouble(String key) |
Integer |
getInt(String key) |
List<String> |
getList(String key) |
Long |
getLong(String key) |
org.apache.kafka.common.config.types.Password |
getPassword(String key) |
Short |
getShort(String key) |
String |
getString(String key) |
int |
hashCode() |
void |
ignore(String key) |
void |
logUnused()
Log warnings for any unused configurations
|
Map<String,Object> |
originals() |
Map<String,String> |
originalsStrings()
Get all the original settings, ensuring that all values are of type String.
|
Map<String,Object> |
originalsWithPrefix(String prefix)
Gets all original settings with the given prefix, stripping the prefix before adding it to the output.
|
protected Map<String,Object> |
postProcessParsedConfig(Map<String,Object> parsedValues)
Called directly after user configs got parsed (and thus default values got set).
|
ConfigDef.Type |
typeOf(String key) |
Set<String> |
unused() |
Map<String,?> |
values() |
Map<String,Object> |
valuesWithPrefixOverride(String prefix)
Put all keys that do not start with
prefix and their parsed values in the result map and then
put all the remaining keys with the prefix stripped and their parsed values in the result map. |
protected Map<String,Object> postProcessParsedConfig(Map<String,Object> parsedValues)
parsedValues
- unmodifiable map of current configurationpublic void ignore(String key)
public ConfigDef.Type typeOf(String key)
public org.apache.kafka.common.config.types.Password getPassword(String key)
public Map<String,String> originalsStrings()
ClassCastException
- if any of the values are not stringspublic Map<String,Object> originalsWithPrefix(String prefix)
prefix
- the prefix to use as a filterpublic Map<String,Object> valuesWithPrefixOverride(String prefix)
prefix
and their parsed values in the result map and then
put all the remaining keys with the prefix stripped and their parsed values in the result map.
This is useful if one wants to allow prefixed configs to override default ones.public void logUnused()
public <T> T getConfiguredInstance(String key, Class<T> t)
key
- The configuration key for the classt
- The interface the class should implementpublic <T> List<T> getConfiguredInstances(String key, Class<T> t)
key
- The configuration key for the classt
- The interface the class should implementpublic <T> List<T> getConfiguredInstances(String key, Class<T> t, Map<String,Object> configOverrides)
key
- The configuration key for the classt
- The interface the class should implementconfigOverrides
- Configuration overrides to use.