com.antelmann.sql
Class SQLEntryClassMapper
java.lang.Object
com.antelmann.db.EntryClassMapper.Adapter
com.antelmann.sql.SQLEntryClassMapper
- All Implemented Interfaces:
- DBConfigListener, EntryClassMapper
public class SQLEntryClassMapper
- extends EntryClassMapper.Adapter
- implements DBConfigListener
allows to automatically map entry class objects to their respective table names in a database
Note: only use this as a DBConfigListener if the mapper is associated to a single database,
since the complete mapping will be replaced when store changes occur.
- Since:
- 07.05.2010, 12:59:30
- Author:
- Holger Antelmann
- See Also:
availableStoresChanged(Database),
MappingInfo
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQLEntryClassMapper
public SQLEntryClassMapper(Database<?>... dbs)
clean
public void clean()
addDatabase
public void addDatabase(Database<?> db)
addStore
public boolean addStore(DBClassStore<?> store)
removeMapping
public String removeMapping(Class<? extends DBEntry> type)
addMapping
public boolean addMapping(Class<? extends DBEntry> type,
String tableName)
containsType
public boolean containsType(Class<?> type)
containsString
public boolean containsString(String className)
currentDBUserChanged
public void currentDBUserChanged(Database<?> db)
- Description copied from interface:
DBConfigListener
- called upon
Database.setCurrentUser(User)
- Specified by:
currentDBUserChanged in interface DBConfigListener
- Parameters:
db - the database on which the change occurred
availableStoresChanged
public void availableStoresChanged(Database<?> db)
- clears the existing mapping first and then adds the database
- Specified by:
availableStoresChanged in interface DBConfigListener
- Parameters:
db - the database on which the change occurred- See Also:
Database.getAvailableClassStores()
entryClassToObject
public Object entryClassToObject(Class<? extends DBEntry> resourceClass)
- Description copied from interface:
EntryClassMapper
- converts the given Class into an object that can easily be stored/exported elsewhere.
It is usually wise to have the return value be serializable.
- Specified by:
entryClassToObject in interface EntryClassMapper- Overrides:
entryClassToObject in class EntryClassMapper.Adapter
- Parameters:
resourceClass - may be null (in which case null is usually expected as a return value)
objectToEntryClass
public Class<? extends DBEntry> objectToEntryClass(Object referenceType)
throws ClassNotFoundException
- Description copied from interface:
EntryClassMapper
- converts the given (maybe externally retrieved) Object into some DBEntry class to be used
- Specified by:
objectToEntryClass in interface EntryClassMapper- Overrides:
objectToEntryClass in class EntryClassMapper.Adapter
- Parameters:
referenceType - may be null (in which case null is usually expected as a return value)
- Throws:
ClassNotFoundException
(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads