public class DefaultUniqueTicketIdGenerator extends java.lang.Object implements UniqueTicketIdGenerator
UniqueTicketIdGenerator
. Implementation
utilizes a DefaultLongNumericGeneraor and a DefaultRandomStringGenerator to
construct the ticket id.
Tickets are of the form [PREFIX]-[SEQUENCE NUMBER]-[RANDOM STRING]-[SUFFIX]
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger
The logger instance.
|
Constructor and Description |
---|
DefaultUniqueTicketIdGenerator()
Creates an instance of DefaultUniqueTicketIdGenerator with default values
including a
DefaultLongNumericGenerator with a starting value of
1. |
DefaultUniqueTicketIdGenerator(int maxLength)
Creates an instance of DefaultUniqueTicketIdGenerator with a specified
maximum length for the random portion.
|
DefaultUniqueTicketIdGenerator(int maxLength,
java.lang.String suffix)
Creates an instance of DefaultUniqueTicketIdGenerator with a specified
maximum length for the random portion.
|
DefaultUniqueTicketIdGenerator(NumericGenerator numericGenerator,
RandomStringGenerator randomStringGenerator,
java.lang.String suffix)
Creates an instance of DefaultUniqueTicketIdGenerator with a specified
maximum length for the random portion.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getNewTicketId(java.lang.String prefix)
Return a new unique ticket id beginning with the prefix.
|
void |
setMaxLength(int maxLength)
Sets max length of id generation.
|
void |
setSuffix(java.lang.String suffix) |
public DefaultUniqueTicketIdGenerator()
DefaultLongNumericGenerator
with a starting value of
1.public DefaultUniqueTicketIdGenerator(int maxLength)
maxLength
- the maximum length of the random string used to generate
the id.public DefaultUniqueTicketIdGenerator(int maxLength, java.lang.String suffix)
maxLength
- the maximum length of the random string used to generate
the id.suffix
- the value to append at the end of the unique id to ensure
uniqueness across JVMs.public DefaultUniqueTicketIdGenerator(NumericGenerator numericGenerator, RandomStringGenerator randomStringGenerator, java.lang.String suffix)
numericGenerator
- the numeric generatorrandomStringGenerator
- the random string generatorsuffix
- the value to append at the end of the unique id to ensure
uniqueness across JVMs.public java.lang.String getNewTicketId(java.lang.String prefix)
UniqueTicketIdGenerator
getNewTicketId
in interface UniqueTicketIdGenerator
prefix
- The prefix we want attached to the ticket.public void setSuffix(java.lang.String suffix)
public void setMaxLength(int maxLength)
maxLength
- the max length