public abstract class

AbstractDataFieldMaxValueIncrementer

extends Object
implements InitializingBean DataFieldMaxValueIncrementer
java.lang.Object
   ↳ org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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.

Summary

Fields
protected int paddingLength The length to which a string result should be pre-pended with zeroes
Public Constructors
AbstractDataFieldMaxValueIncrementer()
Default constructor for bean property style usage.
AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName)
Convenience constructor.
Public Methods
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.
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 Methods
abstract long getNextKey()
Determine the next key to use, as a long.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer

Fields

protected int paddingLength

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

Public Constructors

public AbstractDataFieldMaxValueIncrementer ()

Default constructor for bean property style usage.

public AbstractDataFieldMaxValueIncrementer (DataSource dataSource, String incrementerName)

Convenience constructor.

Parameters
dataSource the DataSource to use
incrementerName the name of the sequence/table to use

Public Methods

public void afterPropertiesSet ()

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.

public DataSource getDataSource ()

Return the data source to retrieve the value from.

public String getIncrementerName ()

Return the name of the sequence/table.

public int getPaddingLength ()

Return the padding length for String values.

public int nextIntValue ()

Increment the data store field's max value as int.

Returns
  • int next data store value such as max + 1

public long nextLongValue ()

Increment the data store field's max value as long.

Returns
  • int next data store value such as max + 1

public String nextStringValue ()

Increment the data store field's max value as String.

Returns
  • next data store value such as max + 1

public void setDataSource (DataSource dataSource)

Set the data source to retrieve the value from.

public void setIncrementerName (String incrementerName)

Set the name of the sequence/table.

public void setPaddingLength (int paddingLength)

Set the padding length, i.e. the length to which a string result should be pre-pended with zeroes.

Protected Methods

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.