Package org.geotools.data.store
Class ReTypingFeatureCollection
Object
DecoratingSimpleFeatureCollection
ReTypingFeatureCollection
- All Implemented Interfaces:
SimpleFeatureCollection
,FeatureCollection<SimpleFeatureType,
SimpleFeature>
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
ConstructorsConstructorDescriptionReTypingFeatureCollection
(SimpleFeatureCollection delegate, SimpleFeatureType featureType) ReTypingFeatureCollection
(FeatureCollection<SimpleFeatureType, SimpleFeature> delegate, SimpleFeatureType featureType) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canDelegate
(FeatureVisitor visitor) Methods for subclass to override in order to determine if the supplied visitor can be passed to the delegate collection.features()
Obtain a SimpleFeatureIterator of the Features within this SimpleFeatureCollection.The schema for the child feature members of this collection.static boolean
isTypeCompatible
(FeatureVisitor visitor, SimpleFeatureType featureType) Checks if the visitor is accessing only properties available in the specified feature type, or as a special case, if it's a count visitor accessing no properties at allreader()
Methods inherited from class DecoratingSimpleFeatureCollection
accepts, contains, containsAll, equals, getBounds, getID, hashCode, isEmpty, size, sort, subCollection, toArray, toArray
-
Constructor Details
-
ReTypingFeatureCollection
public ReTypingFeatureCollection(FeatureCollection<SimpleFeatureType, SimpleFeature> delegate, SimpleFeatureType featureType) -
ReTypingFeatureCollection
-
-
Method Details
-
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.
- For a collection backed by a shapefiles (or database tables) the FeatureType returned by getSchema() will complete describe each and every child in the collection.
- For mixed content FeatureCollections you will need to check the FeatureType of each Feature as it is retrived from the collection
- The degenerate case returns the "_Feature" FeatureType, where the only thing known is that the contents are Features.
- Specified by:
getSchema
in interfaceFeatureCollection<SimpleFeatureType,
SimpleFeature> - Overrides:
getSchema
in classDecoratingSimpleFeatureCollection
- Returns:
- FeatureType describing the "common" schema to all child features of this collection
-
reader
- Throws:
IOException
-
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 interfaceFeatureCollection<SimpleFeatureType,
SimpleFeature> - Specified by:
features
in interfaceSimpleFeatureCollection
- Overrides:
features
in classDecoratingSimpleFeatureCollection
- Returns:
- A FeatureIterator.
-
canDelegate
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 classDecoratingSimpleFeatureCollection
-
isTypeCompatible
Checks if the visitor is accessing only properties available in the specified feature type, or as a special case, if it's a count visitor accessing no properties at all
-