Holger's Java API

## com.antelmann.sql
Interface MappingInfo

All Known Subinterfaces:
  ObjectRowMapper<T>

All Known Implementing Classes:
  AddressableMapper, BaseDocumentMapper, BaseRowMapper, BeanMapper, CategoryStore, DBDocumentStore.Mapper, DefaultMappingInfo, DetailRowStore, GenericPropertyEntryMapper, GenericPropertyEntryStore, GPersonRelationStore, ImageURLEntryMapper, JDBCRowStore, MappedEntryMapper, MessageEntryMapper, MySqlQueryToViewMapper, PropertyEntryHeaderStore, PropertyEntryTableStore, PropertyMapper, RelationshipStore, RelationshipStore.Mapper, SerializedEntrySQLMapper, SortedGroupableSQLStore, TaggableHeaderStore, TaggableSQLStore, ThumbnailMapper, UnionSqlStore, UserImplMapper, UserImplStore, WrappedDBClassStoreMapping, WrappedObjectRowMapper

    public interface MappingInfo

provides basic information about the mapping of a class

Since:
  20.01.2009, 19:20:44
Author:
  Holger Antelmann
See Also:
  `BaseRowMapper`, `JDBCRowStore`, `Database.queryStoreForInterface(Class, Class)`, `DefaultMappingInfo`, `ForeignKeyMappingInfo`

Method Summary
`String[]` `getColumnNames()` returns all the columns that are retrieved by the mapper when querying the database); the column names for the ID column and display column are included in the returned array.
`String[]` `getColumnsForTopic(Object topic)` allows to determine whether there are any columns that are applicable for the given topic
`int` `getColumnSize(String column)` allows to determine the size of the given column name.
`String` `getDisplayColumn()` for use in stubs (in case a single column is used as a display value)
`String` `getDisplayNameForColumn(String column)` returns a name suitable for display in a GUI if different from the column name used in the database
`String` `getIDColumn()` specifies the column where the ID of the entry is mapped to
`String` `getMappingForTopic(Object topic)` allows to determine whether a specific given topic maps to a distinct table, query or column name.
`int` `getSQLTypeforColumn(String column)` allows to determine the SQL-type for a given column name
`String` `getTableName()` provides the name of the table that stores the data for the store
`String` `getTableQuery()` if querying involves something different than just selecting all columns of the table, this method returns the string used to replace the table name in a query.

Method Detail

### getTableName

    String getTableName()

  provides the name of the table that stores the data for the store

  See Also:
    `getTableQuery()`

### getTableQuery

    String getTableQuery()

  if querying involves something different than just selecting all columns of the table, this method returns the string used to replace the table name in a query. The return value - if non-null - is used to create ResultSet objects, so that other columns than those merely present in the original table can be retrieved (e.g. through a join). If this value is null, the value from `getTableName()` is used in all cases. If non-null, this variable would have a value like '(select a.field1, b.* from a, b where a.id=b.id) as t1'.

  See Also:
    `getTableName()`

### getIDColumn

    String getIDColumn()

  specifies the column where the ID of the entry is mapped to

### getDisplayColumn

    String getDisplayColumn()

  for use in stubs (in case a single column is used as a display value)

### getMappingForTopic

    String getMappingForTopic(Object topic)

  allows to determine whether a specific given topic maps to a distinct table, query or column name.

  Returns:
    either a table name, a column name, a query string or null - depending on the given topic

### getColumnsForTopic

    String[] getColumnsForTopic(Object topic)

  allows to determine whether there are any columns that are applicable for the given topic

  Returns:
    an array of column names that apply to the given topic; the array may be empty but never null

### getColumnNames

    String[] getColumnNames()

  returns all the columns that are retrieved by the mapper when querying the database); the column names for the ID column and display column are included in the returned array. Note that the return value refers to the columns in the table query; only if the query is null, the return value refers to the columns in the table itself.

  Returns:
    all columns that are retrieved by the mapper or null if this doesn't apply for this instance.
  See Also:
    `getTableName()`, `getTableQuery()`, `getIDColumn()`, `getDisplayColumn()`

### getDisplayNameForColumn

    String getDisplayNameForColumn(String column)

  returns a name suitable for display in a GUI if different from the column name used in the database

  Returns:
    a suitable display value for the given column or the given column itself if no better display name exists

### getSQLTypeforColumn

    int getSQLTypeforColumn(String column)
                            throws IllegalArgumentException

  allows to determine the SQL-type for a given column name

  Returns:
    the SQL-type for the given column
  Throws:
    `IllegalArgumentException` - if the given column is not known
  See Also:
    `Types`

### getColumnSize

    int getColumnSize(String column)
                      throws IllegalArgumentException

  allows to determine the size of the given column name. For a text column, this is the maximum number of characters; for a number column, this specifies the precision.

  Throws:
    `IllegalArgumentException` - if the given column is not known

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads