public class ConfigUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TIMESTAMP_FORMAT_EPOCH |
static java.lang.String |
TIMESTAMP_FORMAT_EPOCH_MILLIS |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
getBooleanWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.lang.Boolean defaultValue)
return boolean config value with default
|
static java.time.temporal.ChronoUnit |
getChronoUnit(java.lang.String timeResolutionStr)
convert ChronoUnit String to ChronoUnit enum
|
static java.time.Duration |
getDurationWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.time.Duration defaultValue)
return numeric config value with default
|
static java.lang.String |
getHoconString(com.typesafe.config.Config config,
java.lang.String path)
Get the typesafe
ConfigValue.render() with given path |
static int |
getIntWithDefault(com.typesafe.config.Config config,
java.lang.String path,
int defaultValue)
return int config value with default
|
static long |
getLongWithDefault(com.typesafe.config.Config config,
java.lang.String path,
long defaultValue)
return long config value with default
|
static java.lang.Number |
getNumberWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.lang.Number defaultValue)
return numeric config value with default
|
static java.util.List<java.lang.String> |
getStringList(com.typesafe.config.Config config,
java.lang.String path)
return a String list config value where the value can be either a single String or String list
|
static java.util.Map<java.lang.String,java.lang.String> |
getStringMap(com.typesafe.config.Config config)
return a String map config value where the key and value are both simple
String |
static java.lang.String |
getStringWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.lang.String defaultValue)
return string config value with default
|
static void |
validateTimestampPattern(java.lang.String fieldName,
java.lang.String fieldValue,
java.lang.String timestampPattern)
Check if the input timestamp pattern is valid by invoking the DateTimeFormatter.
|
static void |
validateTimestampPatternWithEpoch(java.lang.String fieldName,
java.lang.String fieldValue,
java.lang.String timestampPattern)
Check if the input timestamp pattern is valid by checking for epoch/epoch_millis and then invoking the DateTimeFormatter.
|
public static final java.lang.String TIMESTAMP_FORMAT_EPOCH
public static final java.lang.String TIMESTAMP_FORMAT_EPOCH_MILLIS
public static java.lang.String getStringWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.lang.String defaultValue)
config - typesafe config to read value frompath - path of the config valuepublic static int getIntWithDefault(com.typesafe.config.Config config,
java.lang.String path,
int defaultValue)
config - typesafe config to read value frompath - path of the config valuepublic static java.lang.Number getNumberWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.lang.Number defaultValue)
config - typesafe config to read value frompath - path of the config valuepublic static java.time.Duration getDurationWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.time.Duration defaultValue)
config - typesafe config to read value frompath - path of the config valuepublic static long getLongWithDefault(com.typesafe.config.Config config,
java.lang.String path,
long defaultValue)
config - typesafe config to read value frompath - path of the config valuepublic static boolean getBooleanWithDefault(com.typesafe.config.Config config,
java.lang.String path,
java.lang.Boolean defaultValue)
config - typesafe config to read value frompath - path of the config valuepublic static java.util.Map<java.lang.String,java.lang.String> getStringMap(com.typesafe.config.Config config)
Stringconfig - the typesafe config containing the String mappublic static java.time.temporal.ChronoUnit getChronoUnit(java.lang.String timeResolutionStr)
timeResolutionStr - the timeResolution Stringpublic static void validateTimestampPatternWithEpoch(java.lang.String fieldName,
java.lang.String fieldValue,
java.lang.String timestampPattern)
fieldName - Field name where present to throw a meaningful error messagetimestampPattern - The timestamp pattern stringpublic static void validateTimestampPattern(java.lang.String fieldName,
java.lang.String fieldValue,
java.lang.String timestampPattern)
fieldName - Field name where present to throw a meaningful error messagetimestampPattern - The timestamp pattern stringpublic static java.util.List<java.lang.String> getStringList(com.typesafe.config.Config config,
java.lang.String path)
config - the typesafe config to read value frompath - path of the config valuepublic static java.lang.String getHoconString(com.typesafe.config.Config config,
java.lang.String path)
ConfigValue.render() with given pathconfig - the typesafe object to read value frompath - the pathString representation for the ConfigValue, and null if the path does not exist