Holger's Java API

## com.antelmann.sql
Class MappedEntryMapper<T extends DBEntry>

    java.lang.Object
      com.antelmann.sql.BaseRowMapper<T>
          com.antelmann.sql.MappedEntryMapper<T>

All Implemented Interfaces:
  TransactionRequired, MappingInfo, ObjectRowMapper<T>, Converter<RowItem,T>

    public class MappedEntryMapper<T extends DBEntry>

extends BaseRowMapper<T>

a special mapper that completely automates the mapping with specially annotated `DBEntry` classes via reflection.

Since:
  24.06.2009, 16:09:11
Author:
  Holger Antelmann
See Also:
  `MappedEntry`, `MappedColumn`

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.util.Converter
`Converter.Adapter<T1,T2>`

Field Summary

Fields inherited from class com.antelmann.sql.BaseRowMapper
`db, helper`

Constructor Summary
`MappedEntryMapper(Database<Connection> db, Class<T> type)`
`MappedEntryMapper(Database<Connection> db, Class<T> type, IDFactory factory)`

Method Summary
`protected Object` `convertToJava(Object obj, Member member)` supports Stub members
`protected Object` `convertToSQL(Object obj, int sqlType, int precision)` supports Stub members

`static

`<T extends DBEntry> JDBCRowStore<T>`

`

`createStore(Database<Connection> db, Class<T> type)`
convenience method to easily create a store with no factory

`static

`<T extends DBEntry> JDBCRowStore<T>`

`

`createStore(Database<Connection> db, Class<T> type, boolean useNextIntForID)`
convenience method to easily create a store and use `BaseRowMapper.getNextIntID()` to implement `BaseRowMapper.generateNewID()`

`static

`<T extends DBEntry> JDBCRowStore<T>`

`

`createStore(Database<Connection> db, Class<T> type, boolean useNextIntForID, boolean fastDelete)`
convenience method to easily create a store and use `BaseRowMapper.getNextIntID()` to implement `BaseRowMapper.generateNewID()`

`static

`<T extends DBEntry> JDBCRowStore<T>`

`

`createStore(Database<Connection> db, Class<T> type, IDFactory factory, boolean enableFastDelete)`
convenience method to easily create a store

`protected Map<String,Object>` `generateRowProperties(T entry)` generates a map that contains all columns mapped to their values, so that the map can be used to store the object into a row.
`static String` `getColumn(AccessibleObject ao)`
`static HashSet<String>` `getColumns(Class<?> type)`
`static String` `getDisplayColumnName(Class<?> type)`
`static String` `getIdColumnName(Class<?> type)`
`static String` `getQuery(Class<?> type)`
`static String` `getTableName(Class<?> type)` returns either the name of the specified table or the simple name of the type if the table was not specified
`T` `instantiate(RowItem row)` instantiates the DBEntry based on the properties in the given row.
`void` `setIDFactory(IDFactory idFactory, Class<T> type)`

Methods inherited from class com.antelmann.sql.BaseRowMapper

`addColumnsForTopic, applyFromMapping, checkExistence, convert, convertBack, convertTopicFilter, emptyStringsToNull, extractReference, extractStub, extractStub, generateNewID, getAll, getColumnDisplayMapping, getColumnNames, getColumnsForTopic, getColumnSize, getConnection, getConnectionHelper, getDisplayColumn, getDisplayNameForColumn, getEntryClass, getEntryClassMapper, getIDColumn, getIDFactory, getMappedValue, getMappingForTopic, getNextIntID, getNextIntIDFactory, getNextIntIDFactory, getPreStoreFilter, getReadOnlyColumns, getRestrictMappedColumns, getResultSet, getSQLTypeforColumn, getStubColumns, getStubQuery, getStubResultSet, getSupportedTopicColumns, getTableColumnNames, getTableName, getTableQuery, getTableQueryForComboFilter, getTransactionCounter, getUniqueRandomString, handleAfterStore, initMapping, isMappedTopic, isTranslate, javaToSql, javaToSql, lockTable, mapReference, mapReference, mapToRow, removeColumnTopic, setColumnsForTopic, setDisplayColumn, setEntryClass, setEntryClassMapper, setMappedValue, setNextIntIdAsFactory, setPreStoreFilter, setReadOnlyColumns, setRestrictedMappedColumns, setStubQuery, setTableQuery, setTableQuery, setTopic, setTranslate, sqlToJava, toSQLMap, verifyBeforeDelete, verifyBeforeStore`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MappedEntryMapper

    public MappedEntryMapper(Database<Connection> db,
                             Class<T> type)
                      throws DatabaseException,
                             IllegalArgumentException

Throws:
  `DatabaseException`
  `IllegalArgumentException`

### MappedEntryMapper

    public MappedEntryMapper(Database<Connection> db,
                             Class<T> type,
                             IDFactory factory)
                      throws DatabaseException,
                             IllegalArgumentException

Throws:
  `DatabaseException`
  `IllegalArgumentException`

Method Detail

### createStore

    public static <T extends DBEntry> JDBCRowStore<T> createStore(Database<Connection> db,
                                                                  Class<T> type)
                                                       throws DatabaseException,
                                                              NullPointerException,
                                                              IllegalArgumentException

  convenience method to easily create a store with no factory

  Throws:
    `DatabaseException`
    `NullPointerException`
    `IllegalArgumentException`

### createStore

    public static <T extends DBEntry> JDBCRowStore<T> createStore(Database<Connection> db,
                                                                  Class<T> type,
                                                                  boolean useNextIntForID)
                                                       throws DatabaseException,
                                                              IllegalArgumentException

  convenience method to easily create a store and use `BaseRowMapper.getNextIntID()` to implement `BaseRowMapper.generateNewID()`

  Throws:
    `DatabaseException`
    `IllegalArgumentException`

### createStore

    public static <T extends DBEntry> JDBCRowStore<T> createStore(Database<Connection> db,
                                                                  Class<T> type,
                                                                  boolean useNextIntForID,
                                                                  boolean fastDelete)
                                                       throws DatabaseException,
                                                              IllegalArgumentException

  convenience method to easily create a store and use `BaseRowMapper.getNextIntID()` to implement `BaseRowMapper.generateNewID()`

  Throws:
    `DatabaseException`
    `IllegalArgumentException`

### createStore

    public static <T extends DBEntry> JDBCRowStore<T> createStore(Database<Connection> db,
                                                                  Class<T> type,
                                                                  IDFactory factory,
                                                                  boolean enableFastDelete)
                                                       throws DatabaseException,
                                                              IllegalArgumentException

  convenience method to easily create a store

  Throws:
    `DatabaseException`
    `IllegalArgumentException`

### getTableName

    public static String getTableName(Class<?> type)
                               throws NullPointerException

  returns either the name of the specified table or the simple name of the type if the table was not specified

  Throws:
    `NullPointerException`

### getIdColumnName

    public static String getIdColumnName(Class<?> type)
                                  throws NullPointerException

  Throws:
    `NullPointerException`

### getDisplayColumnName

    public static String getDisplayColumnName(Class<?> type)
                                       throws NullPointerException

  Throws:
    `NullPointerException`

### getQuery

    public static String getQuery(Class<?> type)
                           throws NullPointerException

  Throws:
    `NullPointerException`

### getColumn

    public static String getColumn(AccessibleObject ao)

### getColumns

    public static HashSet<String> getColumns(Class<?> type)

### setIDFactory

    public void setIDFactory(IDFactory idFactory,
                             Class<T> type)

  Overrides:
    `setIDFactory` in class `BaseRowMapper<T extends DBEntry>`

### generateRowProperties

    protected Map<String,Object> generateRowProperties(T entry)
                                                throws WrongDataException

  Description copied from class: `BaseRowMapper`
  generates a map that contains all columns mapped to their values, so that the map can be used to store the object into a row. The ID column and the corresponding ID should not be put in there, as this will happen automatically later.

  Specified by:
    `generateRowProperties` in class `BaseRowMapper<T extends DBEntry>`
  Throws:
    `WrongDataException`

### instantiate

    public T instantiate(RowItem row)
                                  throws Exception

  Description copied from interface: `ObjectRowMapper`
  instantiates the DBEntry based on the properties in the given row. The given row contains all the columns of the queried ResultSet unless the columns to be retrieved are restricted by `ObjectRowMapper.getRestrictMappedColumns()`.

  Throws:
    `Exception`

### convertToJava

    protected Object convertToJava(Object obj,
                                   Member member)

  supports Stub members

### convertToSQL

    protected Object convertToSQL(Object obj,
                                  int sqlType,
                                  int precision)

  supports Stub members

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