## org.jboss.util
Class AutoNumberFactory

    java.lang.Object
      |
      +--org.jboss.util.AutoNumberFactory

public class AutoNumberFactory
extends java.lang.Object

AutoNumberFactory can persistently auto number items.

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

Constructor Summary
`AutoNumberFactory()`

Method Summary
`static java.lang.Integer` `getNextInteger(java.lang.String collectionName)` Gets the next key for the given collection.
`static void` `resetAutoNumber(java.lang.String collectionName)` Resets the given autonumber to zero.
`static void` `setAutoNumber(java.lang.String collectionName, java.lang.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 java.lang.Integer getNextInteger(java.lang.String collectionName)
                                            throws java.lang.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:
    `java.lang.ArrayIndexOutOfBoundsException` - if no more numbers are available

### resetAutoNumber

    public static void resetAutoNumber(java.lang.String collectionName)

  Resets the given autonumber to zero. Use with extreme care!

### setAutoNumber

    public static void setAutoNumber(java.lang.String collectionName,
                                     java.lang.Integer value)

  Sets the given autonumber to the given value so that it starts counting at the given value. Use with extreme care!

Copyright © 2000 The JBoss Organization. All Rights Reserved.