Class 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 a Config, while individual path elements are usable with a ConfigObject.
        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 a Config, while individual path elements are usable with a ConfigObject.
        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 a Config, while individual path elements are usable with a ConfigObject.
        Parameters:
        path - a path expression
        Returns:
        the individual keys in the path
        Throws:
        ConfigException - if the path expression is invalid