com.davisor.data.stream
Class IteratorTypeStream

java.lang.Object
  extended bycom.davisor.data.VoidData
      extended bycom.davisor.data.stream.IteratorDataStream
          extended bycom.davisor.data.stream.IteratorTypeStream
All Implemented Interfaces:
Data, DataStream

public class IteratorTypeStream
extends IteratorDataStream

IteratorTypeStream represents an iterator data stream that enforces the common stream type over all the stream elements. In particular, all elements are converted to the stream type before they are returned. The original objects in the stream source are not changed.

Since:
JDK1.1
See Also:
getDataValue(java.lang.Object), EnumeratorTypeStream, Type

Field Summary
 
Fields inherited from class com.davisor.data.stream.IteratorDataStream
M_hasNext, M_index, M_iterator, M_metaData, M_nextData
 
Fields inherited from class com.davisor.data.VoidData
M_type
 
Fields inherited from interface com.davisor.data.stream.DataStream
INITIAL_INDEX
 
Constructor Summary
IteratorTypeStream(java.util.Collection collection)
          Creates a data stream out of a collection.
IteratorTypeStream(java.util.Collection collection, Type type)
          Creates a data stream out of a collection and the given type.
IteratorTypeStream(java.util.Iterator iterator)
          Creates a data stream out of an iterator.
IteratorTypeStream(java.util.Iterator iterator, Type type)
          Creates a data stream out of an iterator and the given type.
 
Method Summary
protected  DataValue getDataValue(java.lang.Object object)
          Makes a data value of the stream type.
 
Methods inherited from class com.davisor.data.stream.IteratorDataStream
close, getIndex, hasNext, init, next, toString
 
Methods inherited from class com.davisor.data.VoidData
equals, getType, hashCode, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.davisor.data.Data
getType
 

Constructor Detail

IteratorTypeStream

public IteratorTypeStream(java.util.Collection collection)
                   throws InvalidDataException
Creates a data stream out of a collection. The data stream type is taken from the first element in the collection.

Throws:
InvalidDataException - if the first element is not a DataValue
See Also:
IteratorTypeStream(Collection,Type), IteratorTypeStream(Iterator)

IteratorTypeStream

public IteratorTypeStream(java.util.Collection collection,
                          Type type)
                   throws InvalidDataException
Creates a data stream out of a collection and the given type.

Throws:
InvalidDataException - if the first element is not of the given type, and cannot be converted to a data object of that type
See Also:
IteratorTypeStream(Collection), IteratorTypeStream(Iterator,Type)

IteratorTypeStream

public IteratorTypeStream(java.util.Iterator iterator)
                   throws InvalidDataException
Creates a data stream out of an iterator. The data stream type is taken from the first element in the iterator

Throws:
InvalidDataException - if the first element is not a DataValue
See Also:
IteratorTypeStream(Collection), IteratorTypeStream(Iterator,Type)

IteratorTypeStream

public IteratorTypeStream(java.util.Iterator iterator,
                          Type type)
                   throws InvalidDataException
Creates a data stream out of an iterator and the given type.

Throws:
InvalidDataException - if the first element is not of the given type, and cannot be converted to a data object of that type
See Also:
IteratorTypeStream(Collection,Type), IteratorTypeStream(Iterator)
Method Detail

getDataValue

protected DataValue getDataValue(java.lang.Object object)
                          throws InvalidDataException
Makes a data value of the stream type.

Overrides:
getDataValue in class VoidData
Throws:
InvalidDataException - if the element could not be converted to the current type
See Also:
Type.toData(Object)


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.