public class PropertiesUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Properties |
flatten(Properties config)
Flatten a recursive
Properties to a first level property map. |
static boolean |
getBoolean(Properties config,
String key,
boolean defaultValue)
Get boolean from properties.
|
static int |
getInt(Properties config,
String key,
int defaultValue)
Get integer from properties.
|
static long |
getLong(Properties config,
String key,
long defaultValue)
Get long from properties.
|
static long |
getLong(Properties config,
String key,
long defaultValue,
org.slf4j.Logger logger)
Get long from properties.
|
public static int getInt(Properties config, String key, int defaultValue)
config
- Propertieskey
- key in PropertiesdefaultValue
- default value if value is not setpublic static long getLong(Properties config, String key, long defaultValue)
config
- Propertieskey
- key in PropertiesdefaultValue
- default value if value is not setpublic static long getLong(Properties config, String key, long defaultValue, org.slf4j.Logger logger)
config
- Propertieskey
- key in PropertiesdefaultValue
- default value if value is not setpublic static boolean getBoolean(Properties config, String key, boolean defaultValue)
true
iff the parsed value is "true".config
- Propertieskey
- key in PropertiesdefaultValue
- default value if value is not setpublic static Properties flatten(Properties config)
Properties
to a first level property map.
In some cases, KafkaProducer#propsToMap
for example, Properties is used purely as
a HashTable without considering its default properties.
config
- Properties to be flattenedCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.