public abstract class

FeatureTable

extends Object
java.lang.Object
   ↳ com.esri.core.table.FeatureTable
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Represents a table that has a schema and which contains features conforming to that schema. A FeatureTable is used to create a FeatureLayer. The FeatureLayer once added to a map will display the table's features in the map. The feature table is used to add, update, and delete features, as well as obtaining features using their unique ID or via a query returning either features or feature IDs.

Summary

Public Constructors
FeatureTable()
Public Methods
abstract long addFeature(Feature feature)
Adds the given feature to the table.
abstract long[] addFeatures(List<Feature> features)
Adds the given features to the table.
abstract void deleteFeature(long featureId)
Deletes the specified feature from the table.
abstract void deleteFeatures(long[] featureId)
Deletes the specified features from the table.
abstract String getCopyright()
Gets the copyright information.
abstract Envelope getExtent()
Returns the full extent associated with this feature table.
abstract Feature getFeature(long id)
Retrieves the feature with the given ID from the table.
abstract FeatureResult getFeatures(long[] ids)
Retrieves the features with the given IDs from the table.
abstract Field getField(String fieldName)
Returns the Field object with the specified field name.
abstract List<Field> getFields()
Returns all the Fields in the table.
abstract long getNumberOfFeatures()
Gets the number of features in the table.
abstract SpatialReference getSpatialReference()
Returns the spatial reference that the geometries in this table are in.
abstract String getTableName()
This returns the table name as defined by the table type.
abstract boolean hasGeometry()
This returns true if this feature table has a geometry column.
abstract boolean isEditable()
Checks if the table can be edited.
abstract Future<FeatureResult> queryFeatures(QueryParameters query, CallbackListener<FeatureResult> callback)
Queries the table using the given query parameters, and returns an iterator of features found by the query.
abstract Future<long[]> queryIds(QueryParameters query, CallbackListener<long[]> callback)
Queries the table using the given query parameters, and returns an array of feature IDs found by the query.
String toString()
abstract void updateFeature(long featureId, Feature feature)
Updates the feature specified by the unique feature ID.
abstract void updateFeatures(long[] featureIds, List<Feature> features)
Updates the features specified by the array of feature IDs passed in.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FeatureTable ()

Public Methods

public abstract long addFeature (Feature feature)

Adds the given feature to the table.

Parameters
feature Feature: the feature to add
Returns
long the unique ID of the added feature
Throws
TableException if the feature does not conform to the table's schema

public abstract long[] addFeatures (List<Feature> features)

Adds the given features to the table.

Parameters
features List: the features to add
Returns
long[] an array of the unique IDs of the added features
Throws
TableException if any feature does not conform to the table's schema

public abstract void deleteFeature (long featureId)

Deletes the specified feature from the table.

Parameters
featureId long: the feature's unique ID
Throws
TableException if the feature does not conform to the table's schema

public abstract void deleteFeatures (long[] featureId)

Deletes the specified features from the table.

Parameters
featureId long: an array of feature IDs to delete
Throws
TableException if any feature does not conform to the table's schema

public abstract String getCopyright ()

Gets the copyright information.

Returns
String the copyright

public abstract Envelope getExtent ()

Returns the full extent associated with this feature table. Features in the table will fall within this extent.

Returns
Envelope the extent

public abstract Feature getFeature (long id)

Retrieves the feature with the given ID from the table.

Parameters
id long: the feature's unique ID
Returns
Feature the feature
Throws
TableException the table schema exception

public abstract FeatureResult getFeatures (long[] ids)

Retrieves the features with the given IDs from the table.

Parameters
ids long: an array of feature IDs
Returns
FeatureResult an iterator for the features obtained from the IDs passed in

public abstract Field getField (String fieldName)

Returns the Field object with the specified field name.

Parameters
fieldName String: the field name
Returns
Field the Field object

public abstract List<Field> getFields ()

Returns all the Fields in the table.

Returns
List<Field> a list of Fields

public abstract long getNumberOfFeatures ()

Gets the number of features in the table.

Returns
long the number of features

public abstract SpatialReference getSpatialReference ()

Returns the spatial reference that the geometries in this table are in.

Returns
SpatialReference the spatial reference

public abstract String getTableName ()

This returns the table name as defined by the table type.

Returns
String the table name

public abstract boolean hasGeometry ()

This returns true if this feature table has a geometry column. If it does not, then it is a table only and cannot be bound to a feature layer to draw on a map.

Returns
boolean true, if the feature table has a geometry column

public abstract boolean isEditable ()

Checks if the table can be edited.

Returns
boolean true, if the table is editable

public abstract Future<FeatureResult> queryFeatures (QueryParameters query, CallbackListener<FeatureResult> callback)

Queries the table using the given query parameters, and returns an iterator of features found by the query.

Parameters
query QueryParameters: the query parameters
callback CallbackListener: the callback with the iterator of features
Returns
Future<FeatureResult> the future with the iterator of features. The elements of the returned FeatureResult can be cast to
  • Feature for queries without statistics, or
  • to Map<String, Object> for queries with statistics.
Examples:
(1) Query without out-statistics
 
 QueryParameters query = new QueryParameters();
 query.setOutFields(new String[]{"*"});
 Future resultFuture = gdbFeatureTable.queryFeatures(query, new CallbackListener() {
   
   public void onError(Throwable e) {
     e.printStackTrace();
   }
   
   public void onCallback(FeatureResult featureIterator) {
     ...
   }
 });
 
 for (Object result : resultFuture.get()) {
   Feature feature = (Feature) result;
   // Map attrs = feature.getAttributes();
 }
 
 
(2) Query with out-statistics
 
 QueryParameters query = new QueryParameters();
 query.setOutStatistics(new OutStatistics[] {
   new OutStatistics(OutStatistics.Type.SUM, "ACRES", "SUM_ACRES")});

 Future resultFuture = 
   gdbFeatureTable.queryFeatures(query, new CallbackListener() {
   
   public void onError(Throwable e) {
     e.printStackTrace();
   }
   
   public void onCallback(FeatureResult featureIterator) {
     ...
   }
 });
    
 for (Object result : resultFuture.get()) {
   Map<String, Object> recordAsMap = (Map<String, Object>) result;
   double sumAcres = (Double) (recordAsMap.get("SUM_ACRES"));
 }
 
 

public abstract Future<long[]> queryIds (QueryParameters query, CallbackListener<long[]> callback)

Queries the table using the given query parameters, and returns an array of feature IDs found by the query.

Parameters
query QueryParameters: the query parameters
callback CallbackListener: the callback with the array of feature IDs
Returns
Future<long[]> the future with the array of feature IDs

public String toString ()

Returns
String

public abstract void updateFeature (long featureId, Feature feature)

Updates the feature specified by the unique feature ID. To use this method, create a new feature with the properties you wish to update (such as geometry, certain attribute values), and pass in this feature.

Parameters
featureId long: the ID of the feature to update
feature Feature: the feature with the updated properties
Throws
TableException if the feature does not conform to the table's schema

public abstract void updateFeatures (long[] featureIds, List<Feature> features)

Updates the features specified by the array of feature IDs passed in. To use this method, for each feature you wish to update, create a new feature with the properties to update (such as geometry, certain attribute values), and add it to the list of features in the same order as in the array of IDs.

Parameters
featureIds long: the IDs of features to update
features List: the features with the updated properties
Throws
TableException any exception such as a feature not conforming to the table's schema