com.mapinfo.midev.dp.shape

## Class ShapeTableDefinition

- java.lang.Object
- - com.mapinfo.midev.dp.shape.ShapeTableDefinition

All Implemented Interfaces:
  IHasVolatility, ITableDefinition, IFileTableDefinition

    public final class ShapeTableDefinition
    extends Object
    implements IFileTableDefinition, IHasVolatility

A definition for an ESRI shape file table. A table definition points to a `*.shp` file on the file system. Supporting files like `*.dbf` and `*.shx` are expected to be in the same file system directory and have the same base name.

### Constructor Summary

Constructors
Constructor and Description
`ShapeTableDefinition(File file, CoordSys coordSys, Charset charset)` Creates a new table definition for the given shape file.
`ShapeTableDefinition(File file, CoordSys coordSys, Charset charset, Boolean generateSpatialIndex, boolean isVolatile, List hints)` Creates a new table definition for the given shape file.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(Object o)`
`boolean` `generateSpatialIndex()` Indicates if a spatial index should be generated when querying the corresponding datasource table.
`Charset` `getCharset()` Returns the character set to use with this table definition.
`CoordSys` `getCoordSys()` Returns the coordinate system to use with this table definition.
`IDataProvider` `getDataProvider()` Returns the data provider for this table definition.
`File` `getFile()` Returns the shape file of this table definition.
`List` `getHints()` Returns the column hints to use with this table definition.
`String` `getName()` Returns the base name of the shape file of this table definition.
`int` `hashCode()`
`boolean` `isVolatile()` Indicates if this table definition describes a volatile datasource table.

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ShapeTableDefinition

    public ShapeTableDefinition(File file,
                                CoordSys coordSys,
                                Charset charset)

Creates a new table definition for the given shape file. A coordinate system and a character set can be specified to determine how spatial and textual attribute data should be interpreted. If either is set to `null`, an attempt will be made to auto-detect the value when a table is opened with this table definition.

Parameters:
  `file` - a shape file
  `coordSys` - an optional coordinate system to interpret spatial data with.
  `charset` - an optional character set to interpret textual attribute data with

#### ShapeTableDefinition

    public ShapeTableDefinition(File file,
                                CoordSys coordSys,
                                Charset charset,
                                Boolean generateSpatialIndex,
                                boolean isVolatile,
                                List hints)

Creates a new table definition for the given shape file. A coordinate system and a character set can be specified to determine how spatial and textual attribute data should be interpreted. If either is set to `null`, an attempt will be made to auto-detect the value when a table is opened with this table definition. If `generateSpatialIndex` is `true` a quad-tree based spatial index will be generated alongside the opened `*.shp` file. The index will be generated on the first spatial search and saved in a `*.qix` file. If the `isVolatile` flag is set to `false`, the caller indicates that the underlying shape files cannot be modified by another process. In that case, the data provider will apply certain performance optimizations like the reuse of file descriptors in order to avoid repetitive opening and closing of files. The `hints` parameter can be used to provide a list of column hints to override the attribute metadata determined from the shape file.

Parameters:
  `file` - a shape file
  `coordSys` - an optional coordinate system to interpret spatial data with.
  `charset` - an optional character set to interpret textual attribute data with
  `generateSpatialIndex` - a boolean flag indicating if a quad tree index should be created to improve the efficiency of spatial queries.
  `isVolatile` - a boolean flag to indicate if the opened shape file data can be changed by other processes. This is indicated by the value being set to `true`.
  `hints` - a list of column hints to override the default attribute metadata.

### Method Detail

#### getFile

    public File getFile()

Returns the shape file of this table definition.

Specified by:
  `getFile` in interface `IFileTableDefinition`
Returns:
  File to be opened.

#### getDataProvider

    public IDataProvider getDataProvider()

Returns the data provider for this table definition.

Specified by:
  `getDataProvider` in interface `ITableDefinition`
Returns:
  the `IDataProvider` implementation that supports this table type.

#### getName

    public String getName()

Returns the base name of the shape file of this table definition. The base name is the file name without the extension and separator dot.

Specified by:
  `getName` in interface `ITableDefinition`
Returns:
  the name of the table

#### getCoordSys

    public CoordSys getCoordSys()

Returns the coordinate system to use with this table definition.

#### getCharset

    public Charset getCharset()

Returns the character set to use with this table definition.

#### isVolatile

    public boolean isVolatile()

Indicates if this table definition describes a volatile datasource table.

Specified by:
  `isVolatile` in interface `IHasVolatility`
Returns:
  Returns true if a table is volatile and should be checked for changes, otherwise returns false.

#### generateSpatialIndex

    public boolean generateSpatialIndex()

Indicates if a spatial index should be generated when querying the corresponding datasource table.

#### getHints

    public List getHints()

Returns the column hints to use with this table definition.

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`