org.geotools.data.store
Class ReTypingFeatureCollection

Object
  extended by DecoratingSimpleFeatureCollection
      extended by ReTypingFeatureCollection
All Implemented Interfaces:
SimpleFeatureCollection, FeatureCollection<SimpleFeatureType,SimpleFeature>

public class ReTypingFeatureCollection
extends DecoratingSimpleFeatureCollection

SimpleFeatureCollection decorator which decorates a feature collection "re-typing" its schema based on attributes specified in a query.

Author:
Justin Deoliveira, The Open Planning Project

Field Summary
 
Fields inherited from class DecoratingSimpleFeatureCollection
delegate
 
Constructor Summary
ReTypingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate, SimpleFeatureType featureType)
           
ReTypingFeatureCollection(SimpleFeatureCollection delegate, SimpleFeatureType featureType)
           
 
Method Summary
protected  boolean canDelegate(FeatureVisitor visitor)
          Methods for subclass to override in order to determine if the supplied visitor can be passed to the delegate collection.
 SimpleFeatureIterator features()
          Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.
 SimpleFeatureType getSchema()
          The schema for the child feature members of this collection.
 FeatureReader<SimpleFeatureType,SimpleFeature> reader()
           
 
Methods inherited from class DecoratingSimpleFeatureCollection
accepts, contains, containsAll, equals, getBounds, getID, hashCode, isEmpty, size, sort, subCollection, toArray, toArray
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReTypingFeatureCollection

public ReTypingFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> delegate,
                                 SimpleFeatureType featureType)

ReTypingFeatureCollection

public ReTypingFeatureCollection(SimpleFeatureCollection delegate,
                                 SimpleFeatureType featureType)
Method Detail

getSchema

public SimpleFeatureType getSchema()
Description copied from interface: FeatureCollection
The schema for the child feature members of this collection.

Represents the most general FeatureType in common to all the features in this collection.

Specified by:
getSchema in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
getSchema in class DecoratingSimpleFeatureCollection
Returns:
FeatureType describing the "common" schema to all child features of this collection

reader

public FeatureReader<SimpleFeatureType,SimpleFeature> reader()
                                                      throws IOException
Throws:
IOException

features

public SimpleFeatureIterator features()
Description copied from interface: SimpleFeatureCollection
Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.

The implementation of FeatureIterator must adhere to the rules of fail-fast concurrent modification. In addition (to allow for resource backed collections) the SimpleFeatureIterator.close() method must be called.

Example use:


 SimpleFeatureIterator iterator=collection.features();
 try {
     while( iterator.hasNext()  ){
          SimpleFeature feature = iterator.next();
          System.out.println( feature.getID() );
     }
 }
 finally {
     iterator.close();
 }
 

Specified by:
features in interface SimpleFeatureCollection
Specified by:
features in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Overrides:
features in class DecoratingSimpleFeatureCollection
Returns:
A FeatureIterator.

canDelegate

protected boolean canDelegate(FeatureVisitor visitor)
Description copied from class: DecoratingSimpleFeatureCollection
Methods for subclass to override in order to determine if the supplied visitor can be passed to the delegate collection.

The default is false and the visitor receives the decoraeted features.

Overrides:
canDelegate in class DecoratingSimpleFeatureCollection


Copyright © 1996-2014 Geotools. All Rights Reserved.