|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjodd.util.idgen.SimpleIdGenerator
public class SimpleIdGenerator
Simple synchronized int ids sequence generator. It takes the positive sequence range (boundaries are included). Optionally, it supports cycling, when counter reaches the max value. Otherwise an exception is thrown.
SimpleLongIdGenerator
Field Summary | |
---|---|
protected boolean |
cycle
|
protected int |
initialValue
|
protected int |
maxValue
|
protected int |
value
|
Constructor Summary | |
---|---|
SimpleIdGenerator()
Creates a new default cycled id generator. |
|
SimpleIdGenerator(int initialValue)
Creates a new cycled id generator with specified initial value. |
|
SimpleIdGenerator(int initialValue,
int maxValue)
Creates a new cycled id generator with specified range. |
|
SimpleIdGenerator(int initialValue,
int maxValue,
boolean cycle)
Creates a new id generator with specified range and cycling flag. |
Method Summary | |
---|---|
int |
next()
Returns the next value from the sequence. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile int value
protected int initialValue
protected int maxValue
protected boolean cycle
Constructor Detail |
---|
public SimpleIdGenerator()
public SimpleIdGenerator(int initialValue)
public SimpleIdGenerator(int initialValue, int maxValue)
public SimpleIdGenerator(int initialValue, int maxValue, boolean cycle)
Method Detail |
---|
public int next()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |