org.apache.commons.id
Class AbstractStringIdentifierGenerator

java.lang.Object
  extended by org.apache.commons.id.AbstractStringIdentifierGenerator
All Implemented Interfaces:
IdentifierGenerator, StringIdentifierGenerator
Direct Known Subclasses:
AlphanumericGenerator, CompositeIdentifierGenerator, ConstantIdentifierGenerator, NumericGenerator, PrefixedLeftPaddedNumericGenerator, SessionIdGenerator, TimeBasedAlphanumericIdentifierGenerator

public abstract class AbstractStringIdentifierGenerator
extends java.lang.Object
implements StringIdentifierGenerator

Abstract superclass for StringIdentifierGenerator implementations.

Version:
$Id: AbstractStringIdentifierGenerator.java 480488 2006-11-29 08:57:26Z bayard $
Author:
Commons-Id team

Field Summary
protected static int ALPHA_NUMERIC_CHARSET_SIZE
          Number of alphanumeric characters.
protected static int DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE
          Default size of an alphanumeric identifier.
protected static int MAX_INT_ALPHANUMERIC_VALUE_LENGTH
          Maximum length for an alphanumeric string representing an integer value.
protected static int MAX_INT_NUMERIC_VALUE_LENGTH
          Maximum length for a numeric string representing an integer value.
protected static int MAX_LONG_ALPHANUMERIC_VALUE_LENGTH
          Maximum length for an alphanumeric string representing a long value.
protected static int MAX_LONG_NUMERIC_VALUE_LENGTH
          Maximum length for a numeric string representing a long value.
 
Fields inherited from interface org.apache.commons.id.StringIdentifierGenerator
INFINITE_MAX_LENGTH
 
Constructor Summary
protected AbstractStringIdentifierGenerator()
          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.Object nextIdentifier()
          Gets the next identifier in the sequence.
abstract  java.lang.String nextStringIdentifier()
          Gets the next identifier in the sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LONG_NUMERIC_VALUE_LENGTH

protected static final int MAX_LONG_NUMERIC_VALUE_LENGTH
Maximum length for a numeric string representing a long value.


ALPHA_NUMERIC_CHARSET_SIZE

protected static final int ALPHA_NUMERIC_CHARSET_SIZE
Number of alphanumeric characters.

See Also:
Constant Field Values

MAX_LONG_ALPHANUMERIC_VALUE_LENGTH

protected static final int MAX_LONG_ALPHANUMERIC_VALUE_LENGTH
Maximum length for an alphanumeric string representing a long value.


MAX_INT_NUMERIC_VALUE_LENGTH

protected static final int MAX_INT_NUMERIC_VALUE_LENGTH
Maximum length for a numeric string representing an integer value.


MAX_INT_ALPHANUMERIC_VALUE_LENGTH

protected static final int MAX_INT_ALPHANUMERIC_VALUE_LENGTH
Maximum length for an alphanumeric string representing an integer value.


DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE

protected static final int DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE
Default size of an alphanumeric identifier.

See Also:
Constant Field Values
Constructor Detail

AbstractStringIdentifierGenerator

protected AbstractStringIdentifierGenerator()
Constructor.

Method Detail

nextStringIdentifier

public abstract java.lang.String nextStringIdentifier()
Description copied from interface: StringIdentifierGenerator
Gets the next identifier in the sequence.

Specified by:
nextStringIdentifier in interface StringIdentifierGenerator
Returns:
the next String identifier in sequence

maxLength

public long maxLength()
Returns the maximum length (number or characters) for an identifier from this sequence.

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.

Specified by:
maxLength in interface StringIdentifierGenerator
Returns:
the maximum identifier length, or StringIdentifierGenerator.INFINITE_MAX_LENGTH if there is no upper bound

minLength

public long minLength()
Returns the minimum length (number of characters) for an identifier from this sequence.

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.

Specified by:
minLength in interface StringIdentifierGenerator
Returns:
the minimum identifier length

nextIdentifier

public java.lang.Object nextIdentifier()
Description copied from interface: IdentifierGenerator
Gets the next identifier in the sequence.

Specified by:
nextIdentifier in interface IdentifierGenerator
Returns:
the next identifier in sequence


Copyright © 2003-2008 The Apache Software Foundation. All Rights Reserved.