Interface SimpleFeatureType

All Superinterfaces:
AttributeType, ComplexType, FeatureType, PropertyType
All Known Implementing Classes:
SimpleFeatureTypeImpl, VPFFeatureClass, VPFFeatureType

public interface SimpleFeatureType extends FeatureType
The type of a SimpleFeature.

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 with getDescriptor(String) and getDescriptor(Name).
Author:
Jody Garnett, Refractions Research, Justin Deoliveira, The Open Planning Project
  • 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

      AttributeDescriptor getDescriptor(String name)
      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 interface ComplexType
      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

      AttributeDescriptor getDescriptor(Name name)
      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 interface ComplexType
      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

      AttributeDescriptor getDescriptor(int index) throws IndexOutOfBoundsException
      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 type

      This 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

      AttributeType getType(String name)
      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

      AttributeType getType(Name name)
      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

      AttributeType getType(int index) throws IndexOutOfBoundsException
      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

      int indexOf(String name)
      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

      int indexOf(Name name)
      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.