at.gv.egovernment.moa.spss.server.util
Class IdGenerator

java.lang.Object
  |
  +--at.gv.egovernment.moa.spss.server.util.IdGenerator

public class IdGenerator
extends Object

Generate unique ID values for various objects in the response.

Version:
$Id$
Author:
Patrick Peck

Constructor Summary
IdGenerator(String base, Set reserved)
          Create a new IdGenerator.
 
Method Summary
 String nextId()
          Create the next ID value in the sequence.
 String uniqueId()
          Create the next unique ID value which is unique in the reserved ID set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdGenerator

public IdGenerator(String base,
                   Set reserved)
Create a new IdGenerator.
Parameters:
base - A base value to append the IDs to. The creator of this object should provide a base value, so that appending the counter leads to unique IDs.
reserved - The Set of reserved IDs. A call to uniqueId() will respect the reserved IDs.
Method Detail

nextId

public String nextId()
Create the next ID value in the sequence.
Returns:
The next ID value in the sequence.

uniqueId

public String uniqueId()
Create the next unique ID value which is unique in the reserved ID set. The created ID is added to the set of reserved IDs.
Returns:
The next ID value.