com.mapinfo.midev.feature

## Interface IAttributeDefinition

All Superinterfaces:
  Serializable

All Known Subinterfaces:
  IFeatureAttributeDefinition, IGeometryAttributeDefinition

    public interface IAttributeDefinition
    extends Serializable

Describes an attribute of a feature. Features, and feature collections, have metadata that exposes the collection of attribute definitions describing each of the attributes found in the feature or collection. The attribute definition identifies the name, data type, and other related properties of an attribute.

There are several specialized interfaces that extend this general interface.

`IGeometryAttributeDefinition` is an extension to this interface that contains additional properties of an attribute that contains geometry values. If the attribute data type is `AttributeType.FEATURE_GEOMETRY`, then the attribute definition also implements the IGeometryAttributeDefinition interface.

Eventually there will be IFeatureAttributeDefinition for feature/feature collections, IRasterAttributeDefinition for raster/grid, and ITextAttributeDefinition for the new TEXT type. Maybe also IXmlAttributeDefinition?

### Method Summary

All Methods Instance Methods Abstract Methods
`Metadata` `getDataSourceAttributeMetadata()` Provides a data storage-specific definition of this attribute.
`AttributeType` `getDataType()` Indicates the data type of the attribute.
`int` `getDecimals()` Indicates the decimal precision for decimal data types (AttributeType#DBASE_DECIMAL).
`String` `getName()` Returns the name (or alias) of the attribute.
`int` `getWidth()` Returns the maximum storage width for width-sensitive data types such as string, binary, and decimal types.
`boolean` `isNullable()` Indicates if this attribute allows null values.
`boolean` `isReadOnly()` Indicates if the values for this property are read only.
`boolean` `isUnique()` Indicates if the values for this attribute must all be unique within the context of the containing feature collection or data store.

### Method Detail

#### getName

    String getName()

Returns the name (or alias) of the attribute.

Returns:
  the name (alias) of the attribute.

#### getDataType

    AttributeType getDataType()

Indicates the data type of the attribute.

Returns:
  the AttributeType constant that defines the data type for this attribute.

#### isNullable

    boolean isNullable()

Indicates if this attribute allows null values.

Returns:
  `true` if this attribute allows null values; `false` otherwise.

#### isUnique

    boolean isUnique()

Indicates if the values for this attribute must all be unique within the context of the containing feature collection or data store. Validation of uniqueness is the responsibility of a data provider or the backing implementation of a feature collection. Editing operations to insert or update features may result in exceptions if a uniqueness constraint would be violated.

Returns:
  `true` if the value must be unique; `false` otherwise.

#### getWidth

    int getWidth()

Returns the maximum storage width for width-sensitive data types such as string, binary, and decimal types. For other types, this property is not used. For decimal types (`AttributeType.DBASE_DECIMAL`), the width refers to the total width of the field including the negative sign if present and a decimal point. Thus, an attribute of type DBASE_DECIMAL with a width of 6 and decimal precision of 1, for example, could store the range of values [-999.9 to 9999.9], inclusive.

Returns:
  a non-negative integer value indicating the maximum width for a string, binary, or decimal attribute. If there is no maximum value or if width does not apply to the data type for this attribute, then zero will be returned.
See Also:
  `AttributeType.DBASE_DECIMAL`

#### getDecimals

    int getDecimals()

Indicates the decimal precision for decimal data types (AttributeType#DBASE_DECIMAL). This property is only used for decimal data types; for other data types, this property is not used.

Returns:
  a non-negative integer value indicating the number of stored digits for decimal attributes. For other data types, this property should return zero.

#### isReadOnly

    boolean isReadOnly()

Indicates if the values for this property are read only. Typically this property would not be set to `true` in situations where the entire feature or feature collection is read only. An attribute would be flagged as read-only typically in cases where an underlying data provider exposes pseudo columns or other restrictions on a column-by-column basis. Attributes identified as read only do not allow a value to be specified when a new feature is constructed, even if the attribute is also designated as non-nullable. When the feature is inserted into a feature collection, the specific feature collection implementation will supply a value for the read only field in the data store.

When new feature collections are created based on existing feature collections, the read only property should not be applied to the new feature collection.

Refer to the Read Only Properties and Determination section of the package summary for more comprehensive coverage.

Returns:
  `true` if this attribute specifically denies edits to data values; `false` otherwise.

#### getDataSourceAttributeMetadata

    Metadata getDataSourceAttributeMetadata()

Provides a data storage-specific definition of this attribute. The `IAttributeDefinition` interface exposes commonly used attribute properties for the capabilities. This interface does not attempt to provide a means for exposing all of the unique characteristics of each underlying data provider such as Oracle, SQL Server, WFS, Microsoft Access, file formats, etc. This property may be used to expose provider specific information about this attribute.

Returns:
  a Metadata instance containing provider-specific information about the attribute. This property may return `null` if no such metadata exists.