|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.id.AbstractStringIdentifierGenerator org.apache.commons.id.serial.NumericGenerator
public class NumericGenerator
NumericIdentifierGenerator
is an Identifier Generator
that generates an incrementing number as a String object.
If the wrap
argument passed to the constructor is set to
true
, the sequence will wrap, returning negative values when
Long.MAX_VALUE
reached; otherwise an IllegalStateException
will be thrown.
Field Summary |
---|
Fields inherited from class org.apache.commons.id.AbstractStringIdentifierGenerator |
---|
ALPHA_NUMERIC_CHARSET_SIZE, DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE, MAX_INT_ALPHANUMERIC_VALUE_LENGTH, MAX_INT_NUMERIC_VALUE_LENGTH, MAX_LONG_ALPHANUMERIC_VALUE_LENGTH, MAX_LONG_NUMERIC_VALUE_LENGTH |
Fields inherited from interface org.apache.commons.id.StringIdentifierGenerator |
---|
INFINITE_MAX_LENGTH |
Constructor Summary | |
---|---|
NumericGenerator(boolean wrap,
long initialValue)
Constructor. |
Method Summary | |
---|---|
boolean |
isWrap()
Getter for property wrap. |
long |
maxLength()
Returns the maximum length (number or characters) for an identifier from this sequence. |
long |
minLength()
Returns the minimum length (number of characters) for an identifier from this sequence. |
java.lang.String |
nextStringIdentifier()
Gets the next identifier in the sequence. |
void |
setWrap(boolean wrap)
Sets the wrap property. |
Methods inherited from class org.apache.commons.id.AbstractStringIdentifierGenerator |
---|
nextIdentifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NumericGenerator(boolean wrap, long initialValue)
Constructor.
wrap
- should the factory wrap when it reaches the maximum
long value (or throw an exception)initialValue
- the initial long value to start atMethod Detail |
---|
public long maxLength()
The maximum value is determined from the length of the string
representation of Long.MAX_VALUE
.
maxLength
in interface StringIdentifierGenerator
maxLength
in class AbstractStringIdentifierGenerator
public long minLength()
Returns the minimum length (number of characters) for an identifier from this sequence.
minLength
in interface StringIdentifierGenerator
minLength
in class AbstractStringIdentifierGenerator
1
public boolean isWrap()
true
if this generator is set up to wrap.public void setWrap(boolean wrap)
wrap
- value for the wrap propertypublic java.lang.String nextStringIdentifier()
StringIdentifierGenerator
nextStringIdentifier
in interface StringIdentifierGenerator
nextStringIdentifier
in class AbstractStringIdentifierGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |