public class DelegatedData extends Object implements Data
Modifier and Type | Class and Description |
---|---|
protected class |
DelegatedData.DelegatedIterator
Wrapping implementation of iterator that makes sure any Data object returned by the underlying
iterator is wrapped with the right DelegatedData type.
|
Constructor and Description |
---|
DelegatedData(Data delegate) |
Modifier and Type | Method and Description |
---|---|
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.
|
Data |
createChild(String path)
Retrieves the HDF object that is the root of the subtree at hdfpath, create the subtree if it
doesn't exist
|
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.
|
boolean |
getBooleanValue()
Returns the boolean value of this HDF node, or false if this node has no value.
|
boolean |
getBooleanValue(String path)
Retrieves the value at the specified path in this HDF node's subtree.
|
Data |
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.
|
protected Data |
getDelegate() |
EscapeMode |
getEscapeMode()
Indicates the escaping, if any that was applied to this HDF node.
|
String |
getFullPath()
Returns the full path to this node via its parent links.
|
int |
getIntValue()
Returns the integer value of this HDF node, or 0 if this node has no value.
|
int |
getIntValue(String path)
Retrieves the value at the specified path in this HDF node's subtree.
|
int |
getIntValue(String path,
int defaultValue)
Retrieves the integer value at the specified path in this HDF node's subtree.
|
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.
|
String |
getValue(String path)
Retrieves the value at the specified path in this HDF node's subtree.
|
String |
getValue(String path,
String defaultValue)
Retrieves the value at the specified path in this HDF node's subtree.
|
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?
|
protected Iterator<DelegatedData> |
newChildIterator()
Subclasses can override this method to return specialized child iterators.
|
protected DelegatedData |
newInstance(Data newDelegate)
Subclasses will want to override this method to return a Data object of their specific type.
|
void |
optimize()
Optimizes the Data structure for performance.
|
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 |
setEscapeMode(EscapeMode mode)
Set the escaping that was applied to this HDF node.
|
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 |
setValue(String path,
String value)
Sets the value at the specified path in this HDF node's subtree.
|
String |
toString() |
void |
toString(StringBuilder out,
int indent) |
protected static Data |
unwrap(Data data) |
void |
write(Appendable out,
int indent)
Write out the String representation of this HDF node.
|
public DelegatedData(Data delegate)
protected DelegatedData newInstance(Data newDelegate)
newDelegate
- the Data object to wrap with a new delegatorprotected Data getDelegate()
public String getName()
Data
public String getValue()
Data
public int getIntValue()
Data
getIntValue
in interface Data
public boolean getBooleanValue()
Data
getBooleanValue
in interface Data
public void setValue(String value)
Data
public String getFullPath()
Data
getFullPath
in interface Data
public void setAttribute(String key, String value)
Data
setAttribute
in interface 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.getAttribute
in interface Data
public boolean hasAttribute(String key)
Data
true
if the node contains an attribute with the given name, false
otherwise.hasAttribute
in interface Data
public int getAttributeCount()
Data
getAttributeCount
in interface Data
public Iterable<Map.Entry<String,String>> getAttributes()
Data
getAttributes
in interface Data
public Data getRoot()
Data
public boolean isFirstSibling()
Data
isFirstSibling
in interface Data
public boolean isLastSibling()
Data
isLastSibling
in interface Data
public Data getNextSibling()
Data
getNextSibling
in interface Data
null
if this is the last sibling.public int getChildCount()
Data
getChildCount
in interface Data
protected Iterator<DelegatedData> newChildIterator()
public Iterable<? extends Data> getChildren()
Data
getChildren
in interface Data
public Data getChild(String path)
Data
public Data createChild(String path)
Data
createChild
in interface Data
public void removeTree(String path)
Data
removeTree
in interface Data
public void setSymlink(String sourcePath, String destinationPath)
Data
setSymlink
in interface Data
public void setSymlink(String sourcePath, Data destination)
Data
setSymlink
in interface Data
public void setSymlink(Data symLink)
Data
setSymlink
in interface Data
public Data getSymlink()
Data
getSymlink
in interface Data
public void copy(String toPath, Data from)
Data
public void copy(Data from)
Data
public String getValue(String path, String defaultValue)
Data
public int getIntValue(String path, int defaultValue)
Data
getIntValue
in interface Data
public String getValue(String path)
Data
public int getIntValue(String path)
Data
getIntValue
in interface Data
public boolean getBooleanValue(String path)
Data
getBooleanValue
in interface Data
public void setValue(String path, String value)
Data
public String toString()
public void toString(StringBuilder out, int indent)
public void write(Appendable out, int indent) throws IOException
Data
write
in interface Data
IOException
public void optimize()
Data
public void setEscapeMode(EscapeMode mode)
Data
setEscapeMode
in interface Data
Data.getEscapeMode()
public EscapeMode getEscapeMode()
Data
getEscapeMode
in interface Data
EscapeMode.ESCAPE_NONE
if the
value is not escaped. EscapeMode.ESCAPE_IS_CONSTANT
if value is a string or
numeric literal.Data.setEscapeMode(com.google.clearsilver.jsilver.autoescape.EscapeMode)
,
EscapeMode
Copyright © 2010–2015 Google. All rights reserved.