|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectDecoratingFeature
public class DecoratingFeature
Base class for feature decorators.
Subclasses should override those methods which are relevant to the decorator.
Field Summary | |
---|---|
protected SimpleFeature |
delegate
|
Constructor Summary | |
---|---|
DecoratingFeature(SimpleFeature delegate)
|
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
Object |
getAttribute(int index)
Gets an attribute value by index. |
Object |
getAttribute(Name arg0)
Gets an attribute value by name. |
Object |
getAttribute(String path)
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. |
BoundingBox |
getBounds()
The bounds of this Feature, if available. |
Object |
getDefaultGeometry()
Returns the value of the default geometry of the feature. |
GeometryAttribute |
getDefaultGeometryProperty()
The default geometric attribute of the feature. |
AttributeDescriptor |
getDescriptor()
Override of Property.getDescriptor() which type narrows to
AttributeDescriptor . |
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(). |
FeatureId |
getIdentifier()
A unique identifier for the feature. |
Name |
getName()
The name of the property with respect to its descriptor. |
Collection<Property> |
getProperties()
Complete collection of properties. |
Collection<Property> |
getProperties(Name arg0)
Returns a subset of the properties of the complex attribute which match the specified name. |
Collection<Property> |
getProperties(String arg0)
Returns a subset of the properties of the complex attribute which match the specified name. |
Property |
getProperty(Name arg0)
Returns single property of the complex attribute which matches the specified name. |
Property |
getProperty(String arg0)
Returns single property of the complex attribute which matches the specified name. |
SimpleFeatureType |
getType()
Override and type narrow to SimpleFeatureType. |
Map<Object,Object> |
getUserData()
A map of "user data" which enables applications to store "application-specific" information against a property. |
Collection<? extends Property> |
getValue()
Override of Property.getValue() which returns the collection of
Property which make up the value of the complex attribute. |
int |
hashCode()
|
boolean |
isNillable()
Flag indicating if null is an acceptable value for the
property. |
void |
setAttribute(int position,
Object val)
Sets an attribute value by index. |
void |
setAttribute(Name arg0,
Object arg1)
Sets an attribute value by name. |
void |
setAttribute(String path,
Object attribute)
Sets an attribute value by name. |
void |
setAttributes(List<Object> arg0)
Sets the values of the attributes contained by the feature. |
void |
setAttributes(Object[] arg0)
Sets the values of the attributes contained by the feature. |
void |
setDefaultGeometry(Geometry geometry)
|
void |
setDefaultGeometry(Object arg0)
Sets the value of the default geometry for the feature. |
void |
setDefaultGeometryProperty(GeometryAttribute arg0)
Sets the default geometric attribute of the feature. |
void |
setValue(Collection<Property> arg0)
Sets the contained properties of the complex attribute. |
void |
setValue(Object arg0)
Sets the value or content of the property. |
String |
toString()
|
void |
validate()
Check the properties against the constraints provided by their AttributeDescriptors. |
Methods inherited from class Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected SimpleFeature delegate
Constructor Detail |
---|
public DecoratingFeature(SimpleFeature delegate)
Method Detail |
---|
public Object getAttribute(int index)
SimpleFeature
This method is a convenience for:
Property p = ((List)getProperties()).get( i ) ; return p.getValue();
getAttribute
in interface SimpleFeature
index
- The index of the attribute whose value to get.
public Object getAttribute(Name arg0)
SimpleFeature
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())
.
getAttribute
in interface SimpleFeature
arg0
- The name of the attribute whose value to retrieve.
null
if no such attribute
exists with the specified name.public Object getAttribute(String path)
SimpleFeature
This method is a convenience for:
Property p = getProperty( name ); return p.getValue();
getAttribute
in interface SimpleFeature
path
- The name of the attribute whose value to retrieve.
null
if no such attribute
exists with the specified name.public int getAttributeCount()
SimpleFeature
This is a convenience for:
return getAttributes().size();
getAttributeCount
in interface SimpleFeature
public List<Object> getAttributes()
SimpleFeature
This method is a convenience for:
List values = new ArrayList(); for ( Property p : getProperties(); ) { values.add( p.getValue() ); } return values;
getAttributes
in interface SimpleFeature
public BoundingBox getBounds()
Feature
This value is derived from any geometric attributes that the feature is composed of.
In the case that the feature has no geometric attributes this method
should return an empty bounds, ie, bounds.isEmpty() == true
.
This method should never return null
.
The coordinate reference system of the returned bounds is derived from
the geometric attributes which were used to compute the bounds. In the
event that the feature contains multiple geometric attributes which have
different crs's, the one defined by #getGeometryDescriptor()
should
take precedence and the others should be reprojected accordingly.
getBounds
in interface Feature
public Object getDefaultGeometry()
SimpleFeature
This method is convenience for:
return getDefaultGeometry().getValue();
getDefaultGeometry
in interface SimpleFeature
null
if no default geometry
attribute exists.public GeometryAttribute getDefaultGeometryProperty()
Feature
This method returns null
in the case where no such
attribute exists.
getDefaultGeometryProperty
in interface Feature
null
.public AttributeDescriptor getDescriptor()
Attribute
Property.getDescriptor()
which type narrows to
AttributeDescriptor
.
getDescriptor
in interface Attribute
getDescriptor
in interface Property
Property.getDescriptor()
public SimpleFeatureType getFeatureType()
SimpleFeature
This method is a synonym for SimpleFeature.getType()
.
getFeatureType
in interface SimpleFeature
SimpleFeature.getType()
public FeatureId getIdentifier()
Feature
getType().isIdentifiable()
must return true
so this value must not return null
.
Generation of the identifier is dependent on the underlying data storage medium. Often this identifier is not persistent. Mediums such shapefiles and database tables have "keys" built in which map naturally to persistent feature identifiers. But other mediums do not have such keys and may have to generate feature identifiers "on-the-fly". This means that client code being able to depend on this value as a persistent entity is dependent on which storage medium or data source is being used.
getIdentifier
in interface Attribute
getIdentifier
in interface Feature
null
.public String getID()
SimpleFeature
This value is non-null and should be the same as getIdentifier().toString(). Please note that an ID may be provided
getID
in interface SimpleFeature
null
if
the attribute is non-identifiable.public Name getName()
Property
This method is convenience for getDescriptor().getName()
.
getName
in interface Property
public Collection<Property> getProperties()
ComplexAttribute
This method is a convenience method for calling (Collection
getProperties
in interface ComplexAttribute
public Collection<Property> getProperties(Name arg0)
ComplexAttribute
The name parameter is matched against each contained
Property.getName()
, those that are equal are returned.
getProperties
in interface ComplexAttribute
arg0
- The name of the properties to return.
public Collection<Property> getProperties(String arg0)
ComplexAttribute
This method is a convenience for ComplexAttribute.getProperties(Name)
in which
Name.getNamespaceURI()
is null
.
Note: Special care should be taken when using this method in the case
that two properties with the same local name but different namespace uri
exist. For this reason using ComplexAttribute.getProperties(Name)
is safer.
getProperties
in interface ComplexAttribute
arg0
- The local name of the properties to return.
ComplexAttribute.getProperties(Name)
public Property getProperty(Name arg0)
ComplexAttribute
Note: This method is a convenience and care should be taken when calling
it if more then a single property matches name. In such a
case the first encountered property in which Property.getName()
is equal to name is returned, and no order is guaranteed.
This method is a safe convenience for:
getProperties(name).iterator().next()
.
In the event that no property matches the specified name
null
is returned.
getProperty
in interface ComplexAttribute
arg0
- The name of the property to return.
null
.public Property getProperty(String arg0)
ComplexAttribute
This method is a convenience for ComplexAttribute.getProperty(Name)
in which
Name.getNamespaceURI()
is null
.
Note: This method is a convenience and care should be taken when calling
it if more then a single property matches name. In such a
case the first encountered property in which Property.getName()
is matches name is returned, and no order is guaranteed.
Note: Special care should be taken when using this method in the case
that two properties with the same local name but different namespace uri
exist. For this reason using ComplexAttribute.getProperties(Name)
is safer.
getProperty
in interface ComplexAttribute
arg0
- The local name of the property to return.
null
.public SimpleFeatureType getType()
SimpleFeature
getType
in interface Attribute
getType
in interface ComplexAttribute
getType
in interface Feature
getType
in interface Property
getType
in interface SimpleFeature
Attribute.getType()
public Map<Object,Object> getUserData()
Property
An example of information that may wish to be stored along with an attribute could be its srs information (in the case of a geometric attribute ).
GeometryAttribute attribute = ...;
//set the crs
CoordinateReferenceSystem crs = CRS.decode("EPSG:4326");
attribute.setCRS( crs );
//set the srs
attribute.getUserData().put( "srs", "EPSG:4326" );
getUserData
in interface Property
public Collection<? extends Property> getValue()
ComplexAttribute
Property.getValue()
which returns the collection of
Property
which make up the value of the complex attribute.
getValue
in interface ComplexAttribute
getValue
in interface Property
public boolean isNillable()
Property
null
is an acceptable value for the
property.
This method is convenience for getDescriptor().isNillable()
.
isNillable
in interface Property
true
if the value of the property is allowed to be
null
, otherwise false
.public void setAttribute(int position, Object val)
SimpleFeature
This method is a convenience for:
Property p = ((List)getProperties()).get( i ) ; p.setValue(value);
setAttribute
in interface SimpleFeature
position
- The index of the attribute whose value to set.val
- The new value of the attribute.public void setAttribute(Name arg0, Object arg1)
SimpleFeature
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)
.
setAttribute
in interface SimpleFeature
arg0
- The name of the attribute whose value to set.arg1
- The new value of the attribute.public void setAttribute(String path, Object attribute)
SimpleFeature
This method is a convenience for:
Property p = getProperty( name ); p.setValue(value);
setAttribute
in interface SimpleFeature
path
- The name of the attribute whose value to set.attribute
- The new value of the attribute.public void setAttributes(List<Object> arg0)
SimpleFeature
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++ ) ); }
setAttributes
in interface SimpleFeature
arg0
- The attribute values to set.public void setAttributes(Object[] arg0)
SimpleFeature
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] ); }
setAttributes
in interface SimpleFeature
arg0
- The attribute values to set.public void setDefaultGeometry(Object arg0)
SimpleFeature
This method is convenience for:
getDefaultGeometry().setValue(geometry);
setDefaultGeometry
in interface SimpleFeature
arg0
- The new default geometry value.public void setDefaultGeometryProperty(GeometryAttribute arg0)
Feature
This value must be an attribute which is already defined for the feature. In other words, this method can not be used to add a new attribute to the feature.
setDefaultGeometryProperty
in interface Feature
arg0
- The new geomtric attribute.public void setDefaultGeometry(Geometry geometry) throws IllegalAttributeException
IllegalAttributeException
public void setValue(Collection<Property> arg0)
ComplexAttribute
The values should match the structure defined by
getDescriptor()
.
setValue
in interface ComplexAttribute
public void setValue(Object arg0)
Property
The class of newValue should be the same as or a subclass of
getType().getBinding()
.
newValue may be null
if
getDescriptor().isNillable()
is true
.
setValue
in interface Property
arg0
- The new value of the property.public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public void validate()
ComplexAttribute
Please note this method checks minOccurs and maxOccurs information; and calls each Attribute.validate on each entry in turn (in order to check isNillable, binding and restrictions).
validate
in interface Attribute
validate
in interface ComplexAttribute
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |