Javadoc null behaviour

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137437 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2003-07-16 00:39:05 +00:00
parent 861a4236aa
commit 0dd253a756
5 changed files with 68 additions and 49 deletions

View File

@ -62,7 +62,7 @@
* @author <a href="bayard@generationjava.com">Henri Yandell</a>
* @author Stephen Colebourne
* @since 1.0
* @version $Id: CharRange.java,v 1.6 2003/07/14 22:25:02 bayard Exp $
* @version $Id: CharRange.java,v 1.7 2003/07/16 00:39:05 scolebourne Exp $
*/
class CharRange {
@ -101,6 +101,7 @@ public CharRange(char start, char close) {
* @param start String start first character is in this range (inclusive).
* @param close String first character is close character in this
* range (inclusive).
* @throws NullPointerException if either String is <code>null</code>
*/
public CharRange(String start, String close) {
this.start = start.charAt(0);

View File

@ -59,7 +59,7 @@
* @author <a href="bayard@generationjava.com">Henri Yandell</a>
* @author Stephen Colebourne
* @since 1.0
* @version $Id: CharSetUtils.java,v 1.12 2003/07/14 22:25:02 bayard Exp $
* @version $Id: CharSetUtils.java,v 1.13 2003/07/16 00:39:05 scolebourne Exp $
*/
public class CharSetUtils {
@ -104,6 +104,8 @@ public static CharSet evaluateSet(String[] set) {
*
* @param str the string to work from
* @param set the character set to use for manipulation
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
*/
public static String squeeze(String str, String set) {
String[] strs = new String[1];
@ -123,8 +125,9 @@ public static String squeeze(String str, String set) {
*
* @param str the string to work from
* @param set the character set to use for manipulation
* @throws NullPointerException if <code>str</code> is
* <code>null</code>
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
* or any element is <code>null</code>
*/
public static String squeeze(String str, String[] set) {
CharSet chars = evaluateSet(set);
@ -157,6 +160,8 @@ public static String squeeze(String str, String[] set) {
*
* @param str String target to count characters in
* @param set String set of characters to count
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
*/
public static int count(String str, String set) {
String[] strs = new String[1];
@ -175,6 +180,9 @@ public static int count(String str, String set) {
*
* @param str String target to count characters in
* @param set String[] set of characters to count
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
* or any element is <code>null</code>
*/
public static int count(String str, String[] set) {
CharSet chars = evaluateSet(set);
@ -200,6 +208,8 @@ public static int count(String str, String[] set) {
*
* @param str String target to keep characters from
* @param set String set of characters to keep
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
*/
public static String keep(String str, String set) {
String[] strs = new String[1];
@ -219,8 +229,9 @@ public static String keep(String str, String set) {
*
* @param str String target to keep characters from
* @param set String[] set of characters to keep
* @throws NullPointerException of <code>str</code> is
* <code>null</code>
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
* or any element is <code>null</code>
*/
public static String keep(String str, String[] set) {
return modify(str, set, true);
@ -237,6 +248,8 @@ public static String keep(String str, String[] set) {
*
* @param str String target to delete characters from
* @param set String set of characters to delete
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
*/
public static String delete(String str, String set) {
String[] strs = new String[1];
@ -256,8 +269,9 @@ public static String delete(String str, String set) {
*
* @param str String target to delete characters from
* @param set String[] set of characters to delete
* @throws NullPointerException of <code>str</code> is
* <code>null</code>
* @throws NullPointerException if <code>str</code> is <code>null</code>
* @throws NullPointerException if <code>set</code> is <code>null</code>
* or any element is <code>null</code>
*/
public static String delete(String str, String[] set) {
return modify(str, set, false);

View File

@ -62,7 +62,7 @@
* @author Stephen Colebourne
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @since 2.0
* @version $Id: ClassUtils.java,v 1.13 2003/07/14 22:25:02 bayard Exp $
* @version $Id: ClassUtils.java,v 1.14 2003/07/16 00:39:05 scolebourne Exp $
*/
public class ClassUtils {
@ -102,7 +102,7 @@ public ClassUtils() {
/**
* <p>Gets the class name minus the package name for an <code>Object</code>.</p>
*
* @param object the class to get the short name for
* @param object the class to get the short name for, may be null
* @param valueIfNull the value to return if null
* @return the class name of the object without the package name, or the null value
*/
@ -158,7 +158,7 @@ public static String getShortClassName(String className) {
/**
* <p>Gets the package name of an <code>Object</code>.</p>
*
* @param object the class to get the package name for
* @param object the class to get the package name for, may be null
* @param valueIfNull the value to return if null
* @return the package name of the object, or the null value
*/

View File

@ -62,7 +62,7 @@
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author Stephen Colebourne
* @since 1.0
* @version $Id: ObjectUtils.java,v 1.9 2003/07/14 22:25:03 bayard Exp $
* @version $Id: ObjectUtils.java,v 1.10 2003/07/16 00:39:05 scolebourne Exp $
*/
public class ObjectUtils {
@ -101,8 +101,8 @@ public ObjectUtils() {
* <p>Returns a default value if the object passed is
* <code>null</code>.</p>
*
* @param object the <code>Object</code> to test
* @param defaultValue the default value to return
* @param object the <code>Object</code> to test, may be <code>null</code>
* @param defaultValue the default value to return, may be <code>null</code>
* @return <code>object</code> if it is not <code>null</code>, defaultValue otherwise
*/
public static Object defaultIfNull(Object object, Object defaultValue) {
@ -113,8 +113,8 @@ public static Object defaultIfNull(Object object, Object defaultValue) {
* <p>Compares two objects for equality, where either one or both
* objects may be <code>null</code>.</p>
*
* @param object1 the first object
* @param object2 the second object
* @param object1 the first object, may be <code>null</code>
* @param object2 the second object, may be <code>null</code>
* @return <code>true</code> if the values of both objects are the same
*/
public static boolean equals(Object object1, Object object2) {

View File

@ -65,7 +65,7 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Phil Steitz
* @since 1.0
* @version $Id: RandomStringUtils.java,v 1.15 2003/07/08 22:06:35 scolebourne Exp $
* @version $Id: RandomStringUtils.java,v 1.16 2003/07/16 00:39:05 scolebourne Exp $
*/
public class RandomStringUtils {
@ -93,7 +93,7 @@ public RandomStringUtils() {
*
* <p>Characters will be chosen from the set of all characters.</p>
*
* @param count length of random string to create
* @param count the length of random string to create
* @return the random string
*/
public static String random(int count) {
@ -107,7 +107,7 @@ public static String random(int count) {
* <p>Characters will be chosen from the set of characters whose
* ASCII value is between <code>32</code> and <code>126</code> (inclusive).</p>
*
* @param count length of random string to create
* @param count the length of random string to create
* @return the random string
*/
public static String randomAscii(int count) {
@ -121,7 +121,7 @@ public static String randomAscii(int count) {
* <p>Characters will be chosen from the set of alphabetic
* characters.</p>
*
* @param count length of random string to create
* @param count the length of random string to create
* @return the random string
*/
public static String randomAlphabetic(int count) {
@ -135,7 +135,7 @@ public static String randomAlphabetic(int count) {
* <p>Characters will be chosen from the set of alpha-numeric
* characters.</p>
*
* @param count length of random string to create
* @param count the length of random string to create
* @return the random string
*/
public static String randomAlphanumeric(int count) {
@ -149,7 +149,7 @@ public static String randomAlphanumeric(int count) {
* <p>Characters will be chosen from the set of numeric
* characters.</p>
*
* @param count length of random string to create
* @param count the length of random string to create
* @return the random string
*/
public static String randomNumeric(int count) {
@ -163,10 +163,10 @@ public static String randomNumeric(int count) {
* <p>Characters will be chosen from the set of alpha-numeric
* characters as indicated by the arguments.</p>
*
* @param count length of random string to create
* @param letters if <code>true</code>, generated string will include
* @param count the length of random string to create
* @param letters if <code>true</code>, generated string will include
* alphabetic characters
* @param numbers if <code>true</code>, generatd string will include
* @param numbers if <code>true</code>, generatd string will include
* numeric characters
* @return the random string
*/
@ -181,12 +181,12 @@ public static String random(int count, boolean letters, boolean numbers) {
* <p>Characters will be chosen from the set of alpha-numeric
* characters as indicated by the arguments.</p>
*
* @param count length of random string to create
* @param start position in set of chars to start at
* @param end position in set of chars to end before
* @param letters if <code>true</code>, generated string will include
* @param count the length of random string to create
* @param start the position in set of chars to start at
* @param end the position in set of chars to end before
* @param letters if <code>true</code>, generated string will include
* alphabetic characters
* @param numbers if <code>true</code>, generated string will include
* @param numbers if <code>true</code>, generated string will include
* numeric characters
* @return the random string
*/
@ -203,13 +203,13 @@ public static String random(int count, int start, int end, boolean letters, bool
* instead of using an externally supplied source of randomness, it uses
* the internal static {@link Random} instance ({@link #RANDOM}).</p>
*
* @param count length of random string to create
* @param start position in set of chars to start at
* @param end position in set of chars to end before
* @param letters only allow letters?
* @param numbers only allow numbers?
* @param set set of chars to choose randoms from. If <code>null</code>,
* then it will use the set of all chars.
* @param count the length of random string to create
* @param start the position in set of chars to start at
* @param end the position in set of chars to end before
* @param letters only allow letters?
* @param numbers only allow numbers?
* @param set the set of chars to choose randoms from.
* If <code>null</code>, then it will use the set of all chars.
* @return the random string
* @throws ArrayIndexOutOfBoundsException if there are not
* <code>(end - start) + 1</code> characters in the set array.
@ -236,14 +236,14 @@ public static String random(int count, int start, int end, boolean letters, bool
* usage of <code>RandomStringUtils</code> in situations that need
* repetitive behaviour.</p>
*
* @param count length of random string to create
* @param start position in set of chars to start at
* @param end position in set of chars to end before
* @param letters only allow letters?
* @param numbers only allow numbers?
* @param set set of chars to choose randoms from. If <code>null</code>,
* then it will use the set of all chars.
* @param random source of randomness.
* @param count the length of random string to create
* @param start the position in set of chars to start at
* @param end the position in set of chars to end before
* @param letters only allow letters?
* @param numbers only allow numbers?
* @param set the set of chars to choose randoms from.
* If <code>null</code>, then it will use the set of all chars.
* @param random a source of randomness.
* @return the random string
* @throws ArrayIndexOutOfBoundsException if there are not
* <code>(end - start) + 1</code> characters in the set array.
@ -295,9 +295,11 @@ public static String random(int count, int start, int end, boolean letters, bool
* <p>Characters will be chosen from the set of characters
* specified.</p>
*
* @param count length of random string to create
* @param set String containing the set of characters to use
* @param count the length of random string to create
* @param set the String containing the set of characters to use,
* must not be <code>null</code>
* @return the random string
* @throws NullPointerException if the set is <code>null</code>
*/
public static String random(int count, String set) {
return random(count, set.toCharArray());
@ -309,9 +311,11 @@ public static String random(int count, String set) {
*
* <p>Characters will be chosen from the set of characters specified.</p>
*
* @param count length of random string to create
* @param set character array containing the set of characters to use
* @param count the length of random string to create
* @param set the character array containing the set of characters to use
* must not be <code>null</code>
* @return the random string
* @throws NullPointerException if the set is <code>null</code>
*/
public static String random(int count, char[] set) {
return random(count, 0, set.length, false, false, set);