Class Feature

  • All Implemented Interfaces:
    GeoElement
    Direct Known Subclasses:
    ArcGISFeature

    public class Feature
    extends Object
    implements GeoElement
    Represents a single feature from a FeatureTable. Provides access to all of the feature's Fields, values of the feature's attributes, and also to its geometry if one is set. Feature Tables have a fixed schema, for example Fields can't be added, deleted, or modified.
    Since:
    100.0.0
    • Method Detail

      • getAttributes

        public Map<String,​Object> getAttributes()
        Gets a java.util.Map of all the available attributes as name value pairs. Only a subset of all attributes may be available on a ServiceFeatureTable if its outfields have been set.

        Attribute values are returned as Object instances, but the underlying value type is based on the Field.Type.

        Below is example of how to change an editable attribute then apply the change to the FeatureTable.

         feature.getAttributes().put("fieldName", "attributeValue");
         ListenableFuture<Boolean> result = featureTable.updateFeatureAsync(feature);
         
        Specified by:
        getAttributes in interface GeoElement
        Returns:
        all the available attributes as name value pairs.
        Since:
        100.0.0
        See Also:
        FeatureTable.updateFeatureAsync(Feature)
      • getGeometry

        public Geometry getGeometry()
        Description copied from interface: GeoElement
        Gets the geometry of this geoelement.
        Specified by:
        getGeometry in interface GeoElement
        Returns:
        the geometry of this geoelement
      • setGeometry

        public void setGeometry​(Geometry geometry)
        Description copied from interface: GeoElement
        Sets the GeoElement's geometry.
        Specified by:
        setGeometry in interface GeoElement
        Parameters:
        geometry - the geometry to set
      • getFeatureTable

        public FeatureTable getFeatureTable()
        Gets a reference to the FeatureTable that this feature came from.
        Returns:
        a reference to the FeatureTable that this feature came from
        Since:
        100.0.0
      • refresh

        public boolean refresh()
        Resets the attributes and geometry of this feature to the values of the local backing feature table by discarding any in-memory changes to this feature that have not been applied to the local backing feature table. This method does not make any network requests, data is only refreshed locally as follows:
        • For a new feature instance that is not added to the table yet, no changes to geometry or attributes.
        • For an updated feature that is in the table, geometry and attributes change to the state in the local table.
        • For a feature that has been deleted from the table, no changes to geometry or attributes.
        Returns:
        true if the geometry or attributes were reset, false otherwise
        Since:
        100.4.0