|
||||||||||
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.ConstantIdentifierGenerator
public class ConstantIdentifierGenerator
StringIdentifierGenerator
that always returns the same
string. Use with CompositeIdentifierGenerator
to embed constant
string identifiers, or to add prefixes or suffixes.
Null constant values are not allowed. The default (assumed by the argumentless constructor) is an empty string.
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 | |
---|---|
ConstantIdentifierGenerator()
Creates a new ConstantIdentifierGenerator using the default (empty string) constant value. |
|
ConstantIdentifierGenerator(java.lang.String identifier)
Creates a new ConstantIdentifierGenerator using the given constant value. |
Method Summary | |
---|---|
static StringIdentifierGenerator |
getInstance(java.lang.String identifier)
Factory method to create a new ConstantIdentifierGenerator
with the given constant value. |
long |
maxLength()
Returns the length of the constant string returned by this generator. |
long |
minLength()
Returns the length of the constant string returned by this generator. |
java.lang.String |
nextStringIdentifier()
Gets the next identifier in the sequence. |
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 ConstantIdentifierGenerator()
public ConstantIdentifierGenerator(java.lang.String identifier)
Null constant values are not allowed.
identifier
- constant value returned by the generator. Must not
be null.
IllegalArgumentExeption
- if identifier is nullMethod Detail |
---|
public static StringIdentifierGenerator getInstance(java.lang.String identifier)
ConstantIdentifierGenerator
with the given constant value. Does not allow null values.
identifier
- constant value returned by the newly created generator.
Must not be null.
java.lang.IllegalArgumentException
- if identifier is nullpublic java.lang.String nextStringIdentifier()
StringIdentifierGenerator
nextStringIdentifier
in interface StringIdentifierGenerator
nextStringIdentifier
in class AbstractStringIdentifierGenerator
public long maxLength()
maxLength
in interface StringIdentifierGenerator
maxLength
in class AbstractStringIdentifierGenerator
public long minLength()
minLength
in interface StringIdentifierGenerator
minLength
in class AbstractStringIdentifierGenerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |