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
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 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:
Property
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AttributeDescriptor
getDescriptor()
Override ofProperty.getDescriptor()
which type narrows toAttributeDescriptor
.Identifier
getIdentifier()
Unique Identifier for the attribute.AttributeType
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 Detail
-
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:
Property.getDescriptor()
-
getType
AttributeType getType()
Override ofProperty.getType()
which type narrows toAttributeType
.- Specified by:
getType
in interfaceProperty
- 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()
istrue
.- 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
-
-