|
||||||||||
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.CompositeIdentifierGenerator
public class CompositeIdentifierGenerator
Identifier generator that concatenates the results of a list of string identifier generators.
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 | |
---|---|
CompositeIdentifierGenerator(StringIdentifierGenerator[] identifierGenerators)
Constructor that does not check for nulls. |
Method Summary | |
---|---|
StringIdentifierGenerator[] |
getIdentifierGenerators()
Returns a (shallow) copy of the array of identifier generators concatenated by this generator. |
static StringIdentifierGenerator |
getInstance(java.util.Collection generators)
Create a new CompositeIdentifierGenerator that concatenates
the results of the provided collection of generators. |
static StringIdentifierGenerator |
getInstance(StringIdentifierGenerator[] generators)
Factory method to create a new CompositeIdentifierGenerator
from an input array of StringIdentifierGenerator instances. |
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.AbstractStringIdentifierGenerator |
---|
nextIdentifier |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompositeIdentifierGenerator(StringIdentifierGenerator[] identifierGenerators)
getInstance(StringIdentifierGenerator[])
to validate the input array.
identifierGenerators
- the identifier generators to concatenateMethod Detail |
---|
public static StringIdentifierGenerator getInstance(StringIdentifierGenerator[] generators)
CompositeIdentifierGenerator
from an input array of StringIdentifierGenerator
instances.
The input array is (shallow) copied - i.e., the object references in the input array are copied into a new array used internally. The array is expected to be non-empty and not to contain nulls.
generators
- the identifiers to concatenate, copied by reference
java.lang.IllegalArgumentException
- if the generators array is null
java.lang.IllegalArgumentException
- if any generator in the array is nullpublic static StringIdentifierGenerator getInstance(java.util.Collection generators)
CompositeIdentifierGenerator
that concatenates
the results of the provided collection of generators. Order is
determined by the iterator()
method on the collection.
generators
- a collection of string identifier generators to
concatenate
java.lang.IllegalArgumentException
- if the generators collection is null,
empty, or contains nullspublic java.lang.String nextStringIdentifier()
StringIdentifierGenerator
nextStringIdentifier
in interface StringIdentifierGenerator
nextStringIdentifier
in class AbstractStringIdentifierGenerator
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 StringIdentifierGenerator[] getIdentifierGenerators()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |