GeoAPI 2.0
Build 2005-06-08

org.opengis.feature
Interface FeatureType


@XmlElement(value="FeatureType")
public interface FeatureType

Describes a feature in an application namespace. A FeatureType represents features as an object that contains zero or more attribute objects, one of which will generally be a geometry, but no geometry and multiple geometries are allowed. Note that instances of this class are henceforth referred to as schemas.

With one exception, the type of an attribute is considered to be its cannonical definition by the FeatureType. For example, an attribute type might be a javax.sound.midi.Sequence object, which contains a float public field called PPQ. The fact that this attribute exists is not known by the FeatureType itself. If a caller asks this FeatureType for all of its attributes, the FeatureType will tell the caller that it has an attribute of type javax.sound.midi.Sequence, but not that this attribute has a sub-attribute (field) called PPQ. It is the responsibility of the callers to understand the objects it is asking for and manipulate them appropriately. The sole exception is if the type stored in the FeatureType is a Feature type. In this case, all information about sub-attributes are stored and passed to calling classes upon request. The style of reference (XPath) is defined in and mediated by FeatureType implementations.

It is the responsibility of the implementing class to ensure that the FeatureType is always in a valid state. This means that each attribute tuple must be fully initialized and valid. The minimum valid FeatureType is one with nulls for namespace, type, and attributes; this is clearly a trivial case, since it is so constrained that it would not allow for any feature construction. There are a few conventions of which implementers of this interface must be aware in order to successfully manage a FeatureType:

Since:
GeoAPI 2.0

REVISIT OPEN ISSUE (a GeoAPI comment)
The following XML elements are not yet defined in this interface: Title, Abstract, Keywords, DefaultSRS, OtherSRS, NoSRS, Operations, OutputFormats, WGS84BoundingBox, MetadataURL.

Method Summary
 Feature createFeature()
          Returns a new, unpopulated instance of this type of Feature.
 List<FeatureAttributeDescriptor> getAttributeDescriptors()
          Returns a list of descriptors that lists all of the attributes that a Feature of this type will have.
 List<FeatureType> getChildTypes()
          Returns the FeatureTypes that could potentially be child Features of this feature type.
 FeatureAttributeDescriptor getDefaultShapeAttribute()
          Returns the descriptor of the shape that should be used for "default" drawing of features of this type.
 GenericName getName()
          Returns the name of this FeatureType, including any namespace prefix.
 String getPreferredPrefix()
          In cases where features are to be encoded as GML, the namespace portion of the name of the type must be mapped to a prefix in an "xmlns" XML attribute.
 boolean isCollectionType()
          Returns true if features of this type can be cast to FeatureCollection.
 

Method Detail

getName

@XmlElement(value="Name")
GenericName getName()
Returns the name of this FeatureType, including any namespace prefix.

The typical usage of these GenericNames will be as follows: In most cases, the GenericName will have a local part that is be the name of the XML element used to encode such features as GML. The scope of the name will either be null (if the XML element is to have no namespace) or will be a LocalName whose toString() gives the URI of an XML namespace.


getPreferredPrefix

String getPreferredPrefix()
In cases where features are to be encoded as GML, the namespace portion of the name of the type must be mapped to a prefix in an "xmlns" XML attribute. If the data provider desires to do so, he may return a prefix from this method to indicate a preference for this mapping. It is also valid to return null, indicating that the data provider doesn't know or doesn't care.


getAttributeDescriptors

List<FeatureAttributeDescriptor> getAttributeDescriptors()
Returns a list of descriptors that lists all of the attributes that a Feature of this type will have.


getDefaultShapeAttribute

FeatureAttributeDescriptor getDefaultShapeAttribute()
Returns the descriptor of the shape that should be used for "default" drawing of features of this type. This may only be null when features of this type do not have geometric attributes.


isCollectionType

boolean isCollectionType()
Returns true if features of this type can be cast to FeatureCollection.


getChildTypes

List<FeatureType> getChildTypes()
Returns the FeatureTypes that could potentially be child Features of this feature type. Each returned element may in turn have child FeatureType instances of its own.


createFeature

Feature createFeature()
                      throws UnsupportedOperationException
Returns a new, unpopulated instance of this type of Feature. When the object is returned, all of its attributes are null.

The returned object will be an instance of FeatureCollection if and only if the isCollectionType() method returns true.

The Feature that is returned is not persisted or displayed until the caller takes further action, such as adding the feature to a collection that is backed by a data store.

Throws:
UnsupportedOperationException - If this feature type does not support the creation of new instances.

GeoAPI 2.0
Build 2005-06-08

Symbols, terms and definitions
Copyright OpenGIS® Consortium