|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.clearsilver.jsilver.data.AbstractData
com.google.clearsilver.jsilver.data.NestedMapData
public class NestedMapData
Represents a hierarchical data set of primitives. This is the JSilver equivalent to ClearSilver's HDF object. This class has no synchronization logic. Follow the same thread-safety semantics as you would for a java.util.ArrayList (i.e. concurrent reads allowed, but ensure you have exclusive access when modifying - should not read whilst another thread writes).
Field Summary |
---|
Fields inherited from class com.google.clearsilver.jsilver.data.AbstractData |
---|
escapeMode |
Constructor Summary | |
---|---|
|
NestedMapData()
|
protected |
NestedMapData(String name,
NestedMapData parent,
NestedMapData root)
|
Method Summary | |
---|---|
void |
copy(Data from)
Does a deep copy the attributes and values from one node to another |
void |
copy(String toPath,
Data from)
Does a deep copy of the attributes and values from one node to another. |
NestedMapData |
createChild(String path)
Retrieves the HDF object that is the root of the subtree at hdfpath, create the subtree if it doesn't exist |
protected NestedMapData |
createChildNode(String chunk)
Creates a child of this node. |
String |
getAttribute(String key)
Returns the value of the node attribute with the given name, or null if there is no
value. |
int |
getAttributeCount()
Returns the number of attributes on this node. |
Iterable<Map.Entry<String,String>> |
getAttributes()
Returns an iterable collection of attribute name/value pairs. |
NestedMapData |
getChild(String path)
Retrieves the object that is the root of the subtree at hdfpath, returning null if the subtree doesn't exist |
int |
getChildCount()
Returns number of child nodes. |
Iterable<? extends Data> |
getChildren()
Returns children of this node. |
String |
getFullPath()
Returns the full path to this node via its parent links. |
String |
getName()
Returns the name of this HDF node. |
Data |
getNextSibling()
Retrieves the node representing the next sibling of this Data node, if any. |
Data |
getParent()
Get the parent node. |
Data |
getRoot()
Return the root of the tree where the current node lies. |
Data |
getSymlink()
Retrieve the symbolic link this node points to. |
String |
getValue()
Returns the value of this HDF node, or null if this node has no value. |
boolean |
hasAttribute(String key)
Returns true if the node contains an attribute with the given name, false
otherwise. |
boolean |
isFirstSibling()
Is this the first of its siblings? |
boolean |
isLastSibling()
Is this the last of its siblings? |
void |
optimize()
Here we optimize the structure for long-term use. |
void |
removeTree(String path)
Remove the specified subtree. |
void |
setAttribute(String key,
String value)
Sets an attribute key and value on the current node, replacing any existing value. |
void |
setSymlink(Data symLink)
Set this node to be a symbolic link to another node. |
void |
setSymlink(String sourcePath,
Data destination)
Set the source node to be a symbolic link to the destination. |
void |
setSymlink(String sourcePath,
String destinationPath)
Set the source node to be a symbolic link to the destination. |
void |
setValue(String value)
Set the value of this node. |
void |
write(Appendable out,
int indent)
Write out the String representation of this HDF node. |
Methods inherited from class com.google.clearsilver.jsilver.data.AbstractData |
---|
getBooleanValue, getBooleanValue, getEscapeMode, getIntValue, getIntValue, getIntValue, getValue, getValue, setEscapeMode, setValue, toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NestedMapData()
protected NestedMapData(String name, NestedMapData parent, NestedMapData root)
Method Detail |
---|
protected NestedMapData createChildNode(String chunk)
chunk
- name to give the new child node.
public String getName()
public String getFullPath()
public String getValue()
public void setValue(String value)
public void setAttribute(String key, String value)
Data
key
- the name of the attribute to add/modify.value
- the value to assign it. Value of null
will clear the attribute.public String getAttribute(String key)
Data
null
if there is no
value.
public boolean hasAttribute(String key)
Data
true
if the node contains an attribute with the given name, false
otherwise.
public int getAttributeCount()
Data
public Iterable<Map.Entry<String,String>> getAttributes()
Data
public Data getRoot()
public Data getParent()
public boolean isFirstSibling()
public boolean isLastSibling()
public Data getNextSibling()
Data
null
if this is the last sibling.public int getChildCount()
public Iterable<? extends Data> getChildren()
public NestedMapData getChild(String path)
public NestedMapData createChild(String path)
public void removeTree(String path)
public void setSymlink(String sourcePath, String destinationPath)
public void setSymlink(String sourcePath, Data destination)
public void setSymlink(Data symLink)
public Data getSymlink()
public void copy(String toPath, Data from)
Data
toPath
- destination path for the deep copy.from
- Data object that should be copied over.public void copy(Data from)
Data
from
- Data object whose value should be copied over.public void write(Appendable out, int indent) throws IOException
IOException
public void optimize()
optimize
in interface Data
optimize
in class AbstractData
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |