Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.instance.model.impl
Class GenericResourceIteratorAdapter<S,T>

java.lang.Object
  extended by eu.esdihumboldt.hale.common.instance.model.impl.GenericResourceIteratorAdapter<S,T>
Type Parameters:
S - the source object type served by the wrapped iterator
T - the object type served by the resource iterator
All Implemented Interfaces:
ResourceIterator<T>, Closeable, Iterator<T>
Direct Known Subclasses:
AbstractMergeHandler.MergedIterator, ResourceIteratorAdapter

public abstract class GenericResourceIteratorAdapter<S,T>
extends Object
implements ResourceIterator<T>

ResourceIterator adapter for a normal iterator that can perform a conversion from the iterator elements to a target element type.

Author:
Simon Templer

Constructor Summary
GenericResourceIteratorAdapter(Iterator<S> iterator)
          Create a ResourceIterator adapter for the given iterator.
 
Method Summary
 void close()
          Dispose the iterator.
protected abstract  T convert(S next)
          Convert an object before it is returned by next().
 boolean hasNext()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericResourceIteratorAdapter

public GenericResourceIteratorAdapter(Iterator<S> iterator)
Create a ResourceIterator adapter for the given iterator.

Parameters:
iterator - the iterator to adapt
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>
See Also:
Iterator.hasNext()

next

public T next()
Specified by:
next in interface Iterator<T>
See Also:
Iterator.next()

convert

protected abstract T convert(S next)
Convert an object before it is returned by next().

Parameters:
next - the object to convert
Returns:
the converted object

remove

public void remove()
Specified by:
remove in interface Iterator<T>
See Also:
Iterator.remove()

close

public void close()
Description copied from interface: ResourceIterator
Dispose the iterator. After calling this method Iterator.next() may not be called.

Specified by:
close in interface ResourceIterator<T>
Specified by:
close in interface Closeable
See Also:
ResourceIterator.close()

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d