org.opengis.feature
Interface Attribute

All Superinterfaces:
Property
All Known Subinterfaces:
ComplexAttribute, Feature, GeometryAttribute, SimpleFeature
All Known Implementing Classes:
AttributeImpl, ComplexAttributeImpl, DecoratingFeature, FeatureImpl, GeometryAttributeImpl, JDBCFeatureReader.ResultSetFeature, LenientAttribute, LenientFeature, PreGeneralizedSimpleFeature, ReadonlyAttributeDecorator, SimpleFeatureImpl

public interface Attribute
extends Property

An extension of Property for an attribute, or data.

The notion of an "attribute" is similar to that of an attribute in UML.

This interface is capable of modelling "primitive data", things like strings, numerics, dates, etc... However for "complex data" (that is non-primitive data types which are made up other primitive data types), a specific sub-interface is used, see ComplexAttribute.

An analogy for an attribute is a "field" in a java object. A field also brings together a field name, value and type.

Identifiable

When an attribute is identifiable the #getID() method returns a unique identifier for the attribute. The type of the attribute is used to determine identifiability.
 Attribute attribute = ...;
 if ( attribute.getType().isIdentified() ) {
   String id = attribute.getID();
 }
 

Validation

An attribute may hold any value at runtime; checking that the value meets the constraints supplied by the AttributeType is the work of the validate() method.

Author:
Jody Garnett (Refractions Research), Justin Deoliveira (The Open Planning Project)
See Also:
Property

Method Summary
 AttributeDescriptor getDescriptor()
          Override of Property.getDescriptor() which type narrows to AttributeDescriptor.
 Identifier getIdentifier()
          Unique Identifier for the attribute.
 AttributeType getType()
          Override of Property.getType() which type narrows to AttributeType.
 void validate()
          Check the attribute value against the constraints provided by the AttributeDescriptor.
 
Methods inherited from interface Property
getName, getUserData, getValue, isNillable, setValue
 

Method Detail

getDescriptor

AttributeDescriptor getDescriptor()
Override of Property.getDescriptor() which type narrows to AttributeDescriptor.

Specified by:
getDescriptor in interface Property
Returns:
The attribute descriptor, may be null if this is a top level type
See Also:
Property.getDescriptor()

getType

AttributeType getType()
Override of Property.getType() which type narrows to AttributeType.

Specified by:
getType in interface Property
Returns:
The attribute type.
See Also:
Property.getType()

getIdentifier

Identifier getIdentifier()
Unique Identifier for the attribute.

This value is non-null in the case that getType().isIdentifiable() is true.

Returns:
A unique identifier for the attribute, or null if the attribute is non-identifiable.

validate

void validate()
              throws IllegalAttributeException
Check the attribute value against the constraints provided by the AttributeDescriptor.

Please note this method checks the value only - it should have the correct java binding, it should only be null if isNillable is true; and if a value is provided it should satisfy all of the restrictions provided.

To check the the number of times an attribute is used (minOccurs and maxOccurs) please use ComplexAttribute.validate().

Throws:
IllegalAttributeException


Copyright © 1996-2014 Geotools. All Rights Reserved.