public interface Attribute extends Property
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.
#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(); }
Property
Modifier and Type | Method and Description |
---|---|
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.
|
getName, getUserData, getValue, isNillable, setValue
AttributeDescriptor getDescriptor()
Property.getDescriptor()
which type narrows to AttributeDescriptor
.getDescriptor
in interface Property
Property.getDescriptor()
AttributeType getType()
Property.getType()
which type narrows to AttributeType
.getType
in interface Property
Property.getType()
Identifier getIdentifier()
This value is non-null in the case that getType().isIdentifiable()
is
true
.
null
if the attribute is
non-identifiable.void validate() throws IllegalAttributeException
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().
IllegalAttributeException
Copyright © 1996–2019 Geotools. All rights reserved.