org.geotools.feature.simple
Class SimpleFeatureImpl

java.lang.Object
  extended by org.geotools.feature.simple.SimpleFeatureImpl
All Implemented Interfaces:
org.opengis.feature.Attribute, org.opengis.feature.ComplexAttribute, org.opengis.feature.Feature, org.opengis.feature.Property, org.opengis.feature.simple.SimpleFeature
Direct Known Subclasses:
LenientFeature, MutableFIDFeature

public class SimpleFeatureImpl
extends java.lang.Object
implements org.opengis.feature.simple.SimpleFeature

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

Author:
Justin, Andrea Aime

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

Field Detail

id

protected org.opengis.filter.identity.FeatureId id

featureType

protected org.opengis.feature.simple.SimpleFeatureType featureType

values

protected java.lang.Object[] values
The actual values held by this feature


index

protected java.util.Map<java.lang.String,java.lang.Integer> index
The attribute name -> position index


userData

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


attributeUserData

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


validating

protected boolean validating
Whether this feature is self validating or not

Constructor Detail

SimpleFeatureImpl

public SimpleFeatureImpl(java.util.List<java.lang.Object> values,
                         org.opengis.feature.simple.SimpleFeatureType featureType,
                         org.opengis.filter.identity.FeatureId id)
Builds a new feature based on the provided values and feature type

Parameters:
values -
featureType -
id -

SimpleFeatureImpl

public SimpleFeatureImpl(java.lang.Object[] values,
                         org.opengis.feature.simple.SimpleFeatureType featureType,
                         org.opengis.filter.identity.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 org.opengis.filter.identity.FeatureId getIdentifier()
Specified by:
getIdentifier in interface org.opengis.feature.Attribute
Specified by:
getIdentifier in interface org.opengis.feature.Feature

getID

public java.lang.String getID()
Specified by:
getID in interface org.opengis.feature.simple.SimpleFeature

getNumberOfAttributes

public int getNumberOfAttributes()

getAttribute

public java.lang.Object getAttribute(int index)
                              throws java.lang.IndexOutOfBoundsException
Specified by:
getAttribute in interface org.opengis.feature.simple.SimpleFeature
Throws:
java.lang.IndexOutOfBoundsException

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface org.opengis.feature.simple.SimpleFeature

getAttribute

public java.lang.Object getAttribute(org.opengis.feature.type.Name name)
Specified by:
getAttribute in interface org.opengis.feature.simple.SimpleFeature

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface org.opengis.feature.simple.SimpleFeature

getAttributes

public java.util.List<java.lang.Object> getAttributes()
Specified by:
getAttributes in interface org.opengis.feature.simple.SimpleFeature

getDefaultGeometry

public java.lang.Object getDefaultGeometry()
Specified by:
getDefaultGeometry in interface org.opengis.feature.simple.SimpleFeature

getFeatureType

public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
Specified by:
getFeatureType in interface org.opengis.feature.simple.SimpleFeature

getType

public org.opengis.feature.simple.SimpleFeatureType getType()
Specified by:
getType in interface org.opengis.feature.Attribute
Specified by:
getType in interface org.opengis.feature.ComplexAttribute
Specified by:
getType in interface org.opengis.feature.Feature
Specified by:
getType in interface org.opengis.feature.Property
Specified by:
getType in interface org.opengis.feature.simple.SimpleFeature

setAttribute

public void setAttribute(int index,
                         java.lang.Object value)
                  throws java.lang.IndexOutOfBoundsException
Specified by:
setAttribute in interface org.opengis.feature.simple.SimpleFeature
Throws:
java.lang.IndexOutOfBoundsException

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface org.opengis.feature.simple.SimpleFeature

setAttribute

public void setAttribute(org.opengis.feature.type.Name name,
                         java.lang.Object value)
Specified by:
setAttribute in interface org.opengis.feature.simple.SimpleFeature

setAttributes

public void setAttributes(java.util.List<java.lang.Object> values)
Specified by:
setAttributes in interface org.opengis.feature.simple.SimpleFeature

setAttributes

public void setAttributes(java.lang.Object[] values)
Specified by:
setAttributes in interface org.opengis.feature.simple.SimpleFeature

setDefaultGeometry

public void setDefaultGeometry(java.lang.Object geometry)
Specified by:
setDefaultGeometry in interface org.opengis.feature.simple.SimpleFeature

getBounds

public org.opengis.geometry.BoundingBox getBounds()
Specified by:
getBounds in interface org.opengis.feature.Feature

getDefaultGeometryProperty

public org.opengis.feature.GeometryAttribute getDefaultGeometryProperty()
Specified by:
getDefaultGeometryProperty in interface org.opengis.feature.Feature

setDefaultGeometryProperty

public void setDefaultGeometryProperty(org.opengis.feature.GeometryAttribute geometryAttribute)
Specified by:
setDefaultGeometryProperty in interface org.opengis.feature.Feature

getProperties

public java.util.Collection<org.opengis.feature.Property> getProperties()
Specified by:
getProperties in interface org.opengis.feature.ComplexAttribute

getProperties

public java.util.Collection<org.opengis.feature.Property> getProperties(org.opengis.feature.type.Name name)
Specified by:
getProperties in interface org.opengis.feature.ComplexAttribute

getProperties

public java.util.Collection<org.opengis.feature.Property> getProperties(java.lang.String name)
Specified by:
getProperties in interface org.opengis.feature.ComplexAttribute

getProperty

public org.opengis.feature.Property getProperty(org.opengis.feature.type.Name name)
Specified by:
getProperty in interface org.opengis.feature.ComplexAttribute

getProperty

public org.opengis.feature.Property getProperty(java.lang.String name)
Specified by:
getProperty in interface org.opengis.feature.ComplexAttribute

getValue

public java.util.Collection<? extends org.opengis.feature.Property> getValue()
Specified by:
getValue in interface org.opengis.feature.ComplexAttribute
Specified by:
getValue in interface org.opengis.feature.Property

setValue

public void setValue(java.util.Collection<org.opengis.feature.Property> values)
Specified by:
setValue in interface org.opengis.feature.ComplexAttribute

setValue

public void setValue(java.lang.Object newValue)
Specified by:
setValue in interface org.opengis.feature.Property

getDescriptor

public org.opengis.feature.type.AttributeDescriptor getDescriptor()
Specified by:
getDescriptor in interface org.opengis.feature.Attribute
Specified by:
getDescriptor in interface org.opengis.feature.Property

getName

public org.opengis.feature.type.Name getName()
Specified by:
getName in interface org.opengis.feature.Property

isNillable

public boolean isNillable()
Specified by:
isNillable in interface org.opengis.feature.Property

getUserData

public java.util.Map<java.lang.Object,java.lang.Object> getUserData()
Specified by:
getUserData in interface org.opengis.feature.Property

hashCode

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

Overrides:
hashCode in class java.lang.Object
Returns:
A unique int

equals

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

Overrides:
equals in class java.lang.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 org.opengis.feature.Attribute
Specified by:
validate in interface org.opengis.feature.ComplexAttribute

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 1996-2010 Geotools. All Rights Reserved.