com.interface21.jdbc.core.support
Class AbstractNextMaxValueProvider

java.lang.Object
  |
  +--com.interface21.jdbc.core.support.AbstractNextMaxValueProvider

public abstract class AbstractNextMaxValueProvider
extends java.lang.Object

Abstract implementation of Classes NextMaxValueProvider used as inner Class by several NextMaxValueProvider classes. It translates the key in different types: long, int, double and String. Subclasses should provide implementations of protected abstract method getNextKey(int).

Version:
$Id: AbstractNextMaxValueProvider.java,v 1.3 2003/05/21 18:09:48 pawlakjp Exp $
Author:
Jean-Pierre Pawlak, Isabelle Muszynski

Field Summary
protected  int paddingLength
          The length to which the string result should be pre-pended with zeroes
protected  boolean prefixWithZero
          Should the string result pre pre-pended with zeroes
 
Constructor Summary
AbstractNextMaxValueProvider()
           
 
Method Summary
protected  long getLongValue(SqlFunction sqlf, int type)
           
 double getNextDoubleValue()
           
 int getNextIntValue()
           
protected abstract  long getNextKey(int type)
          Give the key to use as a long.
 long getNextLongValue()
           
 java.lang.String getNextStringValue()
           
 void setPrefixWithZero(boolean prefixWithZero, int length)
          Sets the prefixWithZero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefixWithZero

protected boolean prefixWithZero
Should the string result pre pre-pended with zeroes

paddingLength

protected int paddingLength
The length to which the string result should be pre-pended with zeroes
Constructor Detail

AbstractNextMaxValueProvider

public AbstractNextMaxValueProvider()
Method Detail

getNextIntValue

public int getNextIntValue()

getNextLongValue

public long getNextLongValue()

getNextDoubleValue

public double getNextDoubleValue()

getNextStringValue

public java.lang.String getNextStringValue()

setPrefixWithZero

public void setPrefixWithZero(boolean prefixWithZero,
                              int length)
Sets the prefixWithZero.
Parameters:
prefixWithZero - The prefixWithZero to set

getNextKey

protected abstract long getNextKey(int type)
Give the key to use as a long.
Parameters:
type - The Sql type of the key in the database.
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.

getLongValue

protected long getLongValue(SqlFunction sqlf,
                            int type)
Parameters:
sqlf - The compiled SqlFunction
type - SqlType returned by the SqlFunction
Returns:
The result of the SqlFunction as a long


Rod Johnson and Spring contributors 2001-2003.