com.google.clearsilver.jsilver.data
Class UnmodifiableData

java.lang.Object
  extended by com.google.clearsilver.jsilver.data.DelegatedData
      extended by com.google.clearsilver.jsilver.data.UnmodifiableData
All Implemented Interfaces:
Data

public class UnmodifiableData
extends DelegatedData

Data wrapper that prevents modifying the delegated Data node or its tree.


Nested Class Summary
protected  class UnmodifiableData.UnmodifiableIterator
           
 
Nested classes/interfaces inherited from class com.google.clearsilver.jsilver.data.DelegatedData
DelegatedData.DelegatedIterator
 
Constructor Summary
UnmodifiableData(Data delegate)
           
 
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.
 Data createChild(String path)
          createChild(java.lang.String) calls DelegatedData.getChild(java.lang.String) and throws UnsupportedOperationException if no object was found.
protected  Iterator<DelegatedData> newChildIterator()
          Override in order to not allow modifying children with remove().
protected  DelegatedData newInstance(Data newDelegate)
          Subclasses will want to override this method to return a Data object of their specific type.
 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.
 
Methods inherited from class com.google.clearsilver.jsilver.data.DelegatedData
getAttribute, getAttributeCount, getAttributes, getBooleanValue, getBooleanValue, getChild, getChildCount, getChildren, getDelegate, getEscapeMode, getFullPath, getIntValue, getIntValue, getIntValue, getName, getNextSibling, getParent, getRoot, getSymlink, getValue, getValue, getValue, hasAttribute, isFirstSibling, isLastSibling, optimize, toString, toString, unwrap, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UnmodifiableData

public UnmodifiableData(Data delegate)
Method Detail

newInstance

protected DelegatedData newInstance(Data newDelegate)
Description copied from class: DelegatedData
Subclasses will want to override this method to return a Data object of their specific type.

Overrides:
newInstance in class DelegatedData
Parameters:
newDelegate - the Data object to wrap with a new delegator
Returns:
a DelegateData type or subclass.

copy

public void copy(Data from)
Description copied from interface: Data
Does a deep copy the attributes and values from one node to another

Specified by:
copy in interface Data
Overrides:
copy in class DelegatedData
Parameters:
from - Data object whose value should be copied over.

copy

public void copy(String toPath,
                 Data from)
Description copied from interface: Data
Does a deep copy of the attributes and values from one node to another.

Specified by:
copy in interface Data
Overrides:
copy in class DelegatedData
Parameters:
toPath - destination path for the deep copy.
from - Data object that should be copied over.

createChild

public Data createChild(String path)
createChild(java.lang.String) calls DelegatedData.getChild(java.lang.String) and throws UnsupportedOperationException if no object was found.

Specified by:
createChild in interface Data
Overrides:
createChild in class DelegatedData

newChildIterator

protected Iterator<DelegatedData> newChildIterator()
Override in order to not allow modifying children with remove().

Overrides:
newChildIterator in class DelegatedData
Returns:
Iterator of children of delegate Data object that returns wrapped Data nodes.

setSymlink

public void setSymlink(String sourcePath,
                       Data destination)
Description copied from interface: Data
Set the source node to be a symbolic link to the destination.

Specified by:
setSymlink in interface Data
Overrides:
setSymlink in class DelegatedData

setSymlink

public void setSymlink(String sourcePath,
                       String destinationPath)
Description copied from interface: Data
Set the source node to be a symbolic link to the destination.

Specified by:
setSymlink in interface Data
Overrides:
setSymlink in class DelegatedData

setSymlink

public void setSymlink(Data symLink)
Description copied from interface: Data
Set this node to be a symbolic link to another node.

Specified by:
setSymlink in interface Data
Overrides:
setSymlink in class DelegatedData

setAttribute

public void setAttribute(String key,
                         String value)
Description copied from interface: Data
Sets an attribute key and value on the current node, replacing any existing value.

Specified by:
setAttribute in interface Data
Overrides:
setAttribute in class DelegatedData
Parameters:
key - the name of the attribute to add/modify.
value - the value to assign it. Value of null will clear the attribute.

removeTree

public void removeTree(String path)
Description copied from interface: Data
Remove the specified subtree.

Specified by:
removeTree in interface Data
Overrides:
removeTree in class DelegatedData

setValue

public void setValue(String path,
                     String value)
Description copied from interface: Data
Sets the value at the specified path in this HDF node's subtree.

Specified by:
setValue in interface Data
Overrides:
setValue in class DelegatedData

setValue

public void setValue(String value)
Description copied from interface: Data
Set the value of this node. Any symlink that may have been set for this node will be replaced.

Specified by:
setValue in interface Data
Overrides:
setValue in class DelegatedData

setEscapeMode

public void setEscapeMode(EscapeMode mode)
Description copied from interface: Data
Set the escaping that was applied to this HDF node. This method may be called by the template renderer, for instance, when a "set" command sets the node to a constant string. It may also be explicitly called if populating the HDF with pre-escaped or trusted values.

Specified by:
setEscapeMode in interface Data
Overrides:
setEscapeMode in class DelegatedData
See Also:
Data.getEscapeMode()


Copyright © 2010-2012 Google. All Rights Reserved.