|
||||||||||
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.random.SessionIdGenerator
public class SessionIdGenerator
SessionIdGenerator
is an identifier generator
that generates an alphanumeric 10+ character identifier.
The exact length depends on the number of ids requested per time period. Multiple instances of the class generate still unique ids.
Originally designed for JServ sessions. Uses synchronized count and time to ensure uniqueness. Not guaranteed unique across JVMs, but fairly safe nonetheless.
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 | |
---|---|
SessionIdGenerator()
Constructor. |
Method Summary | |
---|---|
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 new identifier. |
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 SessionIdGenerator()
Method Detail |
---|
public long maxLength()
AbstractStringIdentifierGenerator
The default implementation returns StringIdentifierGenerator.INFINITE_MAX_LENGTH
. Implementations
with bounded length identifiers should override this method to
return the maximum length of a generated identifier.
maxLength
in interface StringIdentifierGenerator
maxLength
in class AbstractStringIdentifierGenerator
StringIdentifierGenerator.INFINITE_MAX_LENGTH
if there is no upper boundpublic long minLength()
AbstractStringIdentifierGenerator
The default implementation returns 0. Implementations with identifiers having a postive minimum length should override this method to return the maximum length of a generated identifier.
minLength
in interface StringIdentifierGenerator
minLength
in class AbstractStringIdentifierGenerator
public java.lang.String nextStringIdentifier()
Only guaranteed unique within this JVM, but fairly safe for cross JVM usage as well.
Format of identifier is
[6 chars random][3 chars time][1+ chars count]
nextStringIdentifier
in interface StringIdentifierGenerator
nextStringIdentifier
in class AbstractStringIdentifierGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |