Top Description Fields Constructors Methods
org.springframework.jdbc.support.incrementer

public abstract Class AbstractDataFieldMaxValueIncrementer

extends Object
implements DataFieldMaxValueIncrementer, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer
Known Direct Subclasses
org.springframework.jdbc.support.incrementer.AbstractSequenceMaxValueIncrementer, org.springframework.jdbc.support.incrementer.AbstractColumnMaxValueIncrementer
Imports
javax.sql.DataSource, org.springframework.beans.factory.InitializingBean, org.springframework.dao.DataAccessException, org.springframework.util.Assert

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.
Authors
Dmitriy Kopylenko, Juergen Hoeller, Jean-Pierre Pawlak

Field Summary

Modifier and TypeField and Description
private DataSource
private String
incrementerName

The name of the sequence/table containing the sequence.

protected int
paddingLength

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

Constructor Summary

AccessConstructor and Description
public
AbstractDataFieldMaxValueIncrementer()

Default constructor for bean property style usage.

public
AbstractDataFieldMaxValueIncrementer(DataSource
the DataSource to use
dataSource
,
String
the name of the sequence/table to use
incrementerName
)

Convenience constructor.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, 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.

public DataSource
getDataSource()

Return the data source to retrieve the value from.

public String
getIncrementerName()

Return the name of the sequence/table.

protected abstract 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.
getNextKey
()

Determine the next key to use, as a long.

public int
getPaddingLength()

Return the padding length for String values.

public int
nextIntValue()

Implements org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextIntValue.

Increment the data store field's max value as int.
public long
nextLongValue()

Implements org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextLongValue.

Increment the data store field's max value as long.
public String
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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataSourceback to summary
private DataSource dataSource
incrementerNameback to summary
private String incrementerName

The name of the sequence/table containing the sequence.

paddingLengthback to summary
protected int paddingLength

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

Constructor Detail

AbstractDataFieldMaxValueIncrementerback to summary
public AbstractDataFieldMaxValueIncrementer()

Default constructor for bean property style usage.

See Also
setDataSource, setIncrementerName
AbstractDataFieldMaxValueIncrementerback to summary
public AbstractDataFieldMaxValueIncrementer(DataSource dataSource, String incrementerName)

Convenience constructor.

Parameters
dataSource:DataSource

the DataSource to use

incrementerName:String

the name of the sequence/table to use

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, 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.

Annotations
@Override
getDataSourceback to summary
public DataSource getDataSource()

Return the data source to retrieve the value from.

getIncrementerNameback to summary
public String getIncrementerName()

Return the name of the sequence/table.

getNextKeyback to summary
protected abstract long getNextKey()

Determine the next key to use, as a long.

Returns: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.

getPaddingLengthback to summary
public int getPaddingLength()

Return the padding length for String values.

nextIntValueback to summary
public int nextIntValue() throws DataAccessException

Implements org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextIntValue.

Doc from org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextIntValue.

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

Returns:int

int next data store value such as max + 1

Annotations
@Override
Exceptions
DataAccessException:
in case of errors
nextLongValueback to summary
public long nextLongValue() throws DataAccessException

Implements org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextLongValue.

Doc from org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextLongValue.

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

Returns:long

int next data store value such as max + 1

Annotations
@Override
Exceptions
DataAccessException:
in case of errors
nextStringValueback to summary
public String nextStringValue() throws DataAccessException

Implements org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextStringValue.

Doc from org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer.nextStringValue.

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

Returns:String

next data store value such as max + 1

Annotations
@Override
Exceptions
DataAccessException:
in case of errors
setDataSourceback to summary
public void setDataSource(DataSource dataSource)

Set the data source to retrieve the value from.

setIncrementerNameback to summary
public void setIncrementerName(String incrementerName)

Set the name of the sequence/table.

setPaddingLengthback to summary
public void setPaddingLength(int paddingLength)

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