Class AbstractFeatureSet

Object
AbstractResource
AbstractFeatureSet
All Implemented Interfaces:
Data­Set, Feature­Set, Resource
Direct Known Subclasses:
Concatenated­Feature­Set, Join­Feature­Set, Memory­Feature­Set

public abstract class AbstractFeatureSet extends AbstractResource implements FeatureSet
Default implementations of several methods for classes that want to implement the Feature­Set interface. Subclasses should override the following methods:

Thread safety

Default methods of this abstract class are thread-safe. Synchronization, when needed, uses Abstract­Resource​.get­Synchronization­Lock().
Since:
1.2
  • Constructor Details

    • AbstractFeatureSet

      protected AbstractFeatureSet(Resource parent)
      Creates a new resource, potentially as a child of another resource. The parent resource is typically, but not necessarily, an Aggregate.
      Parameters:
      parent - the parent resource, or null if none.
      Since:
      1.4
    • AbstractFeatureSet

      protected AbstractFeatureSet(StoreListeners parentListeners, boolean hidden)
      Creates a new resource which can send notifications to the given set of listeners. The hidden argument specifies whether the new resource should be invisible in the tree of resources. See the parent constructor for more information.
      Parameters:
      parent­Listeners - listeners of the parent resource, or null if none. This is usually the listeners of the Data­Store that created this resource.
      hidden - false if this resource shall use its own Store­Listeners with the specified parent, or true for using parent­Listeners directly.
  • Method Details

    • getIdentifier

      public Optional<GenericName> getIdentifier() throws DataStoreException
      Returns the feature type name as the identifier for this resource. Subclasses should override if they can provide a more specific identifier.
      Specified by:
      get­Identifier in interface Resource
      Returns:
      the resource identifier inferred from feature type.
      Throws:
      Data­Store­Exception - if an error occurred while fetching the identifier.
      See Also:
    • getFeatureCount

      public OptionalLong getFeatureCount()
      Returns an estimation of the number of features in this set, or empty if unknown. The default implementation returns an empty value.
      Returns:
      estimation of the number of features.
    • prepareQueryOptimization

      protected void prepareQueryOptimization(FeatureQuery query, Optimization optimizer) throws DataStoreException
      Configures the optimization of a query to be applied on this Feature­Set. This method is invoked indirectly by the default implementation of subset(Query). The default implementation of this method does nothing.

      Recommendation

      Subclasses should override this method as below if they can guarantee that the feature type returned by Feature­Set​.get­Type() is final, i.e. that the result of the query will not contain any feature which (before projection) is an instance of some subtype:
      @Override
      protected void prepareQueryOptimization(FeatureQuery query, Optimization optimizer) throws DataStoreException {
          optimizer.setFinalFeatureType(getType());
      }
      
      Parameters:
      query - definition of feature and feature properties filtering applied at reading time.
      optimizer - the optimization to configure.
      Throws:
      Data­Store­Exception - if an error occurred during the configuration of the optimizer.
      Since:
      1.6
    • createMetadata

      protected Metadata createMetadata() throws DataStoreException
      Invoked in a synchronized block the first time that get­Metadata() is invoked. The default implementation populates metadata based on information provided by get­Identifier(), get­Envelope(), get­Type() and get­Feature­Count(). Subclasses should override if they can provide more information. The default value can be completed by casting to Default­Metadata.
      Overrides:
      create­Metadata in class Abstract­Resource
      Returns:
      the newly created metadata, or null if unknown.
      Throws:
      Data­Store­Exception - if an error occurred while reading metadata from this resource.