planetj.database.field
Class FieldIncrementor

java.lang.Object
  extended byplanetj.database.field.FieldIncrementor
All Implemented Interfaces:
IFieldIncrementor
Direct Known Subclasses:
WOWFieldIncrementor

public class FieldIncrementor
extends java.lang.Object
implements IFieldIncrementor

Used to obtain the "next value" of fields for which the auto-increment value is true


Constructor Summary
protected FieldIncrementor()
          FieldIncrementer constructor
 
Method Summary
 void clearValue(Field field)
          Clears the next value for the incrementor, which will force the incrementor to read the database to get the most current value.
protected  java.lang.Object findLastValue(Table pTable, Field pField)
          Queries the database for the maximum value in the specified column of the specified table
protected  java.lang.Object findLastValue(Table pTable, FieldDescriptorRow pFD)
          Queries the database for the maximum value in the specified column of the specified table
protected  java.lang.Object findLastValue(Table pTable, java.lang.String pFieldName)
          Deprecated. replaced by findLastValue (Table pTable, Field pField)
protected  java.lang.Object getInitialValue(java.lang.Class pType)
          Creates an object of the specified type containing its initial value.
 java.lang.Object getNextValue(Field pField)
          Gets the next value of a field for which the auto-increment value is true.
 java.lang.Object getNextValue(FieldDescriptorRow pFD)
          Gets the next value of a field for which the auto-increment value is true.
 java.lang.Object getNextValue(FieldDescriptorRow pFD, Table pTable)
          Gets the next value of a field for which the auto-increment value is true.
protected  java.lang.Object getNextValue(Table pTable, Field pField, java.lang.Class pClass)
          Gets the next value of a field for which the auto-increment value is true.
protected  java.lang.Object getNextValue(Table pTable, FieldDescriptorRow pFD, java.lang.Class pClass)
          Gets the next value of a field for which the auto-increment value is true.
protected  java.lang.Object getNextValue(Table pTable, FieldDescriptorRow pFD, Field pField, java.lang.Class pClass)
          Gets the next value of a field for which the auto-increment value is true.
protected  java.util.Map getNextValueMap(Table pTable)
          Gets the auto-increment Map for a Table
protected static java.lang.Object incrementValue(java.lang.Object pValue)
          Returns the result of incrementing the value that is passed in.
 void setLastValue(Field pField, java.lang.Object pLastValue)
          Sets the last value of a field for which the auto-increment value is true.
 void setNextValue(Field field, java.lang.Object nextValue)
          Sets the next value of a field for which the auto-increment value is true.
static IFieldIncrementor singleton()
          Returns the singleton instance of this class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldIncrementor

protected FieldIncrementor()
FieldIncrementer constructor

Method Detail

clearValue

public void clearValue(Field field)
                throws CMException
Clears the next value for the incrementor, which will force the incrementor to read the database to get the most current value.

Specified by:
clearValue in interface IFieldIncrementor
Throws:
CMException

findLastValue

protected java.lang.Object findLastValue(Table pTable,
                                         java.lang.String pFieldName)
                                  throws CMException
Deprecated. replaced by findLastValue (Table pTable, Field pField)

Queries the database for the maximum value in the specified column of the specified table

Throws:
CMException

findLastValue

protected java.lang.Object findLastValue(Table pTable,
                                         Field pField)
                                  throws CMException
Queries the database for the maximum value in the specified column of the specified table

Throws:
CMException

findLastValue

protected java.lang.Object findLastValue(Table pTable,
                                         FieldDescriptorRow pFD)
                                  throws CMException
Queries the database for the maximum value in the specified column of the specified table

Throws:
CMException

getInitialValue

protected java.lang.Object getInitialValue(java.lang.Class pType)
                                    throws CMException
Creates an object of the specified type containing its initial value. Typically the initial value is an object containing the value zero.

Throws:
CMException

getNextValue

public java.lang.Object getNextValue(Field pField)
                              throws CMException
Gets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:

Specified by:
getNextValue in interface IFieldIncrementor
Throws:
CMException

getNextValue

public java.lang.Object getNextValue(FieldDescriptorRow pFD,
                                     Table pTable)
                              throws CMException
Gets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:

Specified by:
getNextValue in interface IFieldIncrementor
Throws:
CMException

getNextValue

public java.lang.Object getNextValue(FieldDescriptorRow pFD)
                              throws CMException
Gets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:

Specified by:
getNextValue in interface IFieldIncrementor
Throws:
CMException

getNextValue

protected java.lang.Object getNextValue(Table pTable,
                                        Field pField,
                                        java.lang.Class pClass)
                                 throws CMException
Gets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:

Throws:
CMException

getNextValue

protected java.lang.Object getNextValue(Table pTable,
                                        FieldDescriptorRow pFD,
                                        java.lang.Class pClass)
                                 throws CMException
Gets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:

Throws:
CMException

getNextValue

protected java.lang.Object getNextValue(Table pTable,
                                        FieldDescriptorRow pFD,
                                        Field pField,
                                        java.lang.Class pClass)
                                 throws CMException
Gets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:

Throws:
CMException

getNextValueMap

protected java.util.Map getNextValueMap(Table pTable)
Gets the auto-increment Map for a Table


incrementValue

protected static java.lang.Object incrementValue(java.lang.Object pValue)
                                          throws DataEngineException
Returns the result of incrementing the value that is passed in. Currently the following types of values can be incremented:

Throws:
DataEngineException

setLastValue

public void setLastValue(Field pField,
                         java.lang.Object pLastValue)
                  throws CMException
Sets the last value of a field for which the auto-increment value is true. (The next value will be one more than the value passed in). Currently fields containing the following types of values can be incremented:
This method is invoked by the DataEngine - it should not be necessary for DataEngine users to invoke this method.

Specified by:
setLastValue in interface IFieldIncrementor
Throws:
CMException

setNextValue

public void setNextValue(Field field,
                         java.lang.Object nextValue)
                  throws CMException
Sets the next value of a field for which the auto-increment value is true. Currently fields containing the following types of values can be incremented:
This method is invoked by the DataEngine - it should not be necessary for DataEngine users to invoke this method.

Specified by:
setNextValue in interface IFieldIncrementor
Throws:
CMException

singleton

public static IFieldIncrementor singleton()
Returns the singleton instance of this class