com.google.clearsilver.jsilver.data
Class LocalAndGlobalData

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

public class LocalAndGlobalData
extends ChainedData

This is a special implementation of ChainedData to be used for holding the local and global Data objects (like local and global HDFs in Clearsilver). It prevents writes and modifications to the global Data object and applies them all to the local data object.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.clearsilver.jsilver.data.DelegatedData
DelegatedData.DelegatedIterator
 
Field Summary
 
Fields inherited from class com.google.clearsilver.jsilver.data.ChainedData
DEBUG_MULTIPLE_ASSIGNMENTS, logger
 
Constructor Summary
LocalAndGlobalData(Data local, Data global)
          Creates a Data object that encapsulates both request-scoped local HDF and an application global-scoped HDF that can be read from the template renderer.
LocalAndGlobalData(Data local, Data global, boolean allowGlobalDataModification)
          Creates a Data object that encapsulates both request-scoped local HDF and an application global-scoped HDF that can be read from the template renderer.
 
Method Summary
 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
 
Methods inherited from class com.google.clearsilver.jsilver.data.ChainedData
getBooleanValue, getChild, getIntValue, getIntValue, getValue, getValue, newInstance, optimize, toString, write
 
Methods inherited from class com.google.clearsilver.jsilver.data.DelegatedData
copy, copy, getAttribute, getAttributeCount, getAttributes, getBooleanValue, getChildCount, getChildren, getDelegate, getEscapeMode, getFullPath, getIntValue, getName, getNextSibling, getParent, getRoot, getSymlink, getValue, hasAttribute, isFirstSibling, isLastSibling, newChildIterator, removeTree, setAttribute, setEscapeMode, setSymlink, setSymlink, setSymlink, setValue, setValue, toString, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalAndGlobalData

public LocalAndGlobalData(Data local,
                          Data global)
Creates a Data object that encapsulates both request-scoped local HDF and an application global-scoped HDF that can be read from the template renderer. Part of the backwards compatibility with JNI Clearsilver and its globalHdf support.

Parameters:
local - the request-specific HDF data that takes priority.
global - application global HDF data that should be read but not written to from the template renderer.

LocalAndGlobalData

public LocalAndGlobalData(Data local,
                          Data global,
                          boolean allowGlobalDataModification)
Creates a Data object that encapsulates both request-scoped local HDF and an application global-scoped HDF that can be read from the template renderer. Part of the backwards compatibility with JNI Clearsilver and its globalHdf support. We wrap the global HDF in an UnmodifiableData delegate

Parameters:
local - the request-specific HDF data that takes priority.
global - application global HDF data that should be read but not written to from the template renderer.
allowGlobalDataModification - if true then enable legacy mode where we do not wrap the global Data with an Unmodifiable wrapper. Should not be set to true unless incompatibilities or performance issues found. Note, that setting to true could introduce bugs in templates that acquire local references to the global data structure and then try to modify them, which is not the intended behavior.
Method Detail

createChild

public Data createChild(String path)
Description copied from interface: Data
Retrieves the HDF object that is the root of the subtree at hdfpath, create the subtree if it doesn't exist

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


Copyright © 2010-2012 Google. All Rights Reserved.