Author: joehni Date: Sat Jan 14 14:56:43 2006 New Revision: 369108 URL: http://svn.apache.org/viewcvs?rev=369108&view=rev Log: Start to clean-up javadoc.
Modified: jakarta/commons/sandbox/id/trunk/project.xml jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractLongIdentifierGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractStringIdentifierGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGeneratorFactory.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/LongIdentifierGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/StringIdentifierGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/random/SessionIdGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/AlphanumericGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/LongGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/NumericGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedAlphanumericGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedNumericGenerator.java jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedAlphanumericGeneratorTest.java jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGeneratorTest.java jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedNumericGeneratorTest.java Modified: jakarta/commons/sandbox/id/trunk/project.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/project.xml?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/project.xml (original) +++ jakarta/commons/sandbox/id/trunk/project.xml Sat Jan 14 14:56:43 2006 @@ -135,11 +135,12 @@ </contributors> <dependencies> - <!-- IdentifierGeneratorFactory only --> + <!-- IdentifierGeneratorFactory & VersionOneGenerator only --> <dependency> <id>commons-discovery</id> <version>0.2</version> </dependency> + <!-- Run-time dependency of commons-discovery --> <dependency> <id>commons-logging</id> <version>1.0.3</version> Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractLongIdentifierGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractLongIdentifierGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractLongIdentifierGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractLongIdentifierGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.apache.commons.id; /** - * <p>Abstract superclass for LongIdentifierGenerator implementations.</p> + * Abstract superclass for LongIdentifierGenerator implementations. * * @author Commons-Id team * @version $Id$ @@ -24,51 +24,41 @@ public abstract class AbstractLongIdentifierGenerator implements LongIdentifierGenerator { /** - * Constructor + * Constructor. */ protected AbstractLongIdentifierGenerator() { super(); } /** - * <p> Returns the maximum value for an identifier from this generator.</p> + * Returns the maximum value of an identifier from this generator. * * <p>The default implementation returns Long.MAX_VALUE. Implementations * whose identifiers are bounded below Long.MAX_VALUE should override this method to * return the maximum value of a generated identifier.</p> * - * @return the maximum identifier value + * @return [EMAIL PROTECTED] */ public long maxValue() { return Long.MAX_VALUE; } /** - * <p> Returns the minumum value for an identifier from this generator.</p> + * Returns the minimum value of an identifier from this generator. * * <p>The default implementation returns Long.MIN_VALUE. Implementations * whose identifiers are bounded above Long.MIN_VALUE should override this method to * return the minimum value of a generated identifier.</p> * - * @return the minimum identifier value + * @return [EMAIL PROTECTED] */ public long minValue() { return Long.MIN_VALUE; } - /** - * <p>Gets the next identifier in the sequence as an Object.</p> - * - * @return the next String identifier in sequence - */ public Object nextIdentifier() { return this.nextLongIdentifier(); } - /** - * <p>Gets the next identifier in the sequence.</p> - * - * @return the next Long identifier in sequence - */ public abstract Long nextLongIdentifier(); } Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractStringIdentifierGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractStringIdentifierGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractStringIdentifierGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/AbstractStringIdentifierGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 The Apache Software Foundation. + * Copyright 2002-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.apache.commons.id; /** - * <p>Abstract superclass for StringIdentifierGenerator implementations.</p> + * Abstract superclass for StringIdentifierGenerator implementations. * * @author Commons-Id team * @version $Id$ @@ -24,92 +24,76 @@ public abstract class AbstractStringIdentifierGenerator implements StringIdentifierGenerator { /** - * Constant representing unlimited identifier length, returned by [EMAIL PROTECTED] #maxLength()} - * when there is no upper bound to the length of an identifier in the sequence - */ - public static final int INFINITE_MAX_LENGTH = -1; - - /** - * Maximum length for a numeric string representing a long value + * Maximum length for a numeric string representing a long value. */ protected static final int MAX_LONG_NUMERIC_VALUE_LENGTH = Long.toString(Long.MIN_VALUE).length(); /** - * Number of alphanumeric characters + * Number of alphanumeric characters. */ protected static final int ALPHA_NUMERIC_CHARSET_SIZE = 36; /** - * Maximum length for an alphanumeric string representing a long value + * Maximum length for an alphanumeric string representing a long value. */ protected static final int MAX_LONG_ALPHANUMERIC_VALUE_LENGTH = Long.toString(Long.MAX_VALUE, ALPHA_NUMERIC_CHARSET_SIZE).length(); /** - * Maximum length for a numeric string representing an integer value + * Maximum length for a numeric string representing an integer value. */ protected static final int MAX_INT_NUMERIC_VALUE_LENGTH = Integer.toString(Integer.MIN_VALUE).length(); /** - * Maximum length for an alphanumeric string representing an integer value + * Maximum length for an alphanumeric string representing an integer value. */ protected static final int MAX_INT_ALPHANUMERIC_VALUE_LENGTH = Integer.toString(Integer.MAX_VALUE, ALPHA_NUMERIC_CHARSET_SIZE).length(); /** - * Default size of an alphanumeric identifier + * Default size of an alphanumeric identifier. */ protected static final int DEFAULT_ALPHANUMERIC_IDENTIFIER_SIZE = 15; /** - * Constructor + * Constructor. */ protected AbstractStringIdentifierGenerator() { super(); } - /** - * <p>Gets the next identifier in the sequence.</p> - * - * @return the next String identifier in sequence - */ public abstract String nextStringIdentifier(); /** - * <p>Returns the maximum length (number or characters) for an identifier - * from this sequence, or INFINITE_MAX_LENGTH if there is no upper bound to the length.</p> - * - * <p>The default implementation returns INFINITE_MAX_LENGTH. Implementations + * Returns the maximum length (number or characters) for an identifier + * from this sequence. + * + * <p>The default implementation returns [EMAIL PROTECTED] #INFINITE_MAX_LENGTH}. Implementations * with bounded length identifiers should override this method to * return the maximum length of a generated identifier.</p> * - * @return the maximum identifier length, or INFINITE_MAX_LENGTH if there is no upper bound + * @return [EMAIL PROTECTED] */ public long maxLength() { return INFINITE_MAX_LENGTH; } /** - * <p>Returns the minimum length (number of characters) for an identifier - * from this sequence.</p> + * Returns the minimum length (number of characters) for an identifier + * from this sequence. * * <p>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.</p> * - * @return the minimum identifier length + * @return [EMAIL PROTECTED] */ public long minLength() { return 0; } - /** - * <p>Gets the next identifier in the sequence as an Object.</p> - * - * @return the next identifier in sequence - */ public Object nextIdentifier() { return nextStringIdentifier(); } Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package org.apache.commons.id; /** - * <p><code>IdentifierGenerator</code> defines a simple interface for - * identifier generation.</p> + * <code>IdentifierGenerator</code> defines a simple interface for + * identifier generation. * * @author Commons-Id team * @version $Id$ @@ -25,7 +25,7 @@ public interface IdentifierGenerator { /** - * <p>Gets the next identifier in the sequence.</p> + * Gets the next identifier in the sequence. * * @return the next identifier in sequence */ Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGeneratorFactory.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGeneratorFactory.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGeneratorFactory.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/IdentifierGeneratorFactory.java Sat Jan 14 14:56:43 2006 @@ -21,7 +21,7 @@ import org.apache.commons.discovery.tools.DiscoverClass; /** - * <p>Abstract factory for identifier instances.</p> + * Abstract factory for identifier generator instances. * * <p>Use newInstance() to get a concrete factory instance. </p> * @@ -63,8 +63,8 @@ } /** - * <p>Gets a new [EMAIL PROTECTED] LongIdentifierGenerator} that generates - * a sequence of Long objects increasing in value.</p> + * Gets a new [EMAIL PROTECTED] LongIdentifierGenerator} that generates + * a sequence of Long objects increasing in value. * * <p>The sequence will wrap when the maximum <code>long</code> value is * reached and return negative numbers. It will start from zero.</p> @@ -74,8 +74,8 @@ public abstract LongIdentifierGenerator longGenerator(); /** - * <p>Gets a new [EMAIL PROTECTED] LongIdentifierGenerator} that generates - * a sequence of Long objects increasing in value.</p> + * Gets a new [EMAIL PROTECTED] LongIdentifierGenerator} that generates + * a sequence of Long objects increasing in value. * * @param wrap should the sequence wrap when it reaches the maximum * long value (or throw an [EMAIL PROTECTED] IllegalStateException}) @@ -85,8 +85,8 @@ public abstract LongIdentifierGenerator longGenerator(boolean wrap, long initialValue); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} - * that generates a sequence of String objects representing numbers increasing in size.</p> + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} + * that generates a sequence of String objects representing numbers increasing in size. * * <p>The sequence will wrap when the maximum <code>long</code> value is * reached and return negative numbers. It will start from zero.</p> @@ -96,8 +96,8 @@ public abstract StringIdentifierGenerator numericGenerator(); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence - * of String objects representing numbers increasing in size.</p> + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence + * of String objects representing numbers increasing in size. * * @param wrap should the sequence wrap when it reaches the maximum * long value (or throw an IllegalStateException) @@ -107,9 +107,9 @@ public abstract StringIdentifierGenerator numericGenerator(boolean wrap, long initialValue); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence * of String objects representing numbers increasing in size, prefixed by - * an initial string.</p> + * an initial string. * * @param prefix prefix, must not be null * @param wrap should the sequence wrap when it reaches the maximum @@ -122,11 +122,11 @@ prefixedNumericGenerator(String prefix, boolean wrap, long initialValue); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence * of String objects representing numbers increasing in size, prefixed by - * an initial string and left-padded to make all strings the same length</p> + * an initial string and left-padded to make all strings the same length. * - * @param prefix prefix, must not be null or empty + * @param prefix prefix, must not be null or empty * @param wrap should the factory wrap when it reaches the maximum * value that can be represented in <code>size</code> base 10 digits * (or throw an exception) @@ -139,9 +139,9 @@ prefixedLeftPaddedNumericGenerator(String prefix, boolean wrap, int size); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a * sequence of String objects representing numbers increasing in size - * in base-36.</p> + * in base-36. * * <p>The sequence will wrap when the maximum size (15) is reached.</p> * @@ -150,8 +150,8 @@ public abstract StringIdentifierGenerator alphanumericGenerator(); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates an - * incrementing number in base 36 with a prefix as a String object.</p> + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates an + * incrementing number in base 36 with a prefix as a String object. * * @param prefix prefix, must not be null * @param wrap should the factory wrap when it reaches the maximum @@ -166,43 +166,39 @@ prefixedAlphanumericGenerator(String prefix, boolean wrap, int size); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence of String objects - * representing numbers increasing in size in base-36.</p> + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence of String objects + * representing numbers increasing in size in base-36. * * @param wrap should the factory wrap when it reaches the maximum * size (or throw an IllegalStateException) * @param size the number of characters the id should fill - * * @return a new StringIdentifierGenerator */ public abstract StringIdentifierGenerator alphanumericGenerator(boolean wrap, int size); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence of String objects - * representing numbers increasing in size in base-36, starting at an initial value.</p> + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence of String objects + * representing numbers increasing in size in base-36, starting at an initial value. * * @param wrap should the factory wrap when it reaches the maximum * size (or throw an IllegalStateException) * @param initialValue the initial value to start at - * * @return a new StringIdentifierGenerator */ public abstract StringIdentifierGenerator alphanumericGenerator(boolean wrap, String initialValue); /** - * <p>Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence of String objects - * that appear to be random and are suitable for use as session identifiers.</p> - * - * + * Gets a new [EMAIL PROTECTED] StringIdentifierGenerator} that generates a sequence of String objects + * that appear to be random and are suitable for use as session identifiers. + * * @return a new StringIdentifierGenerator */ public abstract StringIdentifierGenerator sessionIdGenerator(); /** - * <p>Gets a new [EMAIL PROTECTED] IdentifierGenerator} that generates version one UUID objects + * Gets a new [EMAIL PROTECTED] IdentifierGenerator} that generates version one UUID objects * that conform to the <a href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt"> - * IETF Draft UUID specification</a>.</p> - * + * IETF Draft UUID specification</a>. * * @return a new IdentifierGenerator that generates version one UUIDs. * @throws NoSuchMethodException exception thrown while instantiating the generator. @@ -214,10 +210,9 @@ IllegalAccessException, InstantiationException; /** - * <p>Gets a new [EMAIL PROTECTED] IdentifierGenerator} that generates version four UUID Obejcts that conform to the + * Gets a new [EMAIL PROTECTED] IdentifierGenerator} that generates version four UUID Obejcts that conform to the * <a href="http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-02.txt"> - * IETF Draft UUID specification</a>.</p> - * + * IETF Draft UUID specification</a>. * * @return a new IdentifierGenerator that generates version four UUIDs. */ Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/LongIdentifierGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/LongIdentifierGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/LongIdentifierGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/LongIdentifierGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package org.apache.commons.id; /** - * <p><code>LongIdentifier</code> defines a simple interface for - * Long based identifier generation.</p> + * <code>LongIdentifier</code> defines a simple interface for + * Long based identifier generation. * * @author Commons-Id team * @version $Id$ @@ -25,21 +25,21 @@ public interface LongIdentifierGenerator extends IdentifierGenerator { /** - * <p>Gets the next identifier in the sequence.</p> + * Gets the next identifier in the sequence. * * @return the next Long identifier in sequence */ Long nextLongIdentifier(); /** - * <p>Returns the maximum value of an identifier from this generator.</p> + * Returns the maximum value of an identifier from this generator. * * @return the maximum identifier value */ long maxValue(); /** - * <p>Returns the minimum value of an identifier from this generator.</p> + * Returns the minimum value of an identifier from this generator. * * @return the minimum identifier value */ Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/StringIdentifierGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/StringIdentifierGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/StringIdentifierGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/StringIdentifierGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package org.apache.commons.id; /** - * <p><code>StringIdentifierGenerator</code> defines a simple interface for - * String based identifier generation.</p> + * <code>StringIdentifierGenerator</code> defines a simple interface for + * String based identifier generation. * * @author Commons-Id team * @since 2.0 @@ -26,31 +26,29 @@ public interface StringIdentifierGenerator extends IdentifierGenerator { /** - * <p>Gets the next identifier in the sequence.</p> + * Constant representing unlimited identifier length, returned by [EMAIL PROTECTED] #maxLength()} + * when there is no upper bound to the length of an identifier in the sequence + */ + public static final int INFINITE_MAX_LENGTH = -1; + + /** + * Gets the next identifier in the sequence. * * @return the next String identifier in sequence */ String nextStringIdentifier(); /** - * <p>Returns the maximum length (number or characters) for an identifier - * from this sequence, or INFINITE_MAX_LENGTH if there is no upper bound to the length.</p> + * Returns the maximum length (number or characters) for an identifier + * from this sequence. * - * <p>The default implementation returns INFINITE_MAX_LENGTH. Implementations - * with bounded length identifiers should override this method to - * return the maximum length of a generated identifier.</p> - * - * @return the maximum identifier length, or INFINITE_MAX_LENGTH if there is no upper bound + * @return the maximum identifier length, or [EMAIL PROTECTED] #INFINITE_MAX_LENGTH} if there is no upper bound */ long maxLength(); /** - * <p>Returns the minimum length (number of characters) for an identifier - * from this sequence.</p> - * - *<p>The default implementation returns 0. Implementations - * with bounded length identifiers should override this method to - * return the maximum length of a generated identifier.</p> + * Returns the minimum length (number of characters) for an identifier + * from this sequence. * * @return the minimum identifier length */ Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/random/SessionIdGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/random/SessionIdGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/random/SessionIdGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/random/SessionIdGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 The Apache Software Foundation. + * Copyright 2003-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,11 @@ import java.util.Random; /** - * <p><code>SessionIdGenerator</code> 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.</p> + * <code>SessionIdGenerator</code> is an identifier generator + * that generates an alphanumeric 10+ character identifier. + * + * <p>The exact length depends on the number of ids requested per time + * period. Multiple instances of the class generate still unique ids.</p> * * <p>Originally designed for JServ sessions. Uses synchronized count and * time to ensure uniqueness. Not guaranteed unique across JVMs, but @@ -70,35 +71,23 @@ private static Random randomizer = new Random(); /** - * <p>Constructor.</p> + * Constructor. */ public SessionIdGenerator() { super(); } - /** - * <p>Returns the maximum length (number or characters) for an identifier - * from this generator.</p> - * - * @return the maximum identifier length - */ public long maxLength() { return RANDOM_LENGTH + TIME_LENGTH + AbstractStringIdentifierGenerator.MAX_INT_ALPHANUMERIC_VALUE_LENGTH; } - /** - * <p>Returns the minimum length (number of characters) for an identifier - * from this generator.</p> - * - * @return the minimum identifier length - */ public long minLength() { return RANDOM_LENGTH + TIME_LENGTH + 1; } /** - * <p>Gets the next new identifier.</p> + * Gets the next new identifier. * * <p>Only guaranteed unique within this JVM, but fairly safe * for cross JVM usage as well.</p> Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/AlphanumericGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/AlphanumericGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/AlphanumericGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/AlphanumericGenerator.java Sat Jan 14 14:56:43 2006 @@ -19,9 +19,9 @@ import org.apache.commons.id.AbstractStringIdentifierGenerator; /** - * <p><code>AlphanumericGenerator</code> is an Identifier Generator + * <code>AlphanumericGenerator</code> is an identifier generator * that generates an incrementing number in base 36 as a String - * object.</p> + * object. * * <p>All generated ids have the same length (padding with 0's on the left), * which is determined by the <code>size</code> parameter passed to the constructor.<p> @@ -57,7 +57,7 @@ private static final char NINE_CHAR = '9'; /** - * <p>Constructor.</p> + * Constructor. * * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an exception) @@ -76,7 +76,7 @@ } /** - * <p>Constructor. The counter will start at the specified + * Construct with a counter, that will start at the specified * alphanumeric value.</p> * * @param wrap should the factory wrap when it reaches the maximum @@ -98,22 +98,10 @@ } } - /** - * <p>Returns the maximum length (number or characters) for an identifier - * from this sequence.</p> - * - * @return the maximum identifier length - */ public long maxLength() { return this.count.length; } - /** - * <p>Returns the minimum length (number of characters) for an identifier - * from this sequence.</p> - * - * @return the minimum identifier length - */ public long minLength() { return this.count.length; } @@ -121,7 +109,7 @@ /** * Getter for property wrap. * - * @return <code>true</code> iff this generator is set up to wrap. + * @return <code>true</code> if this generator is set up to wrap. * */ public boolean isWrap() { @@ -147,11 +135,6 @@ return this.count.length; } - /** - * <p>Gets the next new identifier.</p> - * - * @return a new identifier as a String - */ public synchronized String nextStringIdentifier() { for (int i = count.length - 1; i >= 0; i--) { switch (count[i]) { Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/LongGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/LongGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/LongGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/LongGenerator.java Sat Jan 14 14:56:43 2006 @@ -19,12 +19,12 @@ import org.apache.commons.id.AbstractLongIdentifierGenerator; /** - * <p><code>LongGenerator</code> is an Identifier Generator - * that generates an incrementing number as a Long object.</p> + * <code>LongGenerator</code> is an Identifier Generator + * that generates an incrementing number as a Long object. * * <p>If the <code>wrap</code> argument passed to the constructor is set to * <code>true</code>, the sequence will wrap, returning negative values when - * <code>Long.MAX_VALUE</code> reached; otherwise an <code>IllegalStateException</code> + * [EMAIL PROTECTED] Long#MAX_VALUE} reached; otherwise an [EMAIL PROTECTED] IllegalStateException} * will be thrown.</p> * * @author Commons-Id team @@ -36,8 +36,9 @@ private boolean wrapping; /** The counter. */ private long count = 0; + /** - * <p>Constructor.</p> + * Constructor. * * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an exception) @@ -52,7 +53,7 @@ /** * Getter for property wrap. * - * @return <code>true</code> iff this generator is set up to wrap. + * @return <code>true</code> if this generator is set up to wrap. * */ public boolean isWrap() { @@ -68,11 +69,7 @@ public void setWrap(boolean wrap) { this.wrapping = wrap; } - /** - * <p>Gets the next identifier in the sequence.</p> - * - * @return the next Long identifier in sequence - */ + public Long nextLongIdentifier() { long value = 0; if (wrapping) { Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/NumericGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/NumericGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/NumericGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/NumericGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation. + * Copyright 2003-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ * * <p>If the <code>wrap</code> argument passed to the constructor is set to * <code>true</code>, the sequence will wrap, returning negative values when - * <code>Long.MAX_VALUE</code> reached; otherwise an <code>IllegalStateException</code> + * [EMAIL PROTECTED] Long#MAX_VALUE} reached; otherwise an [EMAIL PROTECTED] IllegalStateException} * will be thrown.</p> * * @author Commons-Id team @@ -51,8 +51,11 @@ } /** - * <p>Returns the maximum length (number or characters) for an identifier - * from this sequence.</p> + * Returns the maximum length (number or characters) for an identifier + * from this sequence. + * + * <p>The maximum value is determined from the length of the string + * representation of [EMAIL PROTECTED] Long#MAX_VALUE}.</p> * * @return the maximum identifier length */ @@ -64,7 +67,7 @@ * <p>Returns the minimum length (number of characters) for an identifier * from this sequence.</p> * - * @return the minimum identifier length + * @return the minimum identifier length: <code>1</code> */ public long minLength() { return 1; @@ -73,7 +76,7 @@ /** * Getter for property wrap. * - * @return <code>true</code> iff this generator is set up to wrap. + * @return <code>true</code> if this generator is set up to wrap. * */ public boolean isWrap() { @@ -90,11 +93,6 @@ this.wrapping = wrap; } - /** - * <p>Gets the next new identifier.</p> - * - * @return a new identifier as a String - */ public String nextStringIdentifier() { long value = 0; if (wrapping) { Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedAlphanumericGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedAlphanumericGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedAlphanumericGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedAlphanumericGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,9 @@ package org.apache.commons.id.serial; /** - * <p><code>PrefixedAlphanumericGenerator</code> is an Identifier Generator + * <code>PrefixedAlphanumericGenerator</code> is an identifier generator * that generates an incrementing number in base 36 with a prefix as a String - * object.</p> + * object. * * <p>All generated ids have the same length (prefixed and padded with 0's * on the left), which is determined by the <code>size</code> parameter passed @@ -27,7 +27,7 @@ * <p>The <code>wrap</code> property determines whether or not the sequence wraps * when it reaches the largest value that can be represented in <code>size</code> * base 36 digits. If <code>wrap</code> is false and the the maximum representable - * value is exceeded, an IllegalStateException is thrown.</p> + * value is exceeded, an [EMAIL PROTECTED] IllegalStateException} is thrown.</p> * * @author Commons-Id team * @version $Id$ @@ -46,14 +46,14 @@ * value that can be represented in <code>size</code> base 36 digits * (or throw an exception) * @param size the size of the identifier, including prefix length - * @throws IllegalArgumentException if prefix is null or size less prefix - * length is not at least one + * @throws IllegalArgumentException if size less prefix length is not at least one + * @throws NullPointerException if prefix is <code>null</code> */ public PrefixedAlphanumericGenerator(String prefix, boolean wrap, int size) { super(wrap, size - ((prefix == null) ? 0 : prefix.length())); if (prefix == null) { - throw new IllegalArgumentException("prefix must not be null"); + throw new NullPointerException("prefix must not be null"); } if (size <= prefix.length()) { throw new IllegalArgumentException("size less prefix length must be at least one"); @@ -71,22 +71,18 @@ return prefix; } - /** @see AlphanumericGenerator */ public long maxLength() { return super.maxLength() + prefix.length(); } - /** @see AlphanumericGenerator */ public long minLength() { return super.minLength() + prefix.length(); } - /** @see AlphanumericGenerator */ public int getSize() { return super.getSize() + prefix.length(); } - /** @see AlphanumericGenerator */ public String nextStringIdentifier() { StringBuffer sb = new StringBuffer(prefix); sb.append(super.nextStringIdentifier()); Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ import org.apache.commons.id.AbstractStringIdentifierGenerator; /** - * <p><code>PrefixedLeftPaddedNumericGenerator</code> is an Identifier Generator - * that generates a left-padded incrementing number with a prefix as a String object.</p> + * <code>PrefixedLeftPaddedNumericGenerator</code> is an Identifier Generator + * that generates a left-padded incrementing number with a prefix as a String object. * * <p>All generated ids have the same length (prefixed and padded with 0's * on the left), which is determined by the <code>size</code> parameter passed @@ -28,7 +28,7 @@ * <p>The <code>wrap</code> property determines whether or not the sequence wraps * when it reaches the largest value that can be represented in <code>size</code> * base 10 digits. If <code>wrap</code> is false and the the maximum representable - * value is exceeded, an IllegalStateException is thrown.</p> + * value is exceeded, an [EMAIL PROTECTED] IllegalStateException} is thrown.</p> * * @author Commons-Id team * @version $Id$ @@ -56,14 +56,14 @@ * value that can be represented in <code>size</code> base 10 digits * (or throw an exception) * @param size the size of the identifier, including prefix length - * @throws IllegalArgumentException if prefix is null or size less prefix - * length is less than 1 + * @throws IllegalArgumentException if size less prefix length is not at least one + * @throws NullPointerException if prefix is <code>null</code> */ public PrefixedLeftPaddedNumericGenerator(String prefix, boolean wrap, int size) { super(); if (prefix == null) { - throw new IllegalArgumentException("prefix must not be null"); + throw new NullPointerException("prefix must not be null"); } if (size < 1) { throw new IllegalArgumentException("size must be at least one"); @@ -91,22 +91,10 @@ return prefix; } - /** - * <p>Returns the maximum length (number or characters) for an identifier - * from this sequence.</p> - * - * @return the maximum identifier length - */ public long maxLength() { return this.count.length + prefix.length(); } - /** - * <p>Returns the minimum length (number of characters) for an identifier - * from this sequence.</p> - * - * @return the minimum identifier length - */ public long minLength() { return this.count.length + prefix.length(); } @@ -123,7 +111,7 @@ /** * Getter for property wrap. * - * @return <code>true</code> iff this generator is set up to wrap + * @return <code>true</code> if this generator is set up to wrap */ public boolean isWrap() { return wrap; @@ -140,7 +128,6 @@ this.wrap = wrap; } - /** @see AbstractStringIdentifierGenerator */ public String nextStringIdentifier() { for (int i = count.length - 1; i >= 0; i--) { switch (count[i]) { Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedNumericGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedNumericGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedNumericGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/PrefixedNumericGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,13 @@ package org.apache.commons.id.serial; /** - * <p><code>PrefixedNumericGenerator</code> is an Identifier Generator - * that generates an incrementing number with a prefix as a String object.</p> + * <code>PrefixedNumericGenerator</code> is an Identifier Generator + * that generates an incrementing number with a prefix as a String object. * * <p>If the <code>wrap</code> argument passed to the constructor is set to * <code>true</code>, the sequence will wrap, returning negative values when - * <code>Long.MAX_VALUE</code> reached; otherwise an - * <code>IllegalStateException</code> will be thrown.</p> + * [EMAIL PROTECTED] Long#MAX_VALUE} reached; otherwise an [EMAIL PROTECTED] IllegalStateException} + * will be thrown.</p> * * @author Commons-Id team * @version $Id$ @@ -40,13 +40,13 @@ * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an exception) * @param initialValue the initial long value to start at - * @throws IllegalArgumentException if prefix is null + * @throws NullPointerException if prefix is <code>null</code> */ public PrefixedNumericGenerator(String prefix, boolean wrap, long initialValue) { super(wrap, initialValue); if (prefix == null) { - throw new IllegalArgumentException("prefix must not be null"); + throw new NullPointerException("prefix must not be null"); } this.prefix = prefix; } @@ -61,17 +61,14 @@ return prefix; } - /** @see NumericGenerator */ public long maxLength() { return super.maxLength() + prefix.length(); } - /** @see NumericGenerator */ public long minLength() { return super.minLength() + prefix.length(); } - /** @see NumericGenerator */ public String nextStringIdentifier() { StringBuffer sb = new StringBuffer(prefix); sb.append(super.nextStringIdentifier()); Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java (original) +++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,11 +23,10 @@ /** - * <p> * <code>TimeBasedAlphanumericIdentifierGenerator</code> is an Identifier Generator that generates * an alphanumeric identifier in base 36 as a String object from the current UTC time and an * internal counter. - * </p> + * <p> * The generator guarantees that all generated ids have an increasing natural sort order (even if * the time internally has an overflow). The implementation additionally guarantees, that all Modified: jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedAlphanumericGeneratorTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedAlphanumericGeneratorTest.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedAlphanumericGeneratorTest.java (original) +++ jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedAlphanumericGeneratorTest.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ PrefixedAlphanumericGenerator pag = new PrefixedAlphanumericGenerator(null, true, 15); fail("ctr(null,,) expected IllegalArgumentException"); } - catch (IllegalArgumentException e) + catch (NullPointerException e) { // expected } Modified: jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGeneratorTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGeneratorTest.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGeneratorTest.java (original) +++ jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedLeftPaddedNumericGeneratorTest.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ PrefixedLeftPaddedNumericGenerator plpag = new PrefixedLeftPaddedNumericGenerator(null, true, 15); fail("ctr(null,,) expected IllegalArgumentException"); } - catch (IllegalArgumentException e) + catch (NullPointerException e) { // expected } Modified: jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedNumericGeneratorTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedNumericGeneratorTest.java?rev=369108&r1=369107&r2=369108&view=diff ============================================================================== --- jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedNumericGeneratorTest.java (original) +++ jakarta/commons/sandbox/id/trunk/src/test/org/apache/commons/id/serial/PrefixedNumericGeneratorTest.java Sat Jan 14 14:56:43 2006 @@ -1,5 +1,5 @@ /* - * Copyright 2005 The Apache Software Foundation. + * Copyright 2005-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ PrefixedNumericGenerator png = new PrefixedNumericGenerator(null, true, 0l); fail("ctr(null,,) expected IllegalArgumentException"); } - catch (IllegalArgumentException e) + catch (NullPointerException e) { // expected } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]