V - the type of attribute values.public class DefaultAttributeType<V> extends AbstractIdentifiedType
AttributeType is equivalent to Field
while FeatureType is equivalent to Class.
Attribute characterization (discussed below) is similar to Annotation.
AttributeType interface in a future version.
When such interface will be available, most references to DefaultAttributeType in current
API will be replaced by references to the AttributeType interface.| Attribute name | Value type |
|---|---|
| Building shape | Geometry |
| Building owner | ResponsibleParty |
| Horizontal accuracy | PositionalAccuracy |
Attribute can be characterized by other attributes. For example an attribute that carries a measurement
(e.g. air temperature) may have another attribute that holds the measurement accuracy (e.g. ±0.1°C).
The accuracy value is often constant for all instances of that attribute
(e.g. for all temperature measurements in the same dataset), but this is not mandatory.
Attribute argument, when given a measurement, can also get its accuracy in same time.Attribute instance to specify their own value,
but simple feature usually don't do that.
GenericName and InternationalString
instances) and all arguments (e.g. defaultValue) given to the constructor are also immutable.
Such immutable instances can be shared by many objects and passed between threads without synchronization.
In particular, the getDefaultValue() method does not clone the returned value.
This means that the same defaultValue instance may be shared by many AbstractAttribute instances.
Consequently the default value should be immutable for avoiding unexpected behavior.
DefaultFeatureType,
AbstractAttribute,
Serialized FormDefined in the sis-feature module
DEFINITION_KEY, DEPRECATED_KEY, DESCRIPTION_KEY, DESIGNATION_KEY, NAME_KEY| Constructor and Description |
|---|
DefaultAttributeType(Map<String,?> identification,
Class<V> valueClass,
int minimumOccurs,
int maximumOccurs,
V defaultValue,
DefaultAttributeType<?>... characterizedBy)
Constructs an attribute type from the given properties.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,DefaultAttributeType<?>> |
characteristics()
Other attribute types that describes this attribute type.
|
boolean |
equals(Object obj)
Compares this attribute type with the given object for equality.
|
V |
getDefaultValue()
Returns the default value for the attribute.
|
int |
getMaximumOccurs()
Returns the maximum number of attribute values.
|
int |
getMinimumOccurs()
Returns the minimum number of attribute values.
|
Class<V> |
getValueClass()
Returns the type of attribute values.
|
int |
hashCode()
Returns a hash code value for this attribute type.
|
AbstractAttribute<V> |
newInstance()
Creates a new attribute instance of this type initialized to the default value.
|
String |
toString()
Returns a string representation of this attribute type.
|
getDefinition, getDescription, getDesignation, getName, getRemarks, isDeprecatedpublic DefaultAttributeType(Map<String,?> identification, Class<V> valueClass, int minimumOccurs, int maximumOccurs, V defaultValue, DefaultAttributeType<?>... characterizedBy)
| Map key | Value type | Returned by |
|---|---|---|
| "name" | GenericName or String |
AbstractIdentifiedType.getName() |
| "definition" | InternationalString or String |
AbstractIdentifiedType.getDefinition() |
| "designation" | InternationalString or String |
AbstractIdentifiedType.getDesignation() |
| "description" | InternationalString or String |
AbstractIdentifiedType.getDescription() |
| "deprecated" | Boolean |
AbstractIdentifiedType.isDeprecated() |
identification - the name and other information to be given to this attribute type.valueClass - the type of attribute values.minimumOccurs - the minimum number of occurrences of the attribute within its containing entity.maximumOccurs - the maximum number of occurrences of the attribute within its containing entity,
or Integer.MAX_VALUE if there is no restriction.defaultValue - the default value for the attribute, or null if none.characterizedBy - other attribute types that describes this attribute type (can be null for none).
For example if this new DefaultAttributeType describes a measurement,
then characterizedBy could holds the measurement accuracy.
See "Attribute characterization" in class Javadoc for more information.AttributeTypeBuilderpublic final Class<V> getValueClass()
public final int getMinimumOccurs()
To be valid, an Attribute instance of this AttributeType shall have at least
this minimum number of elements in its collection of values.
public final int getMaximumOccurs()
getMinimumOccurs() value.
If there is no maximum, then this method returns Integer.MAX_VALUE.
To be valid, an Attribute instance of this AttributeType shall have no more than
this maximum number of elements in its collection of values.
Integer.MAX_VALUE if none.public V getDefaultValue()
null if none.public Map<String,DefaultAttributeType<?>> characteristics()
String representations
of characteristics name, for more convenient lookups.AbstractAttribute.characteristics()public AbstractAttribute<V> newInstance()
AbstractAttribute.create(DefaultAttributeType)public int hashCode()
public boolean equals(Object obj)
obj - the object to compare with this type.true if the given object is equals to this type.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.