Object
AbstractAssociation
- All Implemented Interfaces:
Serializable
,Cloneable
An instance of an feature association role containing the associated feature.
AbstractAssociation
can be instantiated by calls to DefaultAssociationRole.newInstance()
.
Limitations
- Multi-threading:
AbstractAssociation
instances are not thread-safe. Synchronization, if needed, shall be done externally by the caller. - Serialization: serialized objects of this class are not guaranteed to be compatible with future versions. Serialization should be used only for short term storage or RMI between applications running the same SIS version.
- Since:
- 0.5
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a new association of the given role. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a copy of this association.static AbstractAssociation
Creates a new association of the given role.getName()
Returns the name of this association as defined by its role.getRole()
Returns information about the association.abstract AbstractFeature
Returns the associated feature, ornull
if none.Returns all features, or an empty collection if none.quality()
Verifies if the current association value mets the constraints defined by the association role.abstract void
setValue
(AbstractFeature value) Sets the associated feature.void
setValues
(Collection<? extends AbstractFeature> values) Sets the features.Returns a string representation of this association.
-
Constructor Details
-
AbstractAssociation
Creates a new association of the given role.- Parameters:
role
- information about the association.- See Also:
-
-
Method Details
-
create
Creates a new association of the given role.- Parameters:
role
- information about the association.- Returns:
- the new association.
- See Also:
-
getName
Returns the name of this association as defined by its role. This convenience method delegates toAbstractIdentifiedType.getName()
.- Returns:
- the association name specified by its role.
-
getRole
Returns information about the association.Warning: In a future SIS version, the return type may be changed toorg.opengis.feature.AssociationRole
. This change is pending GeoAPI revision.- Returns:
- information about the association.
-
getValue
Returns the associated feature, ornull
if none. This convenience method can be invoked in the common case where the maximum number of features is restricted to 1 or 0.Warning: In a future SIS version, the return type may be changed toorg.opengis.feature.Feature
. This change is pending GeoAPI revision.- Returns:
- the associated feature (may be
null
). - Throws:
IllegalStateException
- if this association contains more than one value.- See Also:
-
getValues
Returns all features, or an empty collection if none. The returned collection is live: changes in the returned collection will be reflected immediately in thisAssociation
instance, and conversely.The default implementation returns a collection which will delegate its work to
getValue()
andsetValue(Object)
.- Returns:
- the features in a live collection.
-
setValue
Sets the associated feature.Warning: In a future SIS version, the argument type may be changed toorg.opengis.feature.Feature
. This change is pending GeoAPI revision.Validation
The amount of validation performed by this method is implementation dependent. Usually, only the most basic constraints are verified. This is so for performance reasons and also because some rules may be temporarily broken while constructing a feature. A more exhaustive verification can be performed by invoking thequality()
method.- Parameters:
value
- the new value, ornull
.- Throws:
IllegalArgumentException
- if the given feature is not valid for this association.- See Also:
-
setValues
Sets the features. All previous values are replaced by the given collection.The default implementation ensures that the given collection contains at most one element, then delegates to
setValue(AbstractFeature)
.- Parameters:
values
- the new values.- Throws:
IllegalArgumentException
- if the given collection contains too many elements.
-
quality
Verifies if the current association value mets the constraints defined by the association role. This method returns at most one report with a result for each constraint violations found, if any. SeeAbstractAttribute.quality()
for an example.This association is valid if this method does not report any conformance result having a pass value of
false
.- Returns:
- reports on all constraint violations found.
- See Also:
-
toString
Returns a string representation of this association. The returned string is for debugging purpose and may change in any future SIS version. -
clone
Returns a copy of this association. The default implementation returns a shallow copy: the association value is not cloned. However, subclasses may choose to do otherwise.- Overrides:
clone
in classObject
- Returns:
- a clone of this association.
- Throws:
CloneNotSupportedException
- if this association cannot be cloned. The default implementation never throw this exception. However, subclasses may throw it.
-