站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 varia API Documentation 英文版文档

AutoNumberFactory (Various API) - JBoss 4.0.1 sp1 varia API Documentation 英文版文档


org.jboss.varia.autonumber
Class AutoNumberFactory

java.lang.Object
  extended byorg.jboss.varia.autonumber.AutoNumberFactory

public class AutoNumberFactory
extends Object

AutoNumberFactory can persistently auto number items.

Version:
$Revision: 1.2 $
Author:
Michel de Groot

Constructor Summary
AutoNumberFactory()
           
 
Method Summary
static Integer getNextInteger(String collectionName)
          Gets the next key for the given collection.
static void resetAutoNumber(String collectionName)
          Resets the given autonumber to zero.
static void setAutoNumber(String collectionName, Integer value)
          Sets the given autonumber to the given value so that it starts counting at the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoNumberFactory

public AutoNumberFactory()
Method Detail

getNextInteger

public static Integer getNextInteger(String collectionName)
                              throws ArrayIndexOutOfBoundsException
Gets the next key for the given collection. Note 1: you must deploy EJB AutoNumber Note 2: the keys are persistent in your database, independent of the actual table Note 3: you can only add instances to the collection which have a key generated by this method, otherwise the keys are not guaranteed to be unique Note 4: key values are >= 0

Parameters:
collectionName - the name of the collection for which you want an autonumber
Throws:
ArrayIndexOutOfBoundsException - if no more numbers are available

resetAutoNumber

public static void resetAutoNumber(String collectionName)
Resets the given autonumber to zero. Use with extreme care!


setAutoNumber

public static void setAutoNumber(String collectionName,
                                 Integer value)
Sets the given autonumber to the given value so that it starts counting at the given value. Use with extreme care!



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.