Package org.apache.sis.feature
Class AttributeView<V>
java.lang.Object
org.apache.sis.feature.Property
org.apache.sis.feature.Field<V>
org.apache.sis.feature.AbstractAttribute<V>
org.apache.sis.feature.AttributeView<V>
- Type Parameters:
V- the type of attribute values. If the attribute supports multi-occurrences, then this is the type of elements (not the collection type).
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AttributeView.Singleton
An attribute 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 classSpecialization ofAttributeViewwhen the amount of values can be only zero or one. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AbstractFeatureThe feature from which to read and where to write the attribute or association value.(package private) final StringThe string representation of the property name.private static final longFor cross-version compatibility.Fields inherited from class org.apache.sis.feature.AbstractAttribute
type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAttributeView(AbstractFeature feature, DefaultAttributeType<V> type) Creates a new attribute which will delegate its work to the given feature. -
Method Summary
Modifier and TypeMethodDescriptionfinal Map<String,AbstractAttribute<?>> Returns an empty map since this simple view does not support characteristics.(package private) static <V> AbstractAttribute<V>create(AbstractFeature feature, DefaultAttributeType<V> type) Creates a new attribute which will delegate its work to the given feature.final booleanfinal org.opengis.util.GenericNamegetName()Returns the name of the type specified at construction time.getValue()Returns the attribute value, ornullif none.Returns all attribute values, or an empty collection if none.final inthashCode()voidSets the attribute value.final voidsetValues(Collection<? extends V> values) Sets the attribute values.final StringtoString()Returns a string representation of this attribute.Methods inherited from class org.apache.sis.feature.AbstractAttribute
characteristicsReadOnly, clone, create, create, getType, qualityMethods 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
-
AttributeView
Creates a new attribute which will delegate its work to the given feature.
-
-
Method Details
-
create
Creates a new attribute which will delegate its work to the given feature.- Parameters:
feature- the feature from which to read and where to write the attribute value.type- the type of this attribute. 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 type specified at construction time.- Overrides:
getNamein classAbstractAttribute<V>- Returns:
- the attribute name specified by its type.
-
getValue
Description copied from class:AbstractAttributeReturns the attribute value, ornullif none. This convenience method can be invoked in the common case where the maximum number of attribute values is restricted to 1 or 0.- Specified by:
getValuein classAbstractAttribute<V>- Returns:
- the attribute value (may be
null). - See Also:
-
setValue
Description copied from class:AbstractAttributeSets the attribute value. All previous values are replaced by the given singleton.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 theAbstractAttribute.quality()method.- Specified by:
setValuein classAbstractAttribute<V>- Parameters:
value- the new value, ornullfor removing all values from this attribute.- See Also:
-
getValues
Description copied from class:AbstractAttributeReturns all attribute values, or an empty collection if none. The returned collection is live: changes in the returned collection will be reflected immediately in thisAttributeinstance, and conversely.The default implementation returns a collection which will delegate its work to
AbstractAttribute.getValue()andAbstractAttribute.setValue(Object).- Overrides:
getValuesin classAbstractAttribute<V>- Returns:
- the attribute values in a live collection.
-
setValues
Description copied from class:AbstractAttributeSets the 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
AbstractAttribute.setValue(Object).- Overrides:
setValuesin classAbstractAttribute<V>- Parameters:
values- the new values.
-
characteristics
Returns an empty map since this simple view does not support characteristics.- Overrides:
characteristicsin classAbstractAttribute<V>- Returns:
- other attribute types that describes this attribute type, or an empty map if none.
- See Also:
-
hashCode
public final int hashCode() -
equals
-
toString
Description copied from class:AbstractAttributeReturns a string representation of this attribute. The returned string is for debugging purpose and may change in any future SIS version. The current implementation is like below:- Overrides:
toStringin classAbstractAttribute<V>- Returns:
- a string representation of this attribute for debugging purpose.
-