Class AbstractDataFieldMaxValueIncrementer
java.lang.Object
org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
- All Implemented Interfaces:
- InitializingBean,- DataFieldMaxValueIncrementer
- Direct Known Subclasses:
- AbstractColumnMaxValueIncrementer,- AbstractSequenceMaxValueIncrementer
public abstract class AbstractDataFieldMaxValueIncrementer
extends Object
implements DataFieldMaxValueIncrementer, InitializingBean
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.- Author:
- Dmitriy Kopylenko, Juergen Hoeller, Jean-Pierre Pawlak, Juergen Hoeller
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intThe length to which a string result should be pre-pended with zeroes.
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor for bean property style usage.AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName) Convenience constructor.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.Return the data source to retrieve the value from.Return the name of the sequence/table.protected abstract longDetermine the next key to use, as a long.intReturn the padding length for String values.intIncrement the data store field's max value as int.longIncrement the data store field's max value as long.Increment the data store field's max value as String.voidsetDataSource(DataSource dataSource) Set the data source to retrieve the value from.voidsetIncrementerName(String incrementerName) Set the name of the sequence/table.voidsetPaddingLength(int paddingLength) Set the padding length, i.e.
- 
Field Details- 
paddingLengthprotected int paddingLengthThe length to which a string result should be pre-pended with zeroes.
 
- 
- 
Constructor Details- 
AbstractDataFieldMaxValueIncrementerpublic AbstractDataFieldMaxValueIncrementer()Default constructor for bean property style usage.
- 
AbstractDataFieldMaxValueIncrementerConvenience constructor.- Parameters:
- dataSource- the DataSource to use
- incrementerName- the name of the sequence/table to use
 
 
- 
- 
Method Details- 
setDataSourceSet the data source to retrieve the value from.
- 
getDataSourceReturn the data source to retrieve the value from.
- 
setIncrementerNameSet the name of the sequence/table.
- 
getIncrementerNameReturn the name of the sequence/table.
- 
setPaddingLengthpublic void setPaddingLength(int paddingLength) Set the padding length, i.e. the length to which a string result should be pre-pended with zeroes.
- 
getPaddingLengthpublic int getPaddingLength()Return the padding length for String values.
- 
afterPropertiesSetpublic void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
nextIntValueDescription copied from interface:DataFieldMaxValueIncrementerIncrement the data store field's max value as int.- Specified by:
- nextIntValuein interface- DataFieldMaxValueIncrementer
- Returns:
- int next data store value such as max + 1
- Throws:
- DataAccessException- in case of errors
 
- 
nextLongValueDescription copied from interface:DataFieldMaxValueIncrementerIncrement the data store field's max value as long.- Specified by:
- nextLongValuein interface- DataFieldMaxValueIncrementer
- Returns:
- int next data store value such as max + 1
- Throws:
- DataAccessException- in case of errors
 
- 
nextStringValueDescription copied from interface:DataFieldMaxValueIncrementerIncrement the data store field's max value as String.- Specified by:
- nextStringValuein interface- DataFieldMaxValueIncrementer
- Returns:
- next data store value such as max + 1
- Throws:
- DataAccessException- in case of errors
 
- 
getNextKeyprotected 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.
 
 
-