net.toften.jlips.persist.db.pk
Class IntegerPrimaryKeyHandler

java.lang.Object
  extended by net.toften.jlips.persist.db.pk.IntegerPrimaryKeyHandler
All Implemented Interfaces:
PrimaryKeyHandler

public class IntegerPrimaryKeyHandler
extends Object
implements PrimaryKeyHandler

This is a primary key handler for a primary key of the type Integer For info about how the key is generated, see getNextPrimaryKey()

Author:
thomas

Constructor Summary
IntegerPrimaryKeyHandler(DBTableInfo tableInfo, DBTableColumnInfo columnInfo)
          Constructor for IntegerPrimaryKeyHandler
 
Method Summary
 DBTableColumnInfo getColumnInfo()
          Return the column info for the column that holds the primary key
 Object getLastPrimaryKey()
          Returns the last used primary key This might not have any meaning for certain types of primary key types
 Object getNextPrimaryKey()
          The way this primary key handler generates a new primary key is by using the highest number currently in the database and then incrementing it
 DBTableInfo getTableInfo()
          Return the table info for the table the primary key handler is used by
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerPrimaryKeyHandler

public IntegerPrimaryKeyHandler(DBTableInfo tableInfo,
                                DBTableColumnInfo columnInfo)
Constructor for IntegerPrimaryKeyHandler

Parameters:
tableInfo - the table info for the related table
columnInfo - the column info for the primary key column
Method Detail

getNextPrimaryKey

public Object getNextPrimaryKey()
The way this primary key handler generates a new primary key is by using the highest number currently in the database and then incrementing it

Specified by:
getNextPrimaryKey in interface PrimaryKeyHandler
Returns:
new unique primary key
See Also:
PrimaryKeyHandler.getNextPrimaryKey()

getLastPrimaryKey

public Object getLastPrimaryKey()
Description copied from interface: PrimaryKeyHandler
Returns the last used primary key This might not have any meaning for certain types of primary key types

Specified by:
getLastPrimaryKey in interface PrimaryKeyHandler
Returns:
the last used primary key
See Also:
PrimaryKeyHandler.getLastPrimaryKey()

getColumnInfo

public DBTableColumnInfo getColumnInfo()
Description copied from interface: PrimaryKeyHandler
Return the column info for the column that holds the primary key

Specified by:
getColumnInfo in interface PrimaryKeyHandler
Returns:
See Also:
PrimaryKeyHandler.getColumnInfo()

getTableInfo

public DBTableInfo getTableInfo()
Description copied from interface: PrimaryKeyHandler
Return the table info for the table the primary key handler is used by

Specified by:
getTableInfo in interface PrimaryKeyHandler
Returns:
table info for handled table
See Also:
PrimaryKeyHandler.getTableInfo()