public final class

SequentialIDGenerator

extends AbstractIDGenerator
java.lang.Object
   ↳ org.apache.commons.betwixt.io.id.AbstractIDGenerator
     ↳ org.apache.commons.betwixt.io.id.SequentialIDGenerator

Class Overview

Generates ID's in numeric sequence. A simple counter is used. Every time that nextIdImpl() is called, this counter is incremented.

By default, the counter starts at zero. A user can set the initial value by using the SequentialIDGenerator(int) constructor.

Summary

Public Constructors
SequentialIDGenerator()
Base constructor.
SequentialIDGenerator(int start)
Constructor sets the start value for the counter.
Public Methods
int getCount()
Gets the current counter value
String nextIdImpl()
Increment counter and then return value.
[Expand]
Inherited Methods
From class org.apache.commons.betwixt.io.id.AbstractIDGenerator
From class java.lang.Object
From interface org.apache.commons.betwixt.io.IDGenerator

Public Constructors

public SequentialIDGenerator ()

Base constructor. Counter starts at zero.

public SequentialIDGenerator (int start)

Constructor sets the start value for the counter.

Note since the counter increments before returning the next value, first ID generated will be one more than the given start parameter.

Parameters
start start the counting at this value

Public Methods

public int getCount ()

Gets the current counter value

Returns
  • the last ID in the sequence

public String nextIdImpl ()

Increment counter and then return value.

Returns
  • one more than the current counter (converted to a string)