Class AssociationView

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AssociationView.Singleton

class AssociationView extends AbstractAssociation
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
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • feature

      final AbstractFeature feature
      The feature from which to read and where to write the attribute or association value.
    • name

      final String name
      The string representation of the property name. This is the value to be given in calls to Feature.getPropertyValue(String) and Feature.setPropertyValue(String, Object).
  • Constructor Details

  • 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 the feature (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 class AbstractAssociation
      Returns:
      the association name specified by its role.
    • getValue

      public AbstractFeature getValue()
      Description copied from class: AbstractAssociation
      Returns the associated feature, or null 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 to org.opengis.feature.Feature. This change is pending GeoAPI revision.
      Specified by:
      getValue in class AbstractAssociation
      Returns:
      the associated feature (may be null).
      See Also:
    • setValue

      public void setValue(AbstractFeature value)
      Description copied from class: AbstractAssociation
      Sets the associated feature.
      Warning: In a future SIS version, the argument type may be changed to org.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 the AbstractAssociation.quality() method.
      Specified by:
      setValue in class AbstractAssociation
      Parameters:
      value - the new value, or null.
      See Also:
    • getValues

      public Collection<AbstractFeature> 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 this Association instance, and conversely.

      The default implementation returns a collection which will delegate its work to AbstractAssociation.getValue() and Field.setValue(Object).

      Overrides:
      getValues in class AbstractAssociation
      Returns:
      the features in a live collection.
    • setValues

      public final void setValues(Collection<? extends AbstractFeature> values)
      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 class AbstractAssociation
      Parameters:
      values - the new values.
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public final String 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 class AbstractAssociation
      Returns:
      a string representation of this association for debugging purpose.