站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.1.0 API 文档英文版

AbstractDataFieldMaxValueIncrementer (Spring Framework API 2.1) - Spring Framework 2.1.0 API 文档英文版


The Spring Framework

org.springframework.jdbc.support.incrementer
Class AbstractDataFieldMaxValueIncrementer

java.lang.Object
  extended by org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
All Implemented Interfaces:
InitializingBean, DataFieldMaxValueIncrementer
Direct Known Subclasses:
AbstractSequenceMaxValueIncrementer, HsqlMaxValueIncrementer, MySQLMaxValueIncrementer

public abstract class AbstractDataFieldMaxValueIncrementer
extends Object
implements DataFieldMaxValueIncrementer, InitializingBean

Implementation of DataFieldMaxValueIncrementer that delegates to a single getNextKey template method that returns a long. Uses longs for String values, padding with zeroes if required.

Author:
Dmitriy Kopylenko, Juergen Hoeller, Jean-Pierre Pawlak, Juergen Hoeller

Field Summary
protected  int paddingLength
          The length to which a string result should be pre-pended with zeroes
 
Constructor Summary
AbstractDataFieldMaxValueIncrementer()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 DataSource getDataSource()
          Return the data source to retrieve the value from.
 String getIncrementerName()
          Return the name of the sequence/table.
protected abstract  long getNextKey()
          Determine the next key to use, as a long.
 int getPaddingLength()
          Return the padding length for String values.
 int nextIntValue()
          Increment the data store field's max value as int.
 long nextLongValue()
          Increment the data store field's max value as long.
 String nextStringValue()
          Increment the data store field's max value as String.
 void setDataSource(DataSource dataSource)
          Set the data source to retrieve the value from.
 void setIncrementerName(String incrementerName)
          Set the name of the sequence/table.
 void setPaddingLength(int paddingLength)
          Set the padding length, i.e. the length to which a string result should be pre-pended with zeroes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paddingLength

protected int paddingLength
The length to which a string result should be pre-pended with zeroes

Constructor Detail

AbstractDataFieldMaxValueIncrementer

public AbstractDataFieldMaxValueIncrementer()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
Set the data source to retrieve the value from.


getDataSource

public DataSource getDataSource()
Return the data source to retrieve the value from.


setIncrementerName

public void setIncrementerName(String incrementerName)
Set the name of the sequence/table.


getIncrementerName

public String getIncrementerName()
Return the name of the sequence/table.


setPaddingLength

public void setPaddingLength(int paddingLength)
Set the padding length, i.e. the length to which a string result should be pre-pended with zeroes.


getPaddingLength

public int getPaddingLength()
Return the padding length for String values.


afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean

nextIntValue

public int nextIntValue()
                 throws DataAccessException
Description copied from interface: DataFieldMaxValueIncrementer
Increment the data store field's max value as int.

Specified by:
nextIntValue in interface DataFieldMaxValueIncrementer
Returns:
int next data store value such as max + 1
Throws:
DataAccessException - in case of errors

nextLongValue

public long nextLongValue()
                   throws DataAccessException
Description copied from interface: DataFieldMaxValueIncrementer
Increment the data store field's max value as long.

Specified by:
nextLongValue in interface DataFieldMaxValueIncrementer
Returns:
int next data store value such as max + 1
Throws:
DataAccessException - in case of errors

nextStringValue

public String nextStringValue()
                       throws DataAccessException
Description copied from interface: DataFieldMaxValueIncrementer
Increment the data store field's max value as String.

Specified by:
nextStringValue in interface DataFieldMaxValueIncrementer
Returns:
next data store value such as max + 1
Throws:
DataAccessException - in case of errors

getNextKey

protected abstract long getNextKey()
Determine the next key to use, as a long.

Returns:
the key to use as a long. It will eventually be converted later in another format by the public concrete methods of this class.

The Spring Framework

Copyright © 2002-2007 The Spring Framework.