Package org.apache.sis.feature
Class SingletonAssociation
java.lang.Object
org.apache.sis.feature.Property
org.apache.sis.feature.Field<AbstractFeature>
org.apache.sis.feature.AbstractAssociation
org.apache.sis.feature.SingletonAssociation
- All Implemented Interfaces:
Serializable
,Cloneable
An instance of an association role containing at most one value.
The majority of features types contain associations restricted to such [0 … 1] cardinality.
While
MultiValuedAssociation
would be suitable to all cases, this SingletonAssociation
consumes less memory.
Limitations
- Multi-threading:
SingletonAssociation
instances are not thread-safe. Synchronization, if needed, shall be done externally by the caller.
- Since:
- 0.5
- Version:
- 0.6
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
For cross-version compatibility.private AbstractFeature
The associated feature.Fields inherited from class org.apache.sis.feature.AbstractAssociation
role
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new association of the given role.SingletonAssociation
(DefaultAssociationRole role, AbstractFeature value) Creates a new association of the given role initialized to the given value. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares this association with the given object for equality.getValue()
Returns the associated feature.int
hashCode()
Returns a hash code value for this association.void
setValue
(AbstractFeature value) Sets the associated feature.Methods inherited from class org.apache.sis.feature.AbstractAssociation
clone, create, create, ensureValid, getName, getRole, getValues, quality, setValues, toString
Methods inherited from class org.apache.sis.feature.Field
isDeprecated, isSingleton
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
value
The associated feature.
-
-
Constructor Details
-
SingletonAssociation
Creates a new association of the given role.- Parameters:
role
- information about the association.
-
SingletonAssociation
SingletonAssociation(DefaultAssociationRole role, AbstractFeature value) Creates a new association of the given role initialized to the given value.- Parameters:
role
- information about the association.value
- the initial value (may benull
).
-
-
Method Details
-
getValue
Returns the associated feature.- Specified by:
getValue
in classAbstractAssociation
- Returns:
- the associated feature (may be
null
). - See Also:
-
setValue
Sets the associated feature.- Specified by:
setValue
in classAbstractAssociation
- Parameters:
value
- the new value, ornull
.- Throws:
IllegalArgumentException
- if the given feature is not valid for this association.- See Also:
-
hashCode
public int hashCode()Returns a hash code value for this association. -
equals
Compares this association with the given object for equality.
-