Package org.geotools.api.feature
Interface Association
-
- All Superinterfaces:
Property
- All Known Implementing Classes:
AssociationImpl
public interface Association extends Property
Extension of Property to represent an Association, or relationship, between two attributes.The notion of an "association" is similar to that of an association in UML and is used to model a relationship between entities. Examples of such a relationship could be:
- aggregation: An attribute may contain another attribute
- spatial: A feature is spatial related to another (touches, intersects, etc..)
- temporal: An is a previous version of another attribute in a versioning system
Example
The value of an association is an
Attribute
. As an example consider the following xml complex type definitions:<complexType name="fooType"> ... </complexType> <element name="foo" type="fooType"/> <complexType name="barType"> <sequence> <element name="intAttribute" type="xs:int"/> <element name="stringAttribute" type="xs:string"/> <element name="fooAssociation" type="xlink:href"/> </sequence> </complexType> <element name="bar" type="barType"/>
In the above, "fooType" is an identifiable type. Now consider the following section of an xml instance document:<foo id="someId"> ... </foo> ... <bar> <intAttribute>1</intAttribute> <stringAttribute>one</stringAttribute> <fooAssociation>someId</fooAssociation> </bar>
Realizing this as objects with attributes and associations we get:ComplexAttribute bar = ...; //intAttribute Attribute intAttribute = (Attribute) bar.getProperty( "intAttribute" ); intAttribute.getValue() == 1 //stringAttribute Attribute stringAttribute = (Attribute) bar.getProperty( "stringAttribute" ); stringAttribute.getValue() == "one" //fooAssociation Association fooAssociation = (Association) bar.getProperty( "fooAssociation" ); Attribute foo = fooAssociation.getValue();
- Author:
- Jody Garnett, Refractions Research, Justin Deoliveira, The Open Planning Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AssociationDescriptor
getDescriptor()
Description of the relationship between two attributes.AttributeType
getRelatedType()
Returns the type of the associated attribute.AssociationType
getType()
Type of association represented.Attribute
getValue()
Override ofProperty.getValue()
which type narrows toAttribute
.void
setValue(Object newValue)
Override ofProperty.setValue(Object)
which specifies that newValue should be an instance ofAttribute
.-
Methods inherited from interface Property
getName, getUserData, hasUserData, isNillable
-
-
-
-
Method Detail
-
getDescriptor
AssociationDescriptor getDescriptor()
Description of the relationship between two attributes.Override of
Property.getDescriptor()
which type narrows toAssociationDescriptor
.- Specified by:
getDescriptor
in interfaceProperty
- Returns:
- AssociationDescriptor used to describe the relationship between two attributes; because two attributes are required the descriptor should not be null.
- See Also:
Property.getDescriptor()
-
getType
AssociationType getType()
Type of association represented.Override of
Property.getType()
which type narrows toAssociationType
.- Specified by:
getType
in interfaceProperty
- Returns:
- The property type.
- See Also:
Property.getType()
-
getValue
Attribute getValue()
Override ofProperty.getValue()
which type narrows toAttribute
.- Specified by:
getValue
in interfaceProperty
- Returns:
- The value of the property.
- See Also:
Property.getValue()
-
setValue
void setValue(Object newValue) throws IllegalArgumentException
Override ofProperty.setValue(Object)
which specifies that newValue should be an instance ofAttribute
.- Specified by:
setValue
in interfaceProperty
- Parameters:
newValue
- The new value of the property.- Throws:
IllegalArgumentException
- If newValue is not an attribute.
-
getRelatedType
AttributeType getRelatedType()
Returns the type of the associated attribute.This method is a convenience for:
getType().getRelatedType()
- Returns:
- type of the attribute of the association.
-
-