Class PropertyListConfiguration

    • Constructor Detail

      • PropertyListConfiguration

        public PropertyListConfiguration()
        Creates an empty PropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().
      • PropertyListConfiguration

        public PropertyListConfiguration​(HierarchicalConfiguration<ImmutableNode> c)
        Creates a new instance of PropertyListConfiguration and copies the content of the specified configuration into this object.
        Parameters:
        c - the configuration to copy
        Since:
        1.4
      • PropertyListConfiguration

        PropertyListConfiguration​(ImmutableNode root)
        Creates a new instance of PropertyListConfiguration with the given root node.
        Parameters:
        root - the root node
    • Method Detail

      • formatDate

        static java.lang.String formatDate​(java.util.Calendar cal)
        Returns a string representation for the date specified by the given calendar.
        Parameters:
        cal - the calendar with the initialized date
        Returns:
        a string for this date
      • formatDate

        static java.lang.String formatDate​(java.util.Date date)
        Returns a string representation for the specified date.
        Parameters:
        date - the date
        Returns:
        a string for this date
      • parseDate

        static java.util.Date parseDate​(java.lang.String s)
                                 throws ParseException
        Parses a date in a format like <*D2002-03-22 11:30:00 +0100>.
        Parameters:
        s - the string with the date to be parsed
        Returns:
        the parsed date
        Throws:
        ParseException - if an error occurred while parsing the string
      • transformMap

        private static java.util.Map<java.lang.String,​java.lang.Object> transformMap​(java.util.Map<?,​?> src)
        Transform a map of arbitrary types into a map with string keys and object values. All keys of the source map which are not of type String are dropped.
        Parameters:
        src - the map to be converted
        Returns:
        the resulting map
      • addPropertyInternal

        protected void addPropertyInternal​(java.lang.String key,
                                           java.lang.Object value)
        Description copied from class: AbstractHierarchicalConfiguration
        Adds the property with the specified key. This task will be delegated to the associated ExpressionEngine, so the passed in key must match the requirements of this implementation.
        Overrides:
        addPropertyInternal in class AbstractHierarchicalConfiguration<ImmutableNode>
        Parameters:
        key - the key of the new property
        value - the value of the new property
      • printNode

        private void printNode​(java.io.PrintWriter out,
                               int indentLevel,
                               ImmutableNode node,
                               NodeHandler<ImmutableNode> handler)
        Append a node to the writer, indented according to a specific level.
      • printValue

        private void printValue​(java.io.PrintWriter out,
                                int indentLevel,
                                java.lang.Object value)
        Append a value to the writer, indented according to a specific level.
      • quoteString

        java.lang.String quoteString​(java.lang.String s)
        Quote the specified string if necessary, that's if the string contains:
        • a space character (' ', '\t', '\r', '\n')
        • a quote '"'
        • special characters in plist files ('(', ')', '{', '}', '=', ';', ',')
        Quotes within the string are escaped.

        Examples:

        • abcd -> abcd
        • ab cd -> "ab cd"
        • foo"bar -> "foo\"bar"
        • foo;bar -> "foo;bar"
      • read

        public void read​(java.io.Reader in)
                  throws ConfigurationException
        Description copied from interface: FileBased
        Reads the content of this object from the given reader. Client code should not call this method directly, but use a FileHandler for reading data.
        Specified by:
        read in interface FileBased
        Parameters:
        in - the reader
        Throws:
        ConfigurationException - if a non-I/O related problem occurs, e.g. the data read does not have the expected format
      • write

        public void write​(java.io.Writer out)
                   throws ConfigurationException
        Description copied from interface: FileBased
        Writes the content of this object to the given writer. Client code should not call this method directly, but use a FileHandler for writing data.
        Specified by:
        write in interface FileBased
        Parameters:
        out - the writer
        Throws:
        ConfigurationException - if a non-I/O related problem occurs, e.g. the data read does not have the expected format