public class Configuration extends java.lang.Object implements IHierarchyParent
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Configuration.JSONReader |
protected static class |
Configuration.JSONWriter |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
_rcsid |
protected java.util.List<ConfigurationNode> |
children |
protected static java.lang.String |
JSON_ATTRIBUTE |
protected static java.lang.String |
JSON_CHILDREN |
protected static java.lang.String |
JSON_TYPE |
protected static java.lang.String |
JSON_VALUE |
protected boolean |
readOnly |
protected java.lang.String |
rootNodeLabel |
| Constructor and Description |
|---|
Configuration()
Constructor.
|
Configuration(java.lang.String rootNodeLabel)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(int index,
ConfigurationNode child)
Add child at specified position.
|
protected void |
addOuterNode(ConfigurationNode node)
Note the addition of a new outer node.
|
void |
clearChildren()
Clear children.
|
protected void |
clearOuterNodes()
Note the removal of all outer nodes.
|
protected Configuration |
createDuplicate(boolean readOnly)
Create a duplicate.
|
protected Configuration |
createNew()
Create a new object of the appropriate class.
|
protected ConfigurationNode |
createNewNode(java.lang.String type)
Create a new child node of the appropriate type and class.
|
boolean |
equals(java.lang.Object o)
Do a comparison
|
ConfigurationNode |
findChild(int index)
Get child n.
|
void |
fromJSON(java.lang.String json)
Read from JSON.
|
void |
fromXML(java.io.InputStream xmlstream)
Read from an XML binary stream.
|
void |
fromXML(java.lang.String xml)
Read from XML.
|
int |
getChildCount()
Get child count.
|
int |
hashCode()
Calculate a hash code
|
protected void |
initializeFromDoc(XMLDoc doc) |
void |
makeReadOnly()
Make the configuration read-only
|
protected void |
processObject(ConfigurationNode cn,
java.lang.String key,
Configuration.JSONReader x)
Process a JSON object
|
protected void |
processObject(java.lang.String key,
Configuration.JSONReader x)
Process a JSON object
|
protected ConfigurationNode |
readNode(java.lang.String key,
Configuration.JSONReader object)
Read a node from a json object
|
protected ConfigurationNode |
readNode(XMLDoc doc,
java.lang.Object object)
Read a configuration node from XML.
|
void |
removeChild(int index)
Remove child n.
|
protected void |
removeOuterNode(ConfigurationNode node)
Note the removal of an outer node.
|
java.lang.String |
toJSON()
Get as JSON.
|
java.lang.String |
toString()
Construct a human-readable string
|
java.lang.String |
toXML()
Get as XML
|
protected static void |
writeNode(Configuration.JSONWriter writer,
ConfigurationNode node,
boolean writeKey,
boolean writeSpecialKey)
Write a JSON specification node.
|
protected static void |
writeNode(XMLDoc doc,
java.lang.Object parent,
ConfigurationNode node)
Write a specification node.
|
public static final java.lang.String _rcsid
protected static final java.lang.String JSON_ATTRIBUTE
protected static final java.lang.String JSON_VALUE
protected static final java.lang.String JSON_CHILDREN
protected static final java.lang.String JSON_TYPE
protected java.lang.String rootNodeLabel
protected java.util.List<ConfigurationNode> children
protected boolean readOnly
public Configuration()
public Configuration(java.lang.String rootNodeLabel)
rootNodeLabel - is the root node label to use.protected Configuration createNew()
protected ConfigurationNode createNewNode(java.lang.String type)
protected void clearOuterNodes()
protected void addOuterNode(ConfigurationNode node)
node - is the node that was just read.protected void removeOuterNode(ConfigurationNode node)
node - is the node that was just removed.protected Configuration createDuplicate(boolean readOnly)
public void makeReadOnly()
public java.lang.String toXML()
throws ManifoldCFException
ManifoldCFExceptionpublic java.lang.String toJSON()
throws ManifoldCFException
ManifoldCFExceptionprotected static void writeNode(XMLDoc doc, java.lang.Object parent, ConfigurationNode node) throws ManifoldCFException
doc - is the document.parent - is the parent.node - is the node.ManifoldCFExceptionprotected static void writeNode(Configuration.JSONWriter writer, ConfigurationNode node, boolean writeKey, boolean writeSpecialKey) throws ManifoldCFException
writer - is the JSON writer.node - is the node.writeKey - is true if the key needs to be written, false otherwise.ManifoldCFExceptionpublic void fromXML(java.lang.String xml)
throws ManifoldCFException
xml - is the input XML.ManifoldCFExceptionpublic void fromJSON(java.lang.String json)
throws ManifoldCFException
json - is the input JSON.ManifoldCFExceptionprotected void processObject(java.lang.String key,
Configuration.JSONReader x)
throws ManifoldCFException
ManifoldCFExceptionprotected ConfigurationNode readNode(java.lang.String key, Configuration.JSONReader object) throws ManifoldCFException
ManifoldCFExceptionprotected void processObject(ConfigurationNode cn, java.lang.String key, Configuration.JSONReader x) throws ManifoldCFException
ManifoldCFExceptionpublic void fromXML(java.io.InputStream xmlstream)
throws ManifoldCFException
xmlstream - is the input XML stream. Does NOT close the stream.ManifoldCFExceptionprotected void initializeFromDoc(XMLDoc doc) throws ManifoldCFException
ManifoldCFExceptionprotected ConfigurationNode readNode(XMLDoc doc, java.lang.Object object) throws ManifoldCFException
doc - is the document.object - is the object.ManifoldCFExceptionpublic int getChildCount()
getChildCount in interface IHierarchyParentpublic ConfigurationNode findChild(int index)
findChild in interface IHierarchyParentindex - is the child number.public void removeChild(int index)
removeChild in interface IHierarchyParentindex - is the child to remove.public void addChild(int index,
ConfigurationNode child)
addChild in interface IHierarchyParentindex - is the position to add the child.child - is the child to add.public void clearChildren()
clearChildren in interface IHierarchyParentpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object