Package org.apache.sis.feature
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
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract V
getValue()
Returns the field feature or attribute value, ornull
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) Returnstrue
if an attribute type or association role having the given maximum number of occurrences should be treated as a singleton.abstract void
Sets the feature or attribute value.void
setValues
(Collection<? extends V> values) Sets the features or attribute values.
-
Constructor Details
-
Field
Field()For subclass constructors.
-
-
Method Details
-
isSingleton
static boolean isSingleton(int maximumOccurs) Returnstrue
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
Returns the field feature or attribute value, ornull
if none.- Specified by:
getValue
in classProperty
- Returns:
- the feature or attribute value (may be
null
). - Throws:
IllegalStateException
- if this field contains more than one value.- See Also:
-
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 thisField
instance, and conversely.- Returns:
- the features or attribute values in a live collection.
-
setValue
Sets the feature or attribute value. All previous values are replaced by the given singleton.- Parameters:
value
- the new value, ornull
for removing all values from this field.- See Also:
-
setValues
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
Returns whether the given property is deprecated.
-