|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SimpleFeature
An instance of SimpleFeatureType
composed of fixed list values in a known order.
The definition of a "simple feature" can be summed up as the following:
| GEOMETRY | INT | STRING | | POINT(0 0) | 0 | "zero" |Accessing attributes via index would look like:
SimpleFeature feature = ...; Geometry g = (Geometry) feature.getAttribute( 0 ); Integer i = (Integer) feature.getAttribute( 1 ); String s = (String) feature.getAttribute( 2 );One could also access by name:
SimpleFeature feature = ...; Geometry g = (Geometry) feature.getAttribute( "GEOMETRY" ); Integer i = (Integer) feature.getAttribute( "INT" ); String s = (String) feature.getAttribute( "STRING" );
Note: Attribute access via getAttribute() methods returns attribute
values, and not the attributes themselves. For access to the actual attributes
ComplexAttribute.getProperty(String)
can be used.
SimpleFeatureType
Method Summary | |
---|---|
Object |
getAttribute(int index)
Gets an attribute value by index. |
Object |
getAttribute(Name name)
Gets an attribute value by name. |
Object |
getAttribute(String name)
Gets an attribute value by name. |
int |
getAttributeCount()
The number of attributes the feature is composed of. |
List<Object> |
getAttributes()
Returns a list of the values of the attributes contained by the feature. |
Object |
getDefaultGeometry()
Returns the value of the default geometry of the feature. |
SimpleFeatureType |
getFeatureType()
The type of the feature. |
String |
getID()
Unique Identifier for the SimpleFeature This value is non-null and should be the same as getIdentifier().toString(). |
SimpleFeatureType |
getType()
Override and type narrow to SimpleFeatureType. |
void |
setAttribute(int index,
Object value)
Sets an attribute value by index. |
void |
setAttribute(Name name,
Object value)
Sets an attribute value by name. |
void |
setAttribute(String name,
Object value)
Sets an attribute value by name. |
void |
setAttributes(List<Object> values)
Sets the values of the attributes contained by the feature. |
void |
setAttributes(Object[] values)
Sets the values of the attributes contained by the feature. |
void |
setDefaultGeometry(Object geometry)
Sets the value of the default geometry for the feature. |
Methods inherited from interface Feature |
---|
getBounds, getDefaultGeometryProperty, getIdentifier, setDefaultGeometryProperty |
Methods inherited from interface ComplexAttribute |
---|
getProperties, getProperties, getProperties, getProperty, getProperty, getValue, setValue, validate |
Methods inherited from interface Attribute |
---|
getDescriptor |
Methods inherited from interface Property |
---|
getName, getUserData, isNillable, setValue |
Method Detail |
---|
String getID()
This value is non-null and should be the same as getIdentifier().toString(). Please note that an ID may be provided
null
if
the attribute is non-identifiable.SimpleFeatureType getType()
getType
in interface Attribute
getType
in interface ComplexAttribute
getType
in interface Feature
getType
in interface Property
Attribute.getType()
SimpleFeatureType getFeatureType()
This method is a synonym for getType()
.
getType()
List<Object> getAttributes()
This method is a convenience for:
List values = new ArrayList(); for ( Property p : getProperties(); ) { values.add( p.getValue() ); } return values;
void setAttributes(List<Object> values)
The values must be in the order of the attributes defined by the feature type.
This method is a convenience for:
int i = 0; for ( Property p : getProperties() ) { p.setValue( values.get( i++ ) ); }
values
- The attribute values to set.void setAttributes(Object[] values)
The values must be in the order of the attributes defined by the feature type.
This method is a convenience for:
for ( Property p : getProperties() ) { p.setValue( values[i] ); }
values
- The attribute values to set.Object getAttribute(String name)
This method is a convenience for:
Property p = getProperty( name ); return p.getValue();
name
- The name of the attribute whose value to retrieve.
null
if no such attribute
exists with the specified name.void setAttribute(String name, Object value)
This method is a convenience for:
Property p = getProperty( name ); p.setValue(value);
name
- The name of the attribute whose value to set.value
- The new value of the attribute.Object getAttribute(Name name)
This method is a convenience for:
Property p = getProperty( name ); return p.getValue();
Since attribute names in simple features do not have a namespace uri
this method is equivalent to calling getAttribute(name.getLocalPart())
.
name
- The name of the attribute whose value to retrieve.
null
if no such attribute
exists with the specified name.void setAttribute(Name name, Object value)
This method is a convenience for:
Property p = getProperty( name ); p.setValue(value);
Since attribute names in simple features do not have a namespace uri
this method is equivalent to calling setAttribute(name.getLocalPart(), value)
.
name
- The name of the attribute whose value to set.value
- The new value of the attribute.Object getAttribute(int index) throws IndexOutOfBoundsException
This method is a convenience for:
Property p = ((List)getProperties()).get( i ) ; return p.getValue();
index
- The index of the attribute whose value to get.
IndexOutOfBoundsException
- If the specified index is out of bounds.void setAttribute(int index, Object value) throws IndexOutOfBoundsException
This method is a convenience for:
Property p = ((List)getProperties()).get( i ) ; p.setValue(value);
index
- The index of the attribute whose value to set.value
- The new value of the attribute.
IndexOutOfBoundsException
- If the specified index is out of bounds.int getAttributeCount()
This is a convenience for:
return getAttributes().size();
Object getDefaultGeometry()
This method is convenience for:
return getDefaultGeometry().getValue();
null
if no default geometry
attribute exists.void setDefaultGeometry(Object geometry)
This method is convenience for:
getDefaultGeometry().setValue(geometry);
geometry
- The new default geometry value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |