Class FeatureSubset

All Implemented Interfaces:
DataSet, FeatureSet, Resource

final class FeatureSubset extends AbstractFeatureSet
The result of FeatureQuery.execute(FeatureSet) executed using Java Stream methods. Queries executed by this class do not benefit from accelerations provided for example by databases. This class should be used only as a fallback when the query cannot be executed natively by FeatureSet.subset(Query).
Since:
1.0
Version:
1.3
  • Field Details

    • source

      private final FeatureSet source
      The set of feature instances to filter, sort or process.
    • query

      private final FeatureQuery query
      The query for filtering the source set of features.
    • resultType

      private DefaultFeatureType resultType
      The type of features in this set. May or may not be the same as source. This is computed when first needed.
  • Constructor Details

    • FeatureSubset

      FeatureSubset(FeatureSet source, FeatureQuery query)
      Creates a new set of features by filtering the given set using the given query. This given query is stored as-is (it is not cloned neither optimized).
  • Method Details

    • createMetadata

      protected org.opengis.metadata.Metadata createMetadata() throws DataStoreException
      Creates metadata about this subset. It includes information about the complete feature set.
      Overrides:
      createMetadata in class AbstractFeatureSet
      Returns:
      the newly created metadata, or null if unknown.
      Throws:
      DataStoreException - if an error occurred while reading metadata from this resource.
    • getType

      public DefaultFeatureType getType() throws DataStoreException
      Returns a description of properties that are common to all features in this dataset.
      Returns:
      description of common properties (never null).
      Throws:
      DataStoreException - if an error occurred while reading definitions from the underlying data store.
    • features

      public Stream<AbstractFeature> features(boolean parallel) throws DataStoreException
      Returns a stream of all features contained in this dataset.
      Parameters:
      parallel - true for a parallel stream (if supported), or false for a sequential stream.
      Returns:
      all features contained in this dataset.
      Throws:
      DataStoreException - if an error occurred while creating the stream.