Interface SimpleFeatureType
- All Superinterfaces:
AttributeType
,ComplexType
,FeatureType
,PropertyType
- All Known Implementing Classes:
SimpleFeatureTypeImpl
,VPFFeatureClass
,VPFFeatureType
The definition of a "simple feature" can be summed up as the following:
- made up of only non-complex attributes, no associations
- attributes are of multiplicity 1
- attributes are ordered
- attribute names are unqualified (namespaceURI == null)
Attribute Indexing
The attributes which compose a simple feature type are ordered. For this reason attributes are available via a simple index. Given the following type definition:<complexType name="mySimpleType"/> <sequence> <element name="foo" type="xs:string"/> <element name="bar" type="xs:integer"/> </sequence> </complexType>
The attribute descriptor are addressable via index:
SimpleFeatureType type = ...; AttributeDescriptor foo = type.getAttribute( 0 ); AttributeDescriptor bar-= type.getAttribute( 1 );
Attribute Multiplicity
With simple feature types, the multiplicity of attributes is always assumed to be 1, ie,
getMinOccurs() == 1
and getMaxOccurs() == 1
. A consequence of this is that attributes from a
simple feature always line up 1 to 1 with the descriptors from the type:
SimpleFeature feature = ...; SimpleFeatureType type = feature.getType(); type.getAttribute( 0 ).getDescriptor() == type.getAttribute( 0 ); type.getAttribute( 1 ).getDescriptor() == type.getAttribute( 1 );
Attribute Naming
The names of attributes in a simple feature type are never namespace qualified. For this reason there is no difference between accessing an attribute withgetDescriptor(String)
and getDescriptor(Name)
.- Author:
- Jody Garnett, Refractions Research, Justin Deoliveira, The Open Planning Project
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of attributes composing the feature typeThe list of attribute descriptors which make up the feature type.getDescriptor
(int index) Returns the attribute descriptor at the specified index.getDescriptor
(String name) Returns the attribute descriptor which matches the specified name.getDescriptor
(Name name) Returns the attribute descriptor which matches the specified name.getType
(int index) Returns the type of the attribute at the specified index.Returns the type of the attribute which matches the specified name.Returns the type of the attribute which matches the specified name.The local name for this FeatureType.getTypes()
Returns the types of all the attributes which make up the feature.int
Returns the index of the attribute which matches the specified name.int
Returns the index of the attribute which matches the specified name.Methods inherited from interface AttributeType
getSuper
Methods inherited from interface ComplexType
getBinding, getDescriptors, isInline
Methods inherited from interface FeatureType
getCoordinateReferenceSystem, getGeometryDescriptor, isIdentified
Methods inherited from interface PropertyType
equals, getDescription, getName, getRestrictions, getUserData, hashCode, isAbstract
-
Method Details
-
getTypeName
String getTypeName()The local name for this FeatureType.Specifically this method returns
getName().getLocalPart().
- Returns:
- The local name for this FeatureType.
-
getAttributeDescriptors
List<AttributeDescriptor> getAttributeDescriptors()The list of attribute descriptors which make up the feature type.This method is a convenience for:
return (List<AttributeDescriptor>) getProperties();
- Returns:
- The ordered list of attribute descriptors.
-
getDescriptor
Returns the attribute descriptor which matches the specified name.This method is convenience for:
return (AttributeDescriptor) getProperty(name);
This method returns
null
if no such attribute exists.- Specified by:
getDescriptor
in interfaceComplexType
- Parameters:
name
- The name of the descriptor to return.- Returns:
- The attribute descriptor matching the specified name, or
null
if no such attribute exists.
-
getDescriptor
Returns the attribute descriptor which matches the specified name.This method is convenience for:
return (AttributeDescriptor) getProperty(name);
This method returns
null
if no such attribute exists.- Specified by:
getDescriptor
in interfaceComplexType
- Parameters:
name
- The name of the descriptor to return.- Returns:
- The attribute descriptor matching the specified name, or
null
if no such attribute exists.
-
getDescriptor
Returns the attribute descriptor at the specified index.This method is convenience for:
return (AttributeDescriptor) ((List) getProperties()).get(index);
- Parameters:
index
- The index of the descriptor to return.- Returns:
- The attribute descriptor at the specified index.
- Throws:
IndexOutOfBoundsException
- When the index is out of bounds.
-
getAttributeCount
int getAttributeCount()Returns the number of attributes composing the feature typeThis method is convenience for
getAttributes().size()
.- Returns:
- The number of attributes.
-
getTypes
List<AttributeType> getTypes()Returns the types of all the attributes which make up the feature.This method is convenience for:
List types = new ArrayList(); for (Property p : getProperties()) { types.add(p.getType()); } return types;
- Returns:
- The list of attribute types.
-
getType
Returns the type of the attribute which matches the specified name.This method is convenience for:
return (AttributeType) getProperty(name).getType();
If there is no such attribute which matches name,
null
is returned.- Parameters:
name
- The name of the attribute whose type to return.- Returns:
- The attribute type matching the specified name, or
null
.
-
getType
Returns the type of the attribute which matches the specified name.This method is convenience for:
return (AttributeType) getProperty(name).getType();
If there is no such attribute which matches name,
null
is returned.- Parameters:
name
- The name of the attribute whose type to return.- Returns:
- The attribute type matching the specified name, or
null
.
-
getType
Returns the type of the attribute at the specified index.This method is convenience for:
return (AttributeType)((List)getProperties()).get(index)).getType();
- Parameters:
index
- The index of the attribute whose type to return.- Returns:
- The attribute type at the specified index.
- Throws:
IndexOutOfBoundsException
- When the index is out of bounds.
-
indexOf
Returns the index of the attribute which matches the specified name.-1 is returned in the instance there is no attribute matching the specified name.
- Parameters:
name
- The name of the attribute whose index to return.- Returns:
- index of named attribute, or -1 if not found.
-
indexOf
Returns the index of the attribute which matches the specified name.-1 is returned in the instance there is no attribute matching the specified name.
- Parameters:
name
- The name of the attribute whose index to return.- Returns:
- index of named attribute, or -1 if not found.
-