Holger's Java API

## 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`

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.db.EntryClassMapper
`EntryClassMapper.Adapter`

Field Summary

Fields inherited from interface com.antelmann.db.EntryClassMapper
`DEFAULT_MAPPER, STRING_MAPPER`

Constructor Summary
`SQLEntryClassMapper(Database<?>... dbs)`

Method Summary
`void` `addDatabase(Database<?> db)`
`boolean` `addMapping(Class<? extends DBEntry> type, String tableName)`
`boolean` `addStore(DBClassStore<?> store)`
`void` `availableStoresChanged(Database<?> db)` clears the existing mapping first and then adds the database
`void` `clean()`
`boolean` `containsString(String className)`
`boolean` `containsType(Class<?> type)`
`void` `currentDBUserChanged(Database<?> db)` called upon `Database.setCurrentUser(User)`
`Object` `entryClassToObject(Class<? extends DBEntry> resourceClass)` converts the given Class into an object that can easily be stored/exported elsewhere.
`Class<? extends DBEntry>` `objectToEntryClass(Object referenceType)` converts the given (maybe externally retrieved) Object into some DBEntry class to be used
`String` `removeMapping(Class<? extends DBEntry> type)`

Methods inherited from class com.antelmann.db.EntryClassMapper.Adapter
`getLabelFor, getRenderer, setLabelFor, toConverter`

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

Constructor Detail

### SQLEntryClassMapper

    public SQLEntryClassMapper(Database<?>... dbs)

Method Detail

### 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