Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.torque.oid
Interface IdGenerator  view IdGenerator download IdGenerator.java

All Known Implementing Classes:
AutoIncrementIdGenerator, IDBroker, SequenceIdGenerator

public interface IdGenerator

Interface to be implemented by id generators. It is possible that some implementations might not require all the arguments, for example MySQL will not require a keyInfo Object, while the IDBroker implementation does not require a Connection as it only rarely needs one and retrieves a connection from the Connection pool service only when needed.

Version:
$Id: IdGenerator.java,v 1.7.4.2 2004/05/20 04:36:07 seade Exp $

Method Summary
 java.math.BigDecimal getIdAsBigDecimal(java.sql.Connection connection, java.lang.Object keyInfo)
          Returns an id as a BigDecimal.
 int getIdAsInt(java.sql.Connection connection, java.lang.Object keyInfo)
          Returns an id as a primitive int.
 long getIdAsLong(java.sql.Connection connection, java.lang.Object keyInfo)
          Returns an id as a primitive long.
 java.lang.String getIdAsString(java.sql.Connection connection, java.lang.Object keyInfo)
          Returns an id as a String.
 boolean isConnectionRequired()
          A flag to determine whether a Connection is required to generate an id.
 boolean isPostInsert()
          A flag to determine the timing of the id generation
 boolean isPriorToInsert()
          A flag to determine the timing of the id generation
 

Method Detail

getIdAsInt

public int getIdAsInt(java.sql.Connection connection,
                      java.lang.Object keyInfo)
               throws java.lang.Exception
Returns an id as a primitive int. If you use numeric identifiers, it's suggested that getIdAsLong(Connection, Object) 55 be used instead (due to the limitted range of this method).


getIdAsLong

public long getIdAsLong(java.sql.Connection connection,
                        java.lang.Object keyInfo)
                 throws java.lang.Exception
Returns an id as a primitive long.


getIdAsBigDecimal

public java.math.BigDecimal getIdAsBigDecimal(java.sql.Connection connection,
                                              java.lang.Object keyInfo)
                                       throws java.lang.Exception
Returns an id as a BigDecimal.


getIdAsString

public java.lang.String getIdAsString(java.sql.Connection connection,
                                      java.lang.Object keyInfo)
                               throws java.lang.Exception
Returns an id as a String.


isPriorToInsert

public boolean isPriorToInsert()
A flag to determine the timing of the id generation


isPostInsert

public boolean isPostInsert()
A flag to determine the timing of the id generation


isConnectionRequired

public boolean isConnectionRequired()
A flag to determine whether a Connection is required to generate an id.