|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.feature.DefaultFeature
Provides a more efficient feature representation for the flat and complex features. This implementation actually not only enforces feature type synchronization, it also enforces the use of its accessor methods to change the state of internal object representations. In this case, the implementation is trivial, since all allowed attribute objects (from the feature type) are immutable.
Nested Class Summary |
Nested classes inherited from class org.geotools.feature.Feature |
Feature.NULL |
Field Summary | |
protected java.lang.String |
featureId
The unique id of this feature |
Constructor Summary | |
protected |
DefaultFeature(DefaultFeatureType schema,
java.lang.Object[] attributes)
Creates a new instance of flat feature, which must take a flat feature type schema and all attributes as arguments. |
protected |
DefaultFeature(DefaultFeatureType schema,
java.lang.Object[] attributes,
java.lang.String featureID)
Creates a new instance of flat feature, which must take a flat feature type schema and all attributes as arguments. |
Method Summary | |
java.lang.Object |
clone()
Creates an exact copy of this feature. |
boolean |
equals(java.lang.Object obj)
override of equals. |
java.lang.Object |
getAttribute(int index)
Gets an attribute by the given zero-based index. |
java.lang.Object |
getAttribute(java.lang.String xPath)
Gets an attribute for this feature at the location specified by xPath. |
java.lang.Object[] |
getAttributes(java.lang.Object[] array)
Copy all the attributes of this Feature into the given array. |
com.vividsolutions.jts.geom.Envelope |
getBounds()
Get the total bounds of this feature which is calculated by doing a union of the bounds of each geometry this feature is associated with. |
com.vividsolutions.jts.geom.Geometry |
getDefaultGeometry()
Gets the geometry for this feature. |
FeatureType |
getFeatureType()
Gets a reference to the feature type schema for this feature. |
java.lang.String |
getID()
Gets the unique indentification string of this Feature. |
int |
getNumberOfAttributes()
Get the number of attributes this feature has. |
FeatureCollection |
getParent()
Gets the feature collection this feature is stored in. |
int |
hashCode()
returns a unique code for this feature |
void |
setAttribute(int position,
java.lang.Object val)
Sets the attribute at position to val. |
void |
setAttribute(java.lang.String xPath,
java.lang.Object attribute)
Sets a single attribute for this feature, passed as a complex object. |
void |
setAttributes(java.lang.Object[] attributes)
Sets all attributes for this feature, passed as an array. |
protected void |
setAttributeValue(int position,
java.lang.Object val)
Sets the attribute value at a given position, performing no parsing or validation. |
void |
setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry)
Modifies the geometry. |
void |
setParent(FeatureCollection collection)
Sets the parent collection this feature is stored in, if it is not already set. |
Feature |
toComplex()
|
java.lang.String |
toString()
Returns a string representation of this feature. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String featureId
Constructor Detail |
protected DefaultFeature(DefaultFeatureType schema, java.lang.Object[] attributes, java.lang.String featureID) throws IllegalAttributeException, java.lang.NullPointerException
schema
- Feature type schema for this flat feature.attributes
- Initial attributes for this feature.featureID
- The unique ID for this feature.
IllegalAttributeException
- Attribtues do not conform to feature
type schema.
java.lang.NullPointerException
- if schema is null.protected DefaultFeature(DefaultFeatureType schema, java.lang.Object[] attributes) throws IllegalAttributeException
schema
- Feature type schema for this flat feature.attributes
- Initial attributes for this feature.
IllegalAttributeException
- Attribtues do not conform to feature
type schema.Method Detail |
public FeatureType getFeatureType()
getFeatureType
in interface SimpleFeature
public java.lang.String getID()
getID
in interface Feature
public java.lang.Object[] getAttributes(java.lang.Object[] array)
getAttributes
in interface Feature
array
- The array to copy the attributes into.
public java.lang.Object getAttribute(java.lang.String xPath)
getAttribute
in interface SimpleFeature
xPath
- XPath representation of attribute location.
Feature.getAttribute(String)
public java.lang.Object getAttribute(int index)
getAttribute
in interface SimpleFeature
index
- the position of the attribute to retrieve.
public void setAttribute(int position, java.lang.Object val) throws IllegalAttributeException
setAttribute
in interface SimpleFeature
position
- the index of the attribute to set.val
- the new value to give the attribute at position.
IllegalAttributeException
- if the passed in val does not validate
against the AttributeType at that position.protected void setAttributeValue(int position, java.lang.Object val)
position
- the index of the attribute to set.val
- the new value to give the attribute at position.public void setAttributes(java.lang.Object[] attributes) throws IllegalAttributeException
setAttributes
in interface SimpleFeature
attributes
- All feature attributes.
IllegalAttributeException
- Passed attributes do not match feature
type.public void setAttribute(java.lang.String xPath, java.lang.Object attribute) throws IllegalAttributeException
setAttribute
in interface Feature
xPath
- XPath representation of attribute location.attribute
- Feature attribute to set.
IllegalAttributeException
- Passed attribute does not match
feature typepublic com.vividsolutions.jts.geom.Geometry getDefaultGeometry()
getDefaultGeometry
in interface Feature
public void setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry) throws IllegalAttributeException
setDefaultGeometry
in interface Feature
geometry
- All feature attributes.
IllegalAttributeException
- if the feature does not have a
geometry.public int getNumberOfAttributes()
getNumberOfAttributes
in interface Feature
public com.vividsolutions.jts.geom.Envelope getBounds()
getBounds
in interface Feature
public java.lang.Object clone()
clone
in interface org.opengis.util.Cloneable
java.lang.RuntimeException
- DOCUMENT ME!public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object obj)
obj
- the Object to test for equality.
true
if the object is equal, false
otherwise.public FeatureCollection getParent()
getParent
in interface Feature
public void setParent(FeatureCollection collection)
setParent
in interface Feature
collection
- the collection to be set as parent.public Feature toComplex()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |