public class TransientDataAdaptor extends java.lang.Object implements DataAdaptor
DataAdaptor
interface.
TransientDataAdaptor
is intended as a convenience class
for passing data using the DataAdaptor interface. Note,
however, class supports no persistence. Once an object of class
TransientDataAdaptor
is destroyed all internal data is lost.Constructor and Description |
---|
TransientDataAdaptor(java.lang.String strLabel)
Create a new instance of VolatileDataAdaptor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
attributes()
Get all the attribute names in the data node.
|
boolean |
booleanValue(java.lang.String strAttrName)
Get the value of an attribute.
|
DataAdaptor |
childAdaptor(java.lang.String strLabel)
Convenience method to get a single child adaptor when only one is expected.
|
java.util.Iterator<DataAdaptor> |
childAdaptorIterator()
Get an iterator containing all child adaptors of this node.
|
java.util.Iterator<DataAdaptor> |
childAdaptorIterator(java.lang.String strLabel)
Get an iterator for all child data nodes having a given data label.
|
java.util.List<DataAdaptor> |
childAdaptors()
Get all the child data nodes of this adaptor.
|
java.util.List<DataAdaptor> |
childAdaptors(java.lang.String strLabel)
Get all the child data nodes of a particular data label.
|
DataAdaptor |
createChild(java.lang.String strLabel)
Create a new empty child adaptor with the specified label.
|
double[] |
doubleArray(java.lang.String strAttr)
Returns the value of an attribute as an array of doubles.
|
double |
doubleValue(java.lang.String strAttrName)
Get the value of an attribute.
|
boolean |
hasAttribute(java.lang.String strAttrName)
Test whether or not an attribute is present in the data node.
|
int |
intValue(java.lang.String strAttrName)
Get the value of an attribute.
|
long |
longValue(java.lang.String strAttrName)
Get the value of an attribute.
|
java.lang.String |
name()
Get the label for this data node.
|
int |
nodeCount()
Get the number of child data nodes.
|
void |
print(java.io.PrintStream os)
Print out the contents of this adaptor.
|
void |
setValue(java.lang.String strAttrName,
boolean bolAttrVal)
Set the value of the specified attribute
|
void |
setValue(java.lang.String strAttrName,
double dblAttrVal)
Set the value of the specified attribute
|
void |
setValue(java.lang.String strAttr,
double[] arrVal)
Sets the attribute (name,value) pair for the given arguments.
|
void |
setValue(java.lang.String strAttrName,
int intAttrVal)
Set the value of the specified attribute
|
void |
setValue(java.lang.String strAttrName,
long longAttrVal)
Set the value of the specified attribute
|
void |
setValue(java.lang.String strAttrName,
java.lang.Object objAttrVal)
Set the value of the specified attribute
|
void |
setValue(java.lang.String strAttrName,
java.lang.String strAttrVal)
Set the value of the specified attribute as a string.
|
java.lang.String |
stringValue(java.lang.String strAttrName)
Get the value of an attribute.
|
void |
writeNode(DataListener ifcSrc)
Write out the listener data as a new node then append it as a child node
in the data tree.
|
void |
writeNodes(java.util.Collection<? extends DataListener> colSrcs)
write the collection of listeners to new nodes and append them
to the data tree.
|
public TransientDataAdaptor(java.lang.String strLabel)
strLabel
- label for new data nodepublic java.lang.String name()
name
in interface DataAdaptor
public java.lang.String[] attributes()
attributes
in interface DataAdaptor
public boolean hasAttribute(java.lang.String strAttrName)
hasAttribute
in interface DataAdaptor
strAttrName
- attribute namepublic java.lang.String stringValue(java.lang.String strAttrName)
stringValue
in interface DataAdaptor
strAttrName
- name of attributepublic boolean booleanValue(java.lang.String strAttrName) throws java.lang.NumberFormatException
booleanValue
in interface DataAdaptor
strAttrName
- name of attributejava.lang.NumberFormatException
- unable to parse value as booleanpublic int intValue(java.lang.String strAttrName)
intValue
in interface DataAdaptor
strAttrName
- name of attributejava.lang.NumberFormatException
- unable to parse value as intpublic long longValue(java.lang.String strAttrName)
longValue
in interface DataAdaptor
strAttrName
- name of attributejava.lang.NumberFormatException
- unable to parse value as longpublic double doubleValue(java.lang.String strAttrName)
doubleValue
in interface DataAdaptor
strAttrName
- name of attributejava.lang.NumberFormatException
- unable to parse value as doublepublic double[] doubleArray(java.lang.String strAttr) throws java.lang.NumberFormatException
doubleArray
in interface DataAdaptor
strAttr
- the attribute namenull
value is returned if the value string is empty.java.lang.NumberFormatException
- at least one value was malformed,
or the CSV string was malformedpublic void setValue(java.lang.String strAttrName, java.lang.String strAttrVal)
setValue
in interface DataAdaptor
strAttrName
- attribute namestrAttrVal
- attribute valuepublic void setValue(java.lang.String strAttrName, java.lang.Object objAttrVal)
setValue
in interface DataAdaptor
strAttrName
- attribute nameobjAttrVal
- new attribute valuepublic void setValue(java.lang.String strAttrName, boolean bolAttrVal)
setValue
in interface DataAdaptor
strAttrName
- attribute namebolAttrVal
- new attribute valuepublic void setValue(java.lang.String strAttrName, int intAttrVal)
setValue
in interface DataAdaptor
strAttrName
- attribute nameintAttrVal
- new attribute valuepublic void setValue(java.lang.String strAttrName, long longAttrVal)
setValue
in interface DataAdaptor
strAttrName
- attribute namelongAttrVal
- new attribute valuepublic void setValue(java.lang.String strAttrName, double dblAttrVal)
setValue
in interface DataAdaptor
strAttrName
- attribute namedblAttrVal
- new attribute valuepublic void setValue(java.lang.String strAttr, double[] arrVal)
setValue
in interface DataAdaptor
strAttr
- attribute namearrVal
- attribute valueDataAdaptor.setValue(java.lang.String, double[])
public int nodeCount()
public DataAdaptor childAdaptor(java.lang.String strLabel)
childAdaptor
in interface DataAdaptor
strLabel
- data label of child nodepublic java.util.List<DataAdaptor> childAdaptors()
childAdaptors
in interface DataAdaptor
public java.util.List<DataAdaptor> childAdaptors(java.lang.String strLabel)
childAdaptors
in interface DataAdaptor
strLabel
- data label for child nodespublic java.util.Iterator<DataAdaptor> childAdaptorIterator()
public java.util.Iterator<DataAdaptor> childAdaptorIterator(java.lang.String strLabel)
strLabel
- data label for child nodespublic DataAdaptor createChild(java.lang.String strLabel)
createChild
in interface DataAdaptor
strLabel
- data label for the child nodepublic void writeNode(DataListener ifcSrc)
writeNode
in interface DataAdaptor
ifcSrc
- public void writeNodes(java.util.Collection<? extends DataListener> colSrcs)
writeNodes
in interface DataAdaptor
colSrcs
- collection data sources exposing DataListener
interfacepublic void print(java.io.PrintStream os)
os
- output stream