Interface FeatureType
-
@XmlElement(value="FeatureType") public interface FeatureType
Describes a feature in an application namespace. AFeatureTyperepresents 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 ajavax.sound.midi.Sequenceobject, which contains afloatpublic field calledPPQ. The fact that this attribute exists is not known by theFeatureTypeitself. If a caller asks thisFeatureTypefor all of its attributes, theFeatureTypewill tell the caller that it has an attribute of typejavax.sound.midi.Sequence, but not that this attribute has a sub-attribute (field) calledPPQ. 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 theFeatureTypeis aFeaturetype. 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 byFeatureTypeimplementations.It is the responsibility of the implementing class to ensure that the
FeatureTypeis always in a valid state. This means that each attribute tuple must be fully initialized and valid. The minimum validFeatureTypeis 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 aFeatureType:Immutability
Feature types must be implemented as immutable objects!XPath
XPath is the standard used to access all attributes (flat, nested, and multiple), via a single, unified string. Using XPath to access attributes has the convenient side-benefit of making them appear to be non-nested and non-multiple to callers with no awareness of XPath. This greatly simplifies accessing and manipulating data. However, it does put extra burden on the implementers ofFeatureTypeto understand and correctly implement XPath pointers. Note that theFeatureobject does not understand XPath at all and relies on implementors of this interface to interpret XPath references. Fortunately, XPath is quite simple and has a clearly written specification.Feature Creation
FeatureTypealso must provide methods for the creation ofFeatures. The creatingFeatureTypeshould check to see if the passed in objects validate against its attribute types, and if it does should return a new feature.
- Since:
- GeoAPI 2.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description FeaturecreateFeature()Returns a new, unpopulated instance of this type ofFeature.java.util.List<FeatureAttributeDescriptor>getAttributeDescriptors()Returns a list of descriptors that lists all of the attributes that aFeatureof this type will have.java.util.List<FeatureType>getChildTypes()Returns theFeatureTypes that could potentially be childFeatures of this feature type.FeatureAttributeDescriptorgetDefaultShapeAttribute()Returns the descriptor of the shape that should be used for "default" drawing of features of this type.GenericNamegetName()Returns the name of thisFeatureType, including any namespace prefix.java.lang.StringgetPreferredPrefix()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.booleanisCollectionType()Returns true if features of this type can be cast toFeatureCollection.
-
-
-
Method Detail
-
getName
@XmlElement(value="Name") GenericName getName()
Returns the name of thisFeatureType, including any namespace prefix.The typical usage of these
GenericNames will be as follows: In most cases, theGenericNamewill 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 aLocalNamewhosetoString()gives the URI of an XML namespace.
-
getPreferredPrefix
java.lang.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
java.util.List<FeatureAttributeDescriptor> getAttributeDescriptors()
Returns a list of descriptors that lists all of the attributes that aFeatureof 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 toFeatureCollection.
-
getChildTypes
java.util.List<FeatureType> getChildTypes()
Returns theFeatureTypes that could potentially be childFeatures of this feature type. Each returned element may in turn have childFeatureTypeinstances of its own.
-
createFeature
Feature createFeature() throws java.lang.UnsupportedOperationException
Returns a new, unpopulated instance of this type ofFeature. When the object is returned, all of its attributes are null.The returned object will be an instance of
FeatureCollectionif and only if theisCollectionType()method returnstrue.The
Featurethat 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:
java.lang.UnsupportedOperationException- If this feature type does not support the creation of new instances.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG