org.openstreetmap.osmosis.core.store
Class UpcastIterator<X,Y extends X>

java.lang.Object
  extended by org.openstreetmap.osmosis.core.store.UpcastIterator<X,Y>
Type Parameters:
X - The generic class type of the destination data.
Y - The more specific class type of the source data.
All Implemented Interfaces:
java.util.Iterator<X>, Releasable, ReleasableIterator<X>

public class UpcastIterator<X,Y extends X>
extends java.lang.Object
implements ReleasableIterator<X>

A simple pass-through iterator that changes an object from a specific class type to a more general class type.

Author:
Brett Henderson

Constructor Summary
UpcastIterator(ReleasableIterator<Y> source)
          Creates a new instance.
 
Method Summary
 boolean hasNext()
          
 X next()
          
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpcastIterator

public UpcastIterator(ReleasableIterator<Y> source)
Creates a new instance.

Parameters:
source - The input source.
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface java.util.Iterator<X>

next

public X next()

Specified by:
next in interface java.util.Iterator<X>

remove

public void remove()

Specified by:
remove in interface java.util.Iterator<X>

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable