org.geotools.feature.simple
Class SimpleFeatureImpl

Object
  extended by SimpleFeatureImpl
All Implemented Interfaces:
Attribute, ComplexAttribute, Feature, Property, SimpleFeature
Direct Known Subclasses:
DefaultFeature, LenientFeature, MutableFIDFeature

public class SimpleFeatureImpl
extends Object
implements SimpleFeature

An implementation of SimpleFeature geared towards speed and backed by an Object[].

Author:
Justin, Andrea Aime

Field Summary
protected  Map<Object,Object>[] attributeUserData
          The set of user data attached to each attribute (lazily created)
protected  SimpleFeatureType featureType
           
protected  FeatureId id
           
protected  Map<String,Integer> index
          The attribute name -> position index
protected  Map<Object,Object> userData
          The set of user data attached to the feature (lazily created)
protected  boolean validating
          Wheter this feature is self validating or not
protected  Object[] values
          The actual values held by this feature
 
Constructor Summary
SimpleFeatureImpl(List<Object> values, SimpleFeatureType featureType, FeatureId id)
          Builds a new feature based on the provided values and feature type
SimpleFeatureImpl(Object[] values, SimpleFeatureType featureType, FeatureId id, boolean validating)
          Fast construction of a new feature.
 
Method Summary
 boolean equals(Object obj)
          override of equals.
 Object getAttribute(int index)
           
 Object getAttribute(Name name)
           
 Object getAttribute(String name)
           
 int getAttributeCount()
           
 List<Object> getAttributes()
           
 BoundingBox getBounds()
           
 Object getDefaultGeometry()
           
 GeometryAttribute getDefaultGeometryProperty()
           
 AttributeDescriptor getDescriptor()
           
 SimpleFeatureType getFeatureType()
           
 String getID()
           
 FeatureId getIdentifier()
           
 Name getName()
           
 int getNumberOfAttributes()
           
 Collection<Property> getProperties()
           
 Collection<Property> getProperties(Name name)
           
 Collection<Property> getProperties(String name)
           
 Property getProperty(Name name)
           
 Property getProperty(String name)
           
 SimpleFeatureType getType()
           
 Map<Object,Object> getUserData()
           
 Collection<? extends Property> getValue()
           
 int hashCode()
          returns a unique code for this feature
 boolean isNillable()
           
 void setAttribute(int index, Object value)
           
 void setAttribute(Name name, Object value)
           
 void setAttribute(String name, Object value)
           
 void setAttributes(List<Object> values)
           
 void setAttributes(Object[] values)
           
 void setDefaultGeometry(Object geometry)
           
 void setDefaultGeometryProperty(GeometryAttribute geometryAttribute)
           
 void setValue(Collection<Property> values)
           
 void setValue(Object newValue)
           
 void validate()
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected FeatureId id

featureType

protected SimpleFeatureType featureType

values

protected Object[] values
The actual values held by this feature


index

protected Map<String,Integer> index
The attribute name -> position index


userData

protected Map<Object,Object> userData
The set of user data attached to the feature (lazily created)


attributeUserData

protected Map<Object,Object>[] attributeUserData
The set of user data attached to each attribute (lazily created)


validating

protected boolean validating
Wheter this feature is self validating or not

Constructor Detail

SimpleFeatureImpl

public SimpleFeatureImpl(List<Object> values,
                         SimpleFeatureType featureType,
                         FeatureId id)
Builds a new feature based on the provided values and feature type

Parameters:
values -
featureType -
id -

SimpleFeatureImpl

public SimpleFeatureImpl(Object[] values,
                         SimpleFeatureType featureType,
                         FeatureId id,
                         boolean validating)
Fast construction of a new feature. The object takes owneship of the provided value array, do not modify after calling the constructor

Parameters:
values -
featureType -
id -
validating -
Method Detail

getIdentifier

public FeatureId getIdentifier()
Specified by:
getIdentifier in interface Attribute
Specified by:
getIdentifier in interface Feature

getID

public String getID()
Specified by:
getID in interface SimpleFeature

getNumberOfAttributes

public int getNumberOfAttributes()

getAttribute

public Object getAttribute(int index)
                    throws IndexOutOfBoundsException
Specified by:
getAttribute in interface SimpleFeature
Throws:
IndexOutOfBoundsException

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface SimpleFeature

getAttribute

public Object getAttribute(Name name)
Specified by:
getAttribute in interface SimpleFeature

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface SimpleFeature

getAttributes

public List<Object> getAttributes()
Specified by:
getAttributes in interface SimpleFeature

getDefaultGeometry

public Object getDefaultGeometry()
Specified by:
getDefaultGeometry in interface SimpleFeature

getFeatureType

public SimpleFeatureType getFeatureType()
Specified by:
getFeatureType in interface SimpleFeature

getType

public SimpleFeatureType getType()
Specified by:
getType in interface Attribute
Specified by:
getType in interface ComplexAttribute
Specified by:
getType in interface Feature
Specified by:
getType in interface Property
Specified by:
getType in interface SimpleFeature

setAttribute

public void setAttribute(int index,
                         Object value)
                  throws IndexOutOfBoundsException
Specified by:
setAttribute in interface SimpleFeature
Throws:
IndexOutOfBoundsException

setAttribute

public void setAttribute(String name,
                         Object value)
Specified by:
setAttribute in interface SimpleFeature

setAttribute

public void setAttribute(Name name,
                         Object value)
Specified by:
setAttribute in interface SimpleFeature

setAttributes

public void setAttributes(List<Object> values)
Specified by:
setAttributes in interface SimpleFeature

setAttributes

public void setAttributes(Object[] values)
Specified by:
setAttributes in interface SimpleFeature

setDefaultGeometry

public void setDefaultGeometry(Object geometry)
Specified by:
setDefaultGeometry in interface SimpleFeature

getBounds

public BoundingBox getBounds()
Specified by:
getBounds in interface Feature

getDefaultGeometryProperty

public GeometryAttribute getDefaultGeometryProperty()
Specified by:
getDefaultGeometryProperty in interface Feature

setDefaultGeometryProperty

public void setDefaultGeometryProperty(GeometryAttribute geometryAttribute)
Specified by:
setDefaultGeometryProperty in interface Feature

getProperties

public Collection<Property> getProperties()
Specified by:
getProperties in interface ComplexAttribute

getProperties

public Collection<Property> getProperties(Name name)
Specified by:
getProperties in interface ComplexAttribute

getProperties

public Collection<Property> getProperties(String name)
Specified by:
getProperties in interface ComplexAttribute

getProperty

public Property getProperty(Name name)
Specified by:
getProperty in interface ComplexAttribute

getProperty

public Property getProperty(String name)
Specified by:
getProperty in interface ComplexAttribute

getValue

public Collection<? extends Property> getValue()
Specified by:
getValue in interface ComplexAttribute
Specified by:
getValue in interface Property

setValue

public void setValue(Collection<Property> values)
Specified by:
setValue in interface ComplexAttribute

setValue

public void setValue(Object newValue)
Specified by:
setValue in interface Property

getDescriptor

public AttributeDescriptor getDescriptor()
Specified by:
getDescriptor in interface Attribute
Specified by:
getDescriptor in interface Property

getName

public Name getName()
Specified by:
getName in interface Property

isNillable

public boolean isNillable()
Specified by:
isNillable in interface Property

getUserData

public Map<Object,Object> getUserData()
Specified by:
getUserData in interface Property

hashCode

public int hashCode()
returns a unique code for this feature

Overrides:
hashCode in class Object
Returns:
A unique int

equals

public boolean equals(Object obj)
override of equals. Returns if the passed in object is equal to this.

Overrides:
equals in class Object
Parameters:
obj - the Object to test for equality.
Returns:
true if the object is equal, false otherwise.

validate

public void validate()
Specified by:
validate in interface Attribute
Specified by:
validate in interface ComplexAttribute


Copyright © 1996-2009 Geotools. All Rights Reserved.