|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
public abstract class AbstractDataFieldMaxValueIncrementer
Base 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.
Field Summary | |
---|---|
protected int |
paddingLength
The length to which a string result should be pre-pended with zeroes |
Constructor Summary | |
---|---|
AbstractDataFieldMaxValueIncrementer()
Default constructor for bean property style usage. |
|
AbstractDataFieldMaxValueIncrementer(DataSource dataSource,
String incrementerName)
Convenience constructor. |
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 |
---|
protected int paddingLength
Constructor Detail |
---|
public AbstractDataFieldMaxValueIncrementer()
setDataSource(javax.sql.DataSource)
,
setIncrementerName(java.lang.String)
public AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName)
dataSource
- the DataSource to useincrementerName
- the name of the sequence/table to useMethod Detail |
---|
public 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()
InitializingBean
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.
afterPropertiesSet
in interface InitializingBean
public int nextIntValue() throws DataAccessException
DataFieldMaxValueIncrementer
nextIntValue
in interface DataFieldMaxValueIncrementer
DataAccessException
- in case of errorspublic long nextLongValue() throws DataAccessException
DataFieldMaxValueIncrementer
nextLongValue
in interface DataFieldMaxValueIncrementer
DataAccessException
- in case of errorspublic String nextStringValue() throws DataAccessException
DataFieldMaxValueIncrementer
nextStringValue
in interface DataFieldMaxValueIncrementer
DataAccessException
- in case of errorsprotected abstract long getNextKey()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |