Interface Attribute
- All Superinterfaces:
Property
- All Known Subinterfaces:
ComplexAttribute
,Feature
,GeometryAttribute
,SimpleFeature
- All Known Implementing Classes:
AttributeImpl
,ComplexAttributeImpl
,DecoratingFeature
,FeatureImpl
,GeometryAttributeImpl
,JDBCFeatureReader.ResultSetFeature
,MongoDBObjectFeature
,MongoFeature
,PreGeneralizedSimpleFeature
,ReadonlyAttributeDecorator
,SimpleFeatureImpl
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 thegetIdentifier()
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:
-
Method Summary
Modifier and TypeMethodDescriptionOverride ofProperty.getDescriptor()
which type narrows toAttributeDescriptor
.Unique Identifier for the attribute.getType()
Override ofProperty.getType()
which type narrows toAttributeType
.void
validate()
Check the attribute value against the constraints provided by the AttributeDescriptor.Methods inherited from interface Property
getName, getUserData, getValue, hasUserData, isNillable, setValue
-
Method Details
-
getDescriptor
AttributeDescriptor getDescriptor()Override ofProperty.getDescriptor()
which type narrows toAttributeDescriptor
.- Specified by:
getDescriptor
in interfaceProperty
- Returns:
- The attribute descriptor, may be null if this is a top level type
- See Also:
-
getType
AttributeType getType()Override ofProperty.getType()
which type narrows toAttributeType
. -
getIdentifier
Identifier getIdentifier()Unique Identifier for the attribute.This value is non-null in the case that
getType().isIdentifiable()
istrue
.- Returns:
- A unique identifier for the attribute, or
null
if the attribute is non-identifiable.
-
validate
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
-