|
||||||||||
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 org.apache.commons.id.serial.PrefixedNumericGenerator
public class PrefixedNumericGenerator
PrefixedNumericGenerator
is an Identifier Generator
that generates an incrementing number with a prefix 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 | |
---|---|
PrefixedNumericGenerator(java.lang.String prefix,
boolean wrap,
long initialValue)
Create a new prefixed numeric generator with the specified prefix. |
Method Summary | |
---|---|
java.lang.String |
getPrefix()
Return the prefix for this prefixed numeric generator. |
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. |
Methods inherited from class org.apache.commons.id.serial.NumericGenerator |
---|
isWrap, setWrap |
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 PrefixedNumericGenerator(java.lang.String prefix, boolean wrap, long initialValue)
prefix
- prefix, must not be nullwrap
- should the factory wrap when it reaches the maximum
long value (or throw an exception)initialValue
- the initial long value to start at
java.lang.NullPointerException
- if prefix is null
Method Detail |
---|
public java.lang.String getPrefix()
public long maxLength()
NumericGenerator
The maximum value is determined from the length of the string
representation of Long.MAX_VALUE
.
maxLength
in interface StringIdentifierGenerator
maxLength
in class NumericGenerator
public long minLength()
NumericGenerator
Returns the minimum length (number of characters) for an identifier from this sequence.
minLength
in interface StringIdentifierGenerator
minLength
in class NumericGenerator
1
public java.lang.String nextStringIdentifier()
StringIdentifierGenerator
nextStringIdentifier
in interface StringIdentifierGenerator
nextStringIdentifier
in class NumericGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |