|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.davisor.data.VoidData
com.davisor.data.stream.CollectionDataSource
CollectionDataSource represents a data source that uses a standard Java collection to implement a source of DataValue elements. The source also exposes the underlying collection object to allow direct collection content manipulation.
A data source has a data type that may be used to convert elements into one uniform type when data is inserted into the collection. However, arbitary data may also be placed directly into the collection. Data streams that read this source may later apply additional type conversions.
getCollection(),
getStream(),
Type| Field Summary | |
protected java.util.Collection |
M_collection
Collection data source. |
| Fields inherited from class com.davisor.data.VoidData |
M_type |
| Constructor Summary | |
CollectionDataSource()
Default constructor that creates an empty collection with no type. |
|
CollectionDataSource(java.util.Collection collection)
Creates a collection data stream source out of the given collection. |
|
CollectionDataSource(java.util.Collection collection,
Type type)
Creates a collection data stream source out of the given collection and element type. |
|
CollectionDataSource(java.lang.Object[] collection)
Creates a collection data stream source out of the given array. |
|
CollectionDataSource(java.lang.Object[] collection,
Type type)
Creates a collection data stream source out of the given array and type. |
|
| Method Summary | |
void |
addAll(DataStream stream)
Adds all elements in the given stream to this collection. |
boolean |
close()
Dummy implementation. |
java.util.Collection |
getCollection()
Gets the underlying collection. |
DataStream |
getStream()
Gets a data stream to the data in this source. |
void |
setType(Type type)
Sets the data stream element type. |
java.lang.String |
toString()
Gets data buffer XML representation. |
java.lang.String |
toString(java.lang.String id,
java.lang.String dataName)
Returns the XML representation for the asked channel. |
| Methods inherited from class com.davisor.data.VoidData |
equals, getDataValue, getType, hashCode |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davisor.data.Data |
getType |
| Field Detail |
protected java.util.Collection M_collection
| Constructor Detail |
public CollectionDataSource()
public CollectionDataSource(java.lang.Object[] collection)
throws InvalidDataException
collection - data source
InvalidDataException - if the type of the first element
cannot be determinedCollectionDataSource(Collection)
public CollectionDataSource(java.lang.Object[] collection,
Type type)
collection - data sourcetype - the type of the data within the sourceCollectionDataSource(Collection,Type)
public CollectionDataSource(java.util.Collection collection)
throws InvalidDataException
AutoType.
collection - data source
InvalidDataException - if the type of the first element
cannot be determined
public CollectionDataSource(java.util.Collection collection,
Type type)
collection - data sourcetype - the type of the data within the source| Method Detail |
public boolean close()
close in interface DataSource
public DataStream getStream()
throws InvalidDataException
getStream in interface DataSourceInvalidDataExceptionIteratorDataStream.IteratorDataStream(Collection,Type)
public java.lang.String toString(java.lang.String id,
java.lang.String dataName)
toString in interface DataSourceid - channel iddataName - channel dataName (ignored)public java.lang.String toString()
DataValue objects with that type. The converted values are then
written as XML with their DataValue.toXML() method. If the
data source has no explicit type, DataValue elements
found in the collection are written by invoking their DataValue.toXML() method, while other objects are written with
their standard string representations, but with their special
characters XML encoded. In all cases, the values are embedded in
tags with the help of Strings.toXML(Object,boolean)
method.
toString in class VoidDataDataValue.toXML(),
Strings.toXML(Object,boolean),
Type.toData(Object),
Type.xmlEnd(),
Type.xmlStart()
public void addAll(DataStream stream)
throws InvalidDataException
InvalidDataExceptionpublic java.util.Collection getCollection()
public void setType(Type type)
setType in class VoidData
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||