Package org.apache.sis.feature
Class AssociationView
java.lang.Object
org.apache.sis.feature.Property
org.apache.sis.feature.Field<AbstractFeature>
org.apache.sis.feature.AbstractAssociation
org.apache.sis.feature.AssociationView
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
AssociationView.Singleton
An association implementation which delegate its work to the parent feature.
This class is used for default implementation of
AbstractFeature.getProperty(String)
.
This implementation is inefficient!
This class is for making easier to begin with a custom AbstractFeature
implementation,
but developers are encouraged to provide their own AbstractFeature.getProperty(String)
implementation.
- Since:
- 0.8
- Version:
- 0.8
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Specialization ofAssociationView
when the amount of values can be only zero or one. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AbstractFeature
The feature from which to read and where to write the attribute or association value.(package private) final String
The string representation of the property name.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.feature.AbstractAssociation
role
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AssociationView
(AbstractFeature feature, DefaultAssociationRole role) Creates a new association which will delegate its work to the given feature. -
Method Summary
Modifier and TypeMethodDescription(package private) static AbstractAssociation
create
(AbstractFeature feature, DefaultAssociationRole role) Creates a new association which will delegate its work to the given feature.final boolean
final org.opengis.util.GenericName
getName()
Returns the name of the role specified at construction time.getValue()
Returns the associated feature, ornull
if none.Returns all features, or an empty collection if none.final int
hashCode()
void
setValue
(AbstractFeature value) Sets the associated feature.final void
setValues
(Collection<? extends AbstractFeature> values) Sets the features.final String
toString()
Returns a string representation of this association.Methods inherited from class org.apache.sis.feature.AbstractAssociation
clone, create, create, ensureValid, getRole, quality
Methods inherited from class org.apache.sis.feature.Field
isDeprecated, isSingleton
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
feature
The feature from which to read and where to write the attribute or association value. -
name
The string representation of the property name. This is the value to be given in calls toFeature.getPropertyValue(String)
andFeature.setPropertyValue(String, Object)
.
-
-
Constructor Details
-
AssociationView
Creates a new association which will delegate its work to the given feature.
-
-
Method Details
-
create
Creates a new association which will delegate its work to the given feature.- Parameters:
feature
- the feature from which to read and where to write the association value.role
- the role of this association. Must be one of the properties listed in thefeature
(this is not verified by this constructor).
-
getName
public final org.opengis.util.GenericName getName()Returns the name of the role specified at construction time.- Overrides:
getName
in classAbstractAssociation
- Returns:
- the association name specified by its role.
-
getValue
Description copied from class:AbstractAssociation
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.- Specified by:
getValue
in classAbstractAssociation
- Returns:
- the associated feature (may be
null
). - See Also:
-
setValue
Description copied from class:AbstractAssociation
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 theAbstractAssociation.quality()
method.- Specified by:
setValue
in classAbstractAssociation
- Parameters:
value
- the new value, ornull
.- See Also:
-
getValues
Description copied from class:AbstractAssociation
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
AbstractAssociation.getValue()
andField.setValue(Object)
.- Overrides:
getValues
in classAbstractAssociation
- Returns:
- the features in a live collection.
-
setValues
Description copied from class:AbstractAssociation
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
AbstractAssociation.setValue(AbstractFeature)
.- Overrides:
setValues
in classAbstractAssociation
- Parameters:
values
- the new values.
-
hashCode
public final int hashCode() -
equals
-
toString
Description copied from class:AbstractAssociation
Returns a string representation of this association. The returned string is for debugging purpose and may change in any future SIS version.- Overrides:
toString
in classAbstractAssociation
- Returns:
- a string representation of this association for debugging purpose.
-