Class Field<V>

java.lang.Object
org.apache.sis.feature.Property
org.apache.sis.feature.Field<V>
Type Parameters:
V - the type of property values.
Direct Known Subclasses:
AbstractAssociation, AbstractAttribute

abstract class Field<V> extends Property
Base class of property that can be stored in a AbstractFeature instance. This include Attribute and Association, but not Operation.
Since:
0.5
Version:
0.8
  • Constructor Summary

    Constructors
    Constructor
    Description
    For subclass constructors.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract V
    Returns the field feature or attribute value, or null if none.
    Returns all features or attribute values, or an empty collection if none.
    (package private) static boolean
    Returns whether the given property is deprecated.
    (package private) static boolean
    isSingleton(int maximumOccurs)
    Returns true if an attribute type or association role having the given maximum number of occurrences should be treated as a singleton.
    abstract void
    setValue(V value)
    Sets the feature or attribute value.
    void
    setValues(Collection<? extends V> values)
    Sets the features or attribute values.

    Methods inherited from class org.apache.sis.feature.Property

    getName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Field

      Field()
      For subclass constructors.
  • Method Details

    • isSingleton

      static boolean isSingleton(int maximumOccurs)
      Returns true if an attribute type or association role having the given maximum number of occurrences should be treated as a singleton. This method gives us a simple keyword to search for every places in the code where a decision regarding "singleton versus multi-valued" is made.
    • getValue

      public abstract V getValue() throws IllegalStateException
      Returns the field feature or attribute value, or null if none.
      Specified by:
      getValue in class Property
      Returns:
      the feature or attribute value (may be null).
      Throws:
      IllegalStateException - if this field contains more than one value.
      See Also:
    • getValues

      public Collection<V> getValues()
      Returns all features or attribute values, or an empty collection if none. The returned collection is live: changes in the returned collection will be reflected immediately in this Field instance, and conversely.
      Returns:
      the features or attribute values in a live collection.
    • setValue

      public abstract void setValue(V value)
      Sets the feature or attribute value. All previous values are replaced by the given singleton.
      Parameters:
      value - the new value, or null for removing all values from this field.
      See Also:
    • setValues

      public void setValues(Collection<? extends V> values) throws IllegalArgumentException
      Sets the features or attribute values. 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(Object).

      Parameters:
      values - the new values.
      Throws:
      IllegalArgumentException - if the given collection contains too many elements.
    • isDeprecated

      static boolean isDeprecated(AbstractIdentifiedType type)
      Returns whether the given property is deprecated.