Class XMLPropertyListConfiguration.PListNodeBuilder
- java.lang.Object
-
- org.apache.commons.configuration2.plist.XMLPropertyListConfiguration.PListNodeBuilder
-
- Direct Known Subclasses:
XMLPropertyListConfiguration.ArrayNodeBuilder
- Enclosing class:
- XMLPropertyListConfiguration
private static class XMLPropertyListConfiguration.PListNodeBuilder extends java.lang.Object
A specialized builder class with addXXX methods to parse the typed data passed by the SAX handler. It is used for creating the nodes of the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<XMLPropertyListConfiguration.PListNodeBuilder>
childBuilders
A collection with child builders of this builder.private static java.text.DateFormat
FORMAT
The MacOS FORMAT of dates in plist files.private static java.text.DateFormat
GNUSTEP_FORMAT
The GNUstep FORMAT of dates in plist files.private java.lang.String
name
The name of the represented node.private java.lang.Object
value
The current value of the represented node.
-
Constructor Summary
Constructors Modifier Constructor Description private
PListNodeBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(XMLPropertyListConfiguration.PListNodeBuilder child)
Adds the given child builder to this builder.void
addDataValue(java.lang.String value)
Parse the specified string as a byte array in base 64 FORMAT and add it to the values of the node.void
addDateValue(java.lang.String value)
Parse the specified string as a date and add it to the values of the node.void
addFalseValue()
Add a boolean value 'false' to the values of the node.void
addIntegerValue(java.lang.String value)
Parse the specified string as an Interger and add it to the values of the node.void
addList(XMLPropertyListConfiguration.ArrayNodeBuilder node)
Add a sublist to the values of the node.void
addRealValue(java.lang.String value)
Parse the specified string as a Double and add it to the values of the node.void
addTrueValue()
Add a boolean value 'true' to the values of the node.void
addValue(java.lang.Object v)
Update the value of the node.ImmutableNode
createNode()
Creates the configuration node defined by this builder.protected java.lang.Object
getNodeValue()
Gets the final value for the node to be created.void
setName(java.lang.String nodeName)
Sets the name of the represented node.
-
-
-
Field Detail
-
FORMAT
private static final java.text.DateFormat FORMAT
The MacOS FORMAT of dates in plist files. Note: BecauseSimpleDateFormat
is not thread-safe, each access has to be synchronized.
-
GNUSTEP_FORMAT
private static final java.text.DateFormat GNUSTEP_FORMAT
The GNUstep FORMAT of dates in plist files. Note: BecauseSimpleDateFormat
is not thread-safe, each access has to be synchronized.
-
childBuilders
private final java.util.Collection<XMLPropertyListConfiguration.PListNodeBuilder> childBuilders
A collection with child builders of this builder.
-
name
private java.lang.String name
The name of the represented node.
-
value
private java.lang.Object value
The current value of the represented node.
-
-
Method Detail
-
addChild
public void addChild(XMLPropertyListConfiguration.PListNodeBuilder child)
Adds the given child builder to this builder.- Parameters:
child
- the child builder to be added
-
addDataValue
public void addDataValue(java.lang.String value)
Parse the specified string as a byte array in base 64 FORMAT and add it to the values of the node.- Parameters:
value
- the value to be added
-
addDateValue
public void addDateValue(java.lang.String value)
Parse the specified string as a date and add it to the values of the node.- Parameters:
value
- the value to be added- Throws:
java.lang.IllegalArgumentException
- if the date string cannot be parsed
-
addFalseValue
public void addFalseValue()
Add a boolean value 'false' to the values of the node.
-
addIntegerValue
public void addIntegerValue(java.lang.String value)
Parse the specified string as an Interger and add it to the values of the node.- Parameters:
value
- the value to be added
-
addList
public void addList(XMLPropertyListConfiguration.ArrayNodeBuilder node)
Add a sublist to the values of the node.- Parameters:
node
- the node whose value will be added to the current node value
-
addRealValue
public void addRealValue(java.lang.String value)
Parse the specified string as a Double and add it to the values of the node.- Parameters:
value
- the value to be added
-
addTrueValue
public void addTrueValue()
Add a boolean value 'true' to the values of the node.
-
addValue
public void addValue(java.lang.Object v)
Update the value of the node. If the existing value is null, it's replaced with the new value. If the existing value is a list, the specified value is appended to the list. If the existing value is not null, a list with the two values is built.- Parameters:
v
- the value to be added
-
createNode
public ImmutableNode createNode()
Creates the configuration node defined by this builder.- Returns:
- the newly created configuration node
-
getNodeValue
protected java.lang.Object getNodeValue()
Gets the final value for the node to be created. This method is called when the represented configuration node is actually created.- Returns:
- the value of the resulting configuration node
-
setName
public void setName(java.lang.String nodeName)
Sets the name of the represented node.- Parameters:
nodeName
- the node name
-
-