public interface Association extends Property
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:
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();
Modifier and Type | Method and 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 of
Property.getValue() which type narrows to Attribute . |
void |
setValue(Object newValue)
Override of
Property.setValue(Object) which specifies that newValue should
be an instance of Attribute . |
getName, getUserData, isNillable
AssociationDescriptor getDescriptor()
Override of Property.getDescriptor()
which type narrows to AssociationDescriptor
.
getDescriptor
in interface Property
Property.getDescriptor()
AssociationType getType()
Override of Property.getType()
which type narrows to AssociationType
.
getType
in interface Property
Property.getType()
Attribute getValue()
Property.getValue()
which type narrows to Attribute
.getValue
in interface Property
Property.getValue()
void setValue(Object newValue) throws IllegalArgumentException
Property.setValue(Object)
which specifies that newValue should
be an instance of Attribute
.setValue
in interface Property
newValue
- The new value of the property.IllegalArgumentException
- If newValue is not an attribute.AttributeType getRelatedType()
This method is a convenience for:
getType().getRelatedType()
Copyright © 1996–2019 Geotools. All rights reserved.