Class ConfigUtil

java.lang.Object
com.typesafe.config.ConfigUtil

public final class ConfigUtil extends Object
Contains static utility methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    joinPath(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 String
    joinPath(List<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 String
    Quotes and escapes a string, as in the JSON specification.
    static List<String>
    Converts a path expression into a list of keys, by splitting on period and unquoting the individual path elements.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • quoteString

      public static String quoteString(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 String joinPath(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 a Config, while individual path elements are usable with a ConfigObject.

      See the overview documentation for Config for more detail on path expressions vs. keys.

      Parameters:
      elements - the keys in the path
      Returns:
      a path expression
      Throws:
      ConfigException - if there are no elements
    • joinPath

      public static String joinPath(List<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 a Config, while individual path elements are usable with a ConfigObject.

      See the overview documentation for Config for more detail on path expressions vs. keys.

      Parameters:
      elements - the keys in the path
      Returns:
      a path expression
      Throws:
      ConfigException - if the list is empty
    • splitPath

      public static List<String> splitPath(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 a Config, while individual path elements are usable with a ConfigObject.

      See the overview documentation for Config for more detail on path expressions vs. keys.

      Parameters:
      path - a path expression
      Returns:
      the individual keys in the path
      Throws:
      ConfigException - if the path expression is invalid