public abstract class DelegatedHdf extends Object implements HDF
This class, and its subclasses must take care to wrap or unwrap HDF and CS objects as they are passed through from the callers to the delegate object.
Constructor and Description |
---|
DelegatedHdf(HDF hdf) |
Modifier and Type | Method and Description |
---|---|
boolean |
belongsToSameRoot(HDF hdf)
Checks if the given hdf object belongs to the same root HDF object
as this one.
|
void |
close()
Clean up CS object state.
|
void |
copy(String hdfpath,
HDF src)
Deep copy of the contents of the source HDF structure to this HDF
starting at the specified HDF path node.
|
String |
dump()
Generates a string representing the content of the HDF tree rooted at
this node.
|
void |
exportDate(String hdfname,
String tz,
int tt)
Export a date to a clearsilver tree using a specified timezone
|
void |
exportDate(String hdfname,
TimeZone timeZone,
Date date)
Export a date to a clearsilver tree using a specified timezone
|
DelegatedHdf |
getChild(String hdfpath)
Retrieves the HDF for the first child of the root of the subtree
at hdfpath, or null if no child exists of that path or if the
path doesn't exist.
|
CSFileLoader |
getFileLoader()
Get the file loader in use, if any.
|
static HDF |
getFullyUnwrappedHdf(HDF hdf)
Utility function for concrete ClearsilverFactories to unwrap DelegatedHdfs
and get down to a concrete (or unknown) HDF object.
|
HDF |
getHdf() |
int |
getIntValue(String hdfname,
int default_value)
Retrieves the integer value at the specified path in this HDF node's
subtree.
|
DelegatedHdf |
getObj(String hdfpath)
Retrieves the HDF object that is the root of the subtree at hdfpath, or
null if no object exists at that path.
|
DelegatedHdf |
getOrCreateObj(String hdfpath)
Retrieves the HDF object that is the root of the subtree at
hdfpath, create the subtree if it doesn't exist
|
DelegatedHdf |
getRootObj()
Return the root of the tree where the current node lies.
|
String |
getValue(String hdfname,
String default_value)
Retrieves the value at the specified path in this HDF node's subtree.
|
protected abstract DelegatedHdf |
newDelegatedHdf(HDF hdf)
Method subclasses are required to override with a method that returns a
new DelegatedHdf object that wraps the specified HDF object.
|
DelegatedHdf |
objChild()
Returns the child of this HDF node, or null if there is no child.
|
String |
objName()
Returns the name of this HDF node.
|
DelegatedHdf |
objNext()
Returns the child of this HDF node, or null if there is no child.
|
String |
objValue()
Returns the value of this HDF node, or null if this node has no value.
|
boolean |
readFile(String filename)
Loads the contents of the specified HDF file from disk into the current
HDF object.
|
boolean |
readString(String data)
Parses/loads the contents of the given string as HDF into the current
HDF object.
|
void |
removeTree(String hdfname)
Remove the specified subtree.
|
void |
setFileLoader(CSFileLoader fileLoader)
Set the CS file loader to use
|
void |
setSymLink(String hdf_name_src,
String hdf_name_dest)
Links the src hdf name to the dest.
|
void |
setValue(String hdfname,
String value)
Sets the value at the specified path in this HDF node's subtree.
|
boolean |
writeFile(String filename)
Serializes HDF contents to a file (readable by readFile)
|
String |
writeString()
Serializes HDF contents to a string (readable by readString)
|
public DelegatedHdf(HDF hdf)
public static HDF getFullyUnwrappedHdf(HDF hdf)
hdf
- the possibly DelegatedHdf to unwrappublic HDF getHdf()
protected abstract DelegatedHdf newDelegatedHdf(HDF hdf)
hdf
- an HDF object that should be wrapped in a new DelegatedHdf
object of the same type as this current object.public void close()
HDF
public boolean readFile(String filename) throws IOException, FileNotFoundException
HDF
readFile
in interface HDF
IOException
FileNotFoundException
public CSFileLoader getFileLoader()
HDF
getFileLoader
in interface HDF
public void setFileLoader(CSFileLoader fileLoader)
HDF
setFileLoader
in interface HDF
fileLoader
- the file loader that should be used.public boolean writeFile(String filename) throws IOException
HDF
writeFile
in interface HDF
IOException
public boolean readString(String data)
HDF
readString
in interface HDF
public String writeString()
HDF
writeString
in interface HDF
public int getIntValue(String hdfname, int default_value)
HDF
getIntValue
in interface HDF
public String getValue(String hdfname, String default_value)
HDF
public void setValue(String hdfname, String value)
HDF
public void removeTree(String hdfname)
HDF
removeTree
in interface HDF
public void setSymLink(String hdf_name_src, String hdf_name_dest)
HDF
setSymLink
in interface HDF
public void exportDate(String hdfname, TimeZone timeZone, Date date)
HDF
exportDate
in interface HDF
public void exportDate(String hdfname, String tz, int tt)
HDF
exportDate
in interface HDF
public DelegatedHdf getObj(String hdfpath)
HDF
public DelegatedHdf getChild(String hdfpath)
HDF
public DelegatedHdf getRootObj()
HDF
HDF
every time.
Use HDF.belongsToSameRoot(HDF)
to check if two HDF
s
belong to the same root.getRootObj
in interface HDF
public boolean belongsToSameRoot(HDF hdf)
HDF
belongsToSameRoot
in interface HDF
hdf
- The hdf object to compare to.public DelegatedHdf getOrCreateObj(String hdfpath)
HDF
getOrCreateObj
in interface HDF
public String objName()
HDF
public String objValue()
HDF
public DelegatedHdf objChild()
HDF
public DelegatedHdf objNext()
HDF
public void copy(String hdfpath, HDF src)
HDF
This method copies over the attributes and value of the node and recurses through all the children of the source node. Any symlink in the source node becomes a symlink in the copy.
Copyright © 2010–2014 Google. All rights reserved.