Package com.typesafe.config
Class ConfigUtil
- java.lang.Object
-
- com.typesafe.config.ConfigUtil
-
public final class ConfigUtil extends java.lang.Object
Contains static utility methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
joinPath(java.lang.String... elements)
Converts a list of keys to a path expression, by quoting the path elements as needed and then joining them separated by a period.static java.lang.String
joinPath(java.util.List<java.lang.String> elements)
Converts a list of strings to a path expression, by quoting the path elements as needed and then joining them separated by a period.static java.lang.String
quoteString(java.lang.String s)
Quotes and escapes a string, as in the JSON specification.static java.util.List<java.lang.String>
splitPath(java.lang.String path)
Converts a path expression into a list of keys, by splitting on period and unquoting the individual path elements.
-
-
-
Method Detail
-
quoteString
public static java.lang.String quoteString(java.lang.String s)
Quotes and escapes a string, as in the JSON specification.- Parameters:
s
- a string- Returns:
- the string quoted and escaped
-
joinPath
public static java.lang.String joinPath(java.lang.String... elements)
Converts a list of keys to a path expression, by quoting the path elements as needed and then joining them separated by a period. A path expression is usable with aConfig
, while individual path elements are usable with aConfigObject
.- Parameters:
elements
- the keys in the path- Returns:
- a path expression
- Throws:
ConfigException
- if there are no elements
-
joinPath
public static java.lang.String joinPath(java.util.List<java.lang.String> elements)
Converts a list of strings to a path expression, by quoting the path elements as needed and then joining them separated by a period. A path expression is usable with aConfig
, while individual path elements are usable with aConfigObject
.- Parameters:
elements
- the keys in the path- Returns:
- a path expression
- Throws:
ConfigException
- if the list is empty
-
splitPath
public static java.util.List<java.lang.String> splitPath(java.lang.String path)
Converts a path expression into a list of keys, by splitting on period and unquoting the individual path elements. A path expression is usable with aConfig
, while individual path elements are usable with aConfigObject
.- Parameters:
path
- a path expression- Returns:
- the individual keys in the path
- Throws:
ConfigException
- if the path expression is invalid
-
-