public abstract class AbstractDataFieldMaxValueIncrementer extends Object implements DataFieldMaxValueIncrementer, org.springframework.beans.factory.InitializingBean
DataFieldMaxValueIncrementer that delegates
to a single getNextKey() template method that returns a long.
Uses longs for String values, padding with zeroes if required.| Modifier and Type | Field and Description |
|---|---|
protected int |
paddingLength
The length to which a string result should be pre-pended with zeroes
|
| Constructor and Description |
|---|
AbstractDataFieldMaxValueIncrementer()
Default constructor for bean property style usage.
|
AbstractDataFieldMaxValueIncrementer(DataSource dataSource,
String incrementerName)
Convenience constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
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.
|
protected int paddingLength
public AbstractDataFieldMaxValueIncrementer()
public AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName)
dataSource - the DataSource to useincrementerName - the name of the sequence/table to usepublic void setDataSource(DataSource dataSource)
public DataSource getDataSource()
public void setIncrementerName(String incrementerName)
public String getIncrementerName()
public void setPaddingLength(int paddingLength)
public int getPaddingLength()
public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic int nextIntValue()
throws org.springframework.dao.DataAccessException
DataFieldMaxValueIncrementernextIntValue in interface DataFieldMaxValueIncrementerorg.springframework.dao.DataAccessException - in case of errorspublic long nextLongValue()
throws org.springframework.dao.DataAccessException
DataFieldMaxValueIncrementernextLongValue in interface DataFieldMaxValueIncrementerorg.springframework.dao.DataAccessException - in case of errorspublic String nextStringValue() throws org.springframework.dao.DataAccessException
DataFieldMaxValueIncrementernextStringValue in interface DataFieldMaxValueIncrementerorg.springframework.dao.DataAccessException - in case of errorsprotected abstract long getNextKey()