com.mapinfo.midev.feature

## Interface IAttributeValue

All Superinterfaces:
  Serializable

All Known Implementing Classes:
  AllType

    public interface IAttributeValue
    extends Serializable

Defines typed access to get and set an attribute value.

Note that if `IAttributeValue.isNull()` is true, other getters will throw an exception so it is advisable to always call `IAttributeValue.isNull()` before getting the value of the attribute.

A typical pattern for using an `IAttributeValue` is as follows:

    IAttributeValue val = getValue();
    if (val.isNull()) {
        // do something
    } else {
        switch (val.getDataType()) {
            case BOOLEAN:
                boolean boolVal = val.getBoolean();
                // do something
                break;
            case INTEGER:
                int intVal = val.getInt();
                // do something
                break;
            // ...
        }
    }

### Method Summary

All Methods Instance Methods Abstract Methods
`byte[]` `getBinary()` Gets the value of the attribute.
`boolean` `getBoolean()` Gets the value of the attribute.
`byte` `getByte()` Gets the value of the attribute.
`char` `getChar()` Gets the value of the attribute.
`IAttributeValue` `getCopy()` Returns a deep copy of this attribute.
`AttributeType` `getDataType()` Indicates the data type of the attribute.
`MIDate` `getDate()` Gets the value of the attribute.
`MIDateTime` `getDateTime()` Gets the value of the attribute.
`MIDateTimeZone` `getDateTimeZone()` Gets the value of the attribute.
`double` `getDouble()` Gets the value of the attribute.
`IFeature` `getFeature()` Gets the value of the attribute.
`IFeatureCollection` `getFeatureCollection()` Gets the value of the attribute.
`IFeatureGeometry` `getFeatureGeometry()` Gets the value of the attribute.
`float` `getFloat()` Gets the value of the attribute.
`int` `getInt()` Gets the value of the attribute.
`long` `getLong()` Gets the value of the attribute.
`IMultiFeatureCollection` `getMultiFeatureCollection()` Gets the value of the attribute.
`IRasterDataset` `getRasterDataset()` Gets the value of the attribute.
`short` `getShort()` Gets the value of the attribute.
`String` `getString()` Gets the value of the attribute.
`IStyle` `getStyle()` Gets the value of the attribute.
`MITime` `getTime()` Gets the value of the attribute.
`MITimespan` `getTimespan()` Gets the value of the attribute.
`boolean` `isNull()` Indicates if the value of the attribute is null.
`void` `setBinary(byte[] value)` Sets the value of the attribute.
`void` `setBoolean(boolean value)` Sets the value of the attribute.
`void` `setByte(byte value)` Sets the value of the attribute.
`void` `setChar(char value)` Sets the value of the attribute.
`void` `setDate(MIDate value)` Sets the value of the attribute.
`void` `setDateTime(MIDateTime value)` Sets the value of the attribute.
`void` `setDateTimeZone(MIDateTimeZone value)` Sets the value of the attribute.
`void` `setDouble(double value)` Sets the value of the attribute.
`void` `setFeature(IFeature value)` Sets the value of the attribute.
`void` `setFeatureCollection(IFeatureCollection value)` Sets the value of the attribute.
`void` `setFeatureGeometry(IFeatureGeometry value)` Sets the value of the attribute.
`void` `setFloat(float value)` Sets the value of the attribute.
`void` `setFromFeature(IFeature feature, int attributeIndex, boolean bDeepCopy)` Note this should be a non-transient operation.
`void` `setInt(int value)` Sets the value of the attribute.
`void` `setLong(long value)` Sets the value of the attribute.
`void` `setMultiFeatureCollection(IMultiFeatureCollection value)` Sets the value of the attribute.
`void` `setNull()` Sets the value of the attribute to `null`.
`void` `setRasterDataset(IRasterDataset value)` Sets the value of the attribute.
`void` `setShort(short value)` Sets the value of the attribute.
`void` `setString(String value)` Sets the value of the attribute.
`void` `setStyle(IStyle value)` Sets the value of the attribute.
`void` `setTime(MITime value)` Sets the value of the attribute.
`void` `setTimespan(MITimespan value)` Sets the value of the attribute.
`void` `setValue(IAttributeValue from, boolean bDeepCopy)` Note this should be a non-transient operation.

### Method Detail

#### getCopy

    IAttributeValue getCopy()

Returns a deep copy of this attribute.

Returns:
  a deep copy of this attribute.

#### getDataType

    AttributeType getDataType()

Indicates the data type of the attribute.

Returns:
  the data type of the attribute.

#### setValue

    void setValue(IAttributeValue from,
                  boolean bDeepCopy)

Note this should be a non-transient operation.

Parameters:
  `from` - - The value to set this attribute to.
  `bDeepCopy` - - True if the from value should be deep copied.

#### setFromFeature

    void setFromFeature(IFeature feature,
                        int attributeIndex,
                        boolean bDeepCopy)

Note this should be a non-transient operation.

Parameters:
  `feature` - - The feature containing the data this attribute is to be set to.
  `attributeIndex` - - The index of the attribute
  `bDeepCopy` - - True if the from value should be deep copied.

#### isNull

    boolean isNull()

Indicates if the value of the attribute is null. The typed accessor methods such as `getString` and `getInt` will throw an exception if the value for the attribute is null. Users should first check for null values using this method.

Returns:
  `true` if the value for the attribute is null; `false` otherwise.

#### getBoolean

    boolean getBoolean()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getInt

    int getInt()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getShort

    short getShort()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getLong

    long getLong()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getFloat

    float getFloat()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getDouble

    double getDouble()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getString

    String getString()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getDate

    MIDate getDate()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getDateTime

    MIDateTime getDateTime()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getTime

    MITime getTime()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getDateTimeZone

    MIDateTimeZone getDateTimeZone()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getTimespan

    MITimespan getTimespan()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getFeatureGeometry

    IFeatureGeometry getFeatureGeometry()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getStyle

    IStyle getStyle()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getChar

    char getChar()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getByte

    byte getByte()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type
  `IllegalStateException` - if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getBinary

    byte[] getBinary()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type or if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getRasterDataset

    IRasterDataset getRasterDataset()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type or if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getFeature

    IFeature getFeature()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

todo: Include a section at the top of this interface or maybe in the Feature Package level docs about type extensibility and refer to that here....

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type or if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getFeatureCollection

    IFeatureCollection getFeatureCollection()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

todo: Include a section at the top of this interface or maybe in the Feature Package level docs about type extensibility and refer to that here....

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type or if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### getMultiFeatureCollection

    IMultiFeatureCollection getMultiFeatureCollection()

Gets the value of the attribute. If the value is `null`, an exception will be thrown. Users must check for null values before attempting to access a typed value accessor method.

todo: Include a section at the top of this interface or maybe in the Feature Package level docs about type extensibility and refer to that here....

Returns:
  the value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not of the expected type or if the value for this attribute is `null`.
See Also:
  `IAttributeValue.isNull()`

#### setNull

    void setNull()

Sets the value of the attribute to `null`. Attributes do not represent null using a value within the domain of the attribute type. For example, a string attribute is not set to null by calling `setString` and passing in a null string referenece for the value. This will generate an exception. To set a value to null, use the setNull method.

Throws:
  `IllegalStateException` - if the attribute is not allowed to be null.

#### setBoolean

    void setBoolean(boolean value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setInt

    void setInt(int value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setShort

    void setShort(short value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setLong

    void setLong(long value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setFloat

    void setFloat(float value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setDouble

    void setDouble(double value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setString

    void setString(String value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setFeatureGeometry

    void setFeatureGeometry(IFeatureGeometry value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setStyle

    void setStyle(IStyle value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setRasterDataset

    void setRasterDataset(IRasterDataset value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setDate

    void setDate(MIDate value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setDateTime

    void setDateTime(MIDateTime value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setDateTimeZone

    void setDateTimeZone(MIDateTimeZone value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setTime

    void setTime(MITime value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setTimespan

    void setTimespan(MITimespan value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setChar

    void setChar(char value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setByte

    void setByte(byte value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setBinary

    void setBinary(byte[] value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setFeature

    void setFeature(IFeature value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `MetadataMismatchException` - if the attribute is not allowed to assume this type or if the input feature attributes don't match the attributes defined for this attribute (if any).

#### setFeatureCollection

    void setFeatureCollection(IFeatureCollection value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.

#### setMultiFeatureCollection

    void setMultiFeatureCollection(IMultiFeatureCollection value)

Sets the value of the attribute.

Parameters:
  `value` - the new value for the attribute.
Throws:
  `InconvertableTypeException` - if the attribute is not allowed to assume this type.