类 AbstractDataFieldMaxValueIncrementer
- java.lang.Object
- org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
- 所有已实现的接口:
InitializingBean
,DataFieldMaxValueIncrementer
public abstract class AbstractDataFieldMaxValueIncrementer extends Object implements DataFieldMaxValueIncrementer, InitializingBean
Base implementation ofDataFieldMaxValueIncrementer
that delegates to a singlegetNextKey()
template method that returns along
. Uses longs for String values, padding with zeroes if required.- 作者:
- Dmitriy Kopylenko, Juergen Hoeller, Jean-Pierre Pawlak, Juergen Hoeller
字段概要
字段 修饰符和类型 字段 说明 protected int
paddingLength
The length to which a string result should be pre-pended with zeroes
构造器概要
构造器 构造器 说明 AbstractDataFieldMaxValueIncrementer()
Default constructor for bean property style usage.AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName)
Convenience constructor.
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.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.
字段详细资料
paddingLength
protected int paddingLength
The length to which a string result should be pre-pended with zeroes
构造器详细资料
AbstractDataFieldMaxValueIncrementer
public AbstractDataFieldMaxValueIncrementer()
Default constructor for bean property style usage.
AbstractDataFieldMaxValueIncrementer
public AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName)
Convenience constructor.- 参数:
dataSource
- the DataSource to useincrementerName
- the name of the sequence/table to use
方法详细资料
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()
从接口复制的说明:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- 指定者:
afterPropertiesSet
在接口中InitializingBean
nextIntValue
public int nextIntValue() throws DataAccessException
从接口复制的说明:DataFieldMaxValueIncrementer
Increment the data store field's max value as int.- 指定者:
nextIntValue
在接口中DataFieldMaxValueIncrementer
- 返回:
- int next data store value such as max + 1
- 抛出:
DataAccessException
- in case of errors
nextLongValue
public long nextLongValue() throws DataAccessException
从接口复制的说明:DataFieldMaxValueIncrementer
Increment the data store field's max value as long.- 指定者:
nextLongValue
在接口中DataFieldMaxValueIncrementer
- 返回:
- int next data store value such as max + 1
- 抛出:
DataAccessException
- in case of errors
nextStringValue
public String nextStringValue() throws DataAccessException
从接口复制的说明:DataFieldMaxValueIncrementer
Increment the data store field's max value as String.- 指定者:
nextStringValue
在接口中DataFieldMaxValueIncrementer
- 返回:
- next data store value such as max + 1
- 抛出:
DataAccessException
- in case of errors
getNextKey
protected abstract long getNextKey()
Determine the next key to use, as a long.- 返回:
- the key to use as a long. It will eventually be converted later in another format by the public concrete methods of this class.