com.antelmann.sql
Class PropertyMapper<T extends DBEntry>
java.lang.Object
com.antelmann.sql.BaseRowMapper<T>
com.antelmann.sql.PropertyMapper<T>
- Type Parameters:
T - specifies the entry class to be mapped; this is purposely kept to a DBEntry
type and not to a PropertyEntry type, so that this can be used as a generic base class
for types that do not necessarily implement PropertyEntry.
- All Implemented Interfaces:
- TransactionRequired, MappingInfo, ObjectRowMapper<T>, Converter<RowItem,T>
public abstract class PropertyMapper<T extends DBEntry>
- extends BaseRowMapper<T>
allows to easily map only remaining columns that are not mapped otherwise to properties
- if applicable and desirable.
By default, the properties are NOT mapped (so that you can safely inherit and use the methods
without initial effects for a deeper inheritance setting);
you first have to enable it via setMapRemainingColumnsAsProperties(boolean)
and then use the appropriate methods in this abstract class to properly support this.
- Since:
- 15.08.2014, 22:01:08
- Author:
- holger
- See Also:
PropertyEntry,
GenericPropertyEntryMapper
|
Constructor Summary |
PropertyMapper(Database<Connection> db,
MappingInfo mi,
IDFactory idFactory,
Class<T> type,
Object... topics)
|
PropertyMapper(Database<Connection> db,
String tableName,
String idColumn)
|
PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
IDFactory idFactory,
Class<T> type)
|
PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn)
|
PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn,
IDFactory idFactory,
Class<T> type)
|
PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn,
IDFactory idFactory,
Class<T> type,
String query)
|
| Methods inherited from class com.antelmann.sql.BaseRowMapper |
addColumnsForTopic, applyFromMapping, checkExistence, convert, convertBack, convertTopicFilter, emptyStringsToNull, extractReference, extractStub, extractStub, generateNewID, generateRowProperties, 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, setIDFactory, 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 |
PropertyMapper
public PropertyMapper(Database<Connection> db,
MappingInfo mi,
IDFactory idFactory,
Class<T> type,
Object... topics)
throws DatabaseException
- Throws:
DatabaseException
PropertyMapper
public PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
IDFactory idFactory,
Class<T> type)
throws DatabaseException
- Throws:
DatabaseException
PropertyMapper
public PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn,
IDFactory idFactory,
Class<T> type,
String query)
throws DatabaseException
- Throws:
DatabaseException
PropertyMapper
public PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn,
IDFactory idFactory,
Class<T> type)
throws DatabaseException
- Throws:
DatabaseException
PropertyMapper
public PropertyMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn)
throws DatabaseException
- Throws:
DatabaseException
PropertyMapper
public PropertyMapper(Database<Connection> db,
String tableName,
String idColumn)
throws DatabaseException
- Throws:
DatabaseException
isMapRemainingColumnsAsProperties
public final boolean isMapRemainingColumnsAsProperties()
- See Also:
setMapRemainingColumnsAsProperties(boolean)
setMapRemainingColumnsAsProperties
public void setMapRemainingColumnsAsProperties(boolean flag)
- if set to true (and T implements
PropertyEntry),
all remaining columns will be mapped to properties
- See Also:
PropertyEntry
getAllReservedColumns
public Set<String> getAllReservedColumns()
- returns all columns that are not to be mapped as properties as they are already
reserved for special topics that are mapped otherwise.
Subclasses should add all mapped topics to this set to avoid them to be mapped as properties
(or override this method, alternatively)
- See Also:
mapColumnsAsProperties(RowItem, DBEntry)
mapColumnsAsProperties
public boolean mapColumnsAsProperties(RowItem row,
DBEntry entry)
- maps all columns that are not reserved otherwise to properties
only if the given entry is actually a
PropertyEntry and
isMapRemainingColumnsAsProperties() is true.
- Returns:
- true only if any column is actually mapped as a property
- See Also:
isMapRemainingColumnsAsProperties(),
getAllReservedColumns(),
mapPropertiesAsColumns(DBEntry, Map)
mapPropertiesAsColumns
public boolean mapPropertiesAsColumns(DBEntry entry,
Map<String,Object> map)
- maps all properties that are not already contained in the given map
only if the given entry is actually a
PropertyEntry and
isMapRemainingColumnsAsProperties() is true.
- Returns:
- true only if any property is actually mapped as a column
- See Also:
isMapRemainingColumnsAsProperties(),
mapColumnsAsProperties(RowItem, DBEntry)
(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads