Javadoc fixes, from Fredrik Westermarck

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137129 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2002-11-14 22:29:25 +00:00
parent d739c20675
commit ce3c7cc62f
3 changed files with 178 additions and 174 deletions

View File

@ -64,7 +64,7 @@ import org.apache.commons.lang.builder.ToStringStyle;
*
* @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
* @author Moritz Petersen
* @version $Id: ArrayUtils.java,v 1.1 2002/10/13 22:42:06 scolebourne Exp $
* @version $Id: ArrayUtils.java,v 1.2 2002/11/14 22:29:25 scolebourne Exp $
*/
public class ArrayUtils {
@ -101,28 +101,28 @@ public class ArrayUtils {
//--------------------------------------------------------------------------
/**
* Outputs an array as a String, treating null as an empty array.
* Outputs an array as a String, treating <code>null</code> as an empty array.
* <p>
* Multi-dimensional arrays are handled correctly, including
* multi-dimensional primitive arrays.
* The format is that of Java source code, for example {a,b}.
*
* @param array the array to get a toString for, may not be null
* @return a String representation of the array, '{}' if null passed in
* @param array the array to get a toString for, may not be <code>null</code>
* @return a String representation of the array, '{}' if <code>null</code> passed in
*/
public static String toString(Object array) {
return toString(array, "{}");
}
/**
* Outputs an array as a String handling nulls.
* Outputs an array as a String handling <code>null</code>s.
* <p>
* Multi-dimensional arrays are handled correctly, including
* multi-dimensional primitive arrays.
* The format is that of Java source code, for example {a,b}.
*
* @param array the array to get a toString for, may be null
* @param stringIfNull the String to return if the array is null
* @param array the array to get a toString for, may be <code>null</code>
* @param stringIfNull the String to return if the array is <code>null</code>
* @return a String representation of the array
*/
public static String toString(Object array, String stringIfNull) {
@ -149,7 +149,7 @@ public class ArrayUtils {
* @param array an array whose elements are either a {@link Map.Entry} or
* an Array containing at least two elements
* @return a Map that was created from the array
* @throws IllegalArgumentException if the array is null
* @throws IllegalArgumentException if the array is <code>null</code>
* @throws IllegalArgumentException if one element of this Array is
* itself an Array containing less then two elements
* @throws IllegalArgumentException if the array contains elements other
@ -188,9 +188,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {1,2}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(long[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -202,9 +202,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {1,2}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(int[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -216,9 +216,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {1,2}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(short[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -230,9 +230,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {1,2}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(byte[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -244,9 +244,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {1.0,2.0}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(double[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -258,9 +258,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {1.0,2.0}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(float[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -272,9 +272,9 @@ public class ArrayUtils {
// * Multi-dimensional arrays are handled by the Object[] method.
// * The format is that of Java source code, for example {true,false}.
// *
// * @param array the array to get a toString for, must not be null
// * @param array the array to get a toString for, must not be <code>null</code>
// * @return a String representation of the array
// * @throws IllegalArgumentException if the array is null
// * @throws IllegalArgumentException if the array is <code>null</code>
// */
// public static String toString(boolean[] array) {
// return new ToStringBuilder(array, ToStringStyle.SIMPLE_STYLE).append(array).toString();
@ -283,12 +283,12 @@ public class ArrayUtils {
//--------------------------------------------------------------------------
/**
* Shallow clones an array returning a typecast result and handling null.
* Shallow clones an array returning a typecast result and handling <code>null</code>.
* <p>
* The objecs in the array are not cloned.
*
* @param array the array to shallow clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to shallow clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static Object[] clone(Object[] array) {
if (array == null) {
@ -298,10 +298,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static long[] clone(long[] array) {
if (array == null) {
@ -311,10 +311,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static int[] clone(int[] array) {
if (array == null) {
@ -324,10 +324,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static short[] clone(short[] array) {
if (array == null) {
@ -337,10 +337,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static byte[] clone(byte[] array) {
if (array == null) {
@ -350,10 +350,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static double[] clone(double[] array) {
if (array == null) {
@ -363,10 +363,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static float[] clone(float[] array) {
if (array == null) {
@ -376,10 +376,10 @@ public class ArrayUtils {
}
/**
* Clones an array returning a typecast result and handling null.
* Clones an array returning a typecast result and handling <code>null</code>.
*
* @param array the array to clone, may not be null
* @return the cloned array, or null if null passed in
* @param array the array to clone, may not be <code>null</code>
* @return the cloned array, or <code>null</code> if <code>null</code> passed in
*/
public static boolean[] clone(boolean[] array) {
if (array == null) {
@ -391,12 +391,13 @@ public class ArrayUtils {
//--------------------------------------------------------------------------
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(Object[] array1, Object[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -408,12 +409,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(long[] array1, long[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -425,12 +427,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(int[] array1, int[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -442,12 +445,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(short[] array1, short[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -459,12 +463,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(byte[] array1, byte[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -476,12 +481,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(double[] array1, double[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -493,12 +499,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(float[] array1, float[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -510,12 +517,13 @@ public class ArrayUtils {
}
/**
* Checks whether two arrays are the same length, treating null arrays as length 0.
* Checks whether two arrays are the same length, treating <code>null</code>
* arrays as length 0.
* Any multi-dimensional aspects of the arrays are ignored.
*
* @param array1 the first array, may be null
* @param array2 the second array, may be null
* @param true if length of arrays matches, treating null as an empty array
* @param array1 the first array, may be <code>null</code>
* @param array2 the second array, may be <code>null</code>
* @param true if length of arrays matches, treating <code>null</code> as an empty array
*/
public static boolean isSameLength(boolean[] array1, boolean[] array2) {
if ((array1 == null && array2 != null && array2.length > 0) ||
@ -530,10 +538,10 @@ public class ArrayUtils {
* Checks whether two arrays are the same type taking into account
* multi-dimensional arrays.
*
* @param array1 the first array, must not be null
* @param array2 the second array, must not be null
* @param array1 the first array, must not be <code>null</code>
* @param array2 the second array, must not be <code>null</code>
* @param true if type of arrays matches
* @throws IllegalArgumentException if either array is null
* @throws IllegalArgumentException if either array is <code>null</code>
*/
public static boolean isSameType(Object array1, Object array2) {
if (array1 == null || array2 == null) {

View File

@ -56,13 +56,12 @@ package org.apache.commons.lang;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
/**
* <code>ClassUtils</code> contains utility methods for working for
* classes without using reflection.
*
* @author <a href="mailto:scolebourne@apache.org">Stephen Colebourne</a>
* @version $Id: ClassUtils.java,v 1.3 2002/10/24 23:12:54 scolebourne Exp $
* @version $Id: ClassUtils.java,v 1.4 2002/11/14 22:29:25 scolebourne Exp $
*/
public class ClassUtils {
@ -80,9 +79,9 @@ public class ClassUtils {
/**
* Gets the class name minus the package name from a Class.
*
* @param cls the class to get the short name for, must not be null
* @param cls the class to get the short name for, must not be <code>null</code>
* @return the class name without the package name
* @throws IllegalArgumentException if the class is null
* @throws IllegalArgumentException if the class is <code>null</code>
*/
public static String getShortClassName(Class cls) {
if (cls == null) {
@ -94,9 +93,9 @@ public class ClassUtils {
/**
* Gets the class name minus the package name for an Object.
*
* @param object the class to get the short name for, must not be null
* @param object the class to get the short name for, must not be <code>null</code>
* @return the class name of the object without the package name
* @throws IllegalArgumentException if the object is null
* @throws IllegalArgumentException if the object is <code>null</code>
*/
public static String getShortClassName(Object object) {
if (object == null) {
@ -108,8 +107,7 @@ public class ClassUtils {
/**
* Gets the class name minus the package name from a String.
* <p>
* The string passed in is assumed to be a class name - it is not
* checked.
* The string passed in is assumed to be a class name - it is not checked.
*
* @param className the className to get the short name for, must not be empty
* @return the class name of the class without the package name
@ -136,9 +134,9 @@ public class ClassUtils {
/**
* Gets the package name of a Class.
*
* @param cls the class to get the package name for, must not be null
* @param cls the class to get the package name for, must not be <code>null</code>
* @return the package name
* @throws IllegalArgumentException if the class is null
* @throws IllegalArgumentException if the class is <code>null</code>
*/
public static String getPackageName(Class cls) {
if (cls == null) {
@ -150,9 +148,9 @@ public class ClassUtils {
/**
* Gets the package name of an Object.
*
* @param object the class to get the package name for, must not be null
* @param object the class to get the package name for, must not be <code>null</code>
* @return the package name
* @throws IllegalArgumentException if the object is null
* @throws IllegalArgumentException if the object is <code>null</code>
*/
public static String getPackageName(Object object) {
if (object == null) {
@ -164,8 +162,7 @@ public class ClassUtils {
/**
* Gets the package name from a String.
* <p>
* The string passed in is assumed to be a class name - it is not
* checked.
* The string passed in is assumed to be a class name - it is not checked.
*
* @param className the className to get the package name for, must not be empty
* @return the package name
@ -187,9 +184,9 @@ public class ClassUtils {
/**
* Gets a list of superclasses for the given class.
*
* @param cls the class to look up, must not be null
* @param cls the class to look up, must not be <code>null</code>
* @return the list of superclasses in order going up from this one
* @throws IllegalArgumentException if the class is null
* @throws IllegalArgumentException if the class is <code>null</code>
*/
public static List getAllSuperclasses(Class cls) {
if (cls == null) {
@ -211,9 +208,9 @@ public class ClassUtils {
* declared in the source file and following its hieracrchy up. Later
* duplicates are ignored, so the order is maintained.
*
* @param cls the class to look up, must not be null
* @param cls the class to look up, must not be <code>null</code>
* @return the list of interfaces in order
* @throws IllegalArgumentException if the class is null
* @throws IllegalArgumentException if the class is <code>null</code>
*/
public static List getAllInterfaces(Class cls) {
if (cls == null) {
@ -236,69 +233,69 @@ public class ClassUtils {
return list;
}
/**
* Gets a list of subclasses of the specified class.
* <p>
* This method searches the classpath to find all the subclasses
* of a particular class available. No classes are loaded, the
* returned list contains class names, not classes.
*
* @param cls the class to find subclasses for
* @return the list of subclass String class names
* @throws IllegalArgumentException if the class is null
*/
public static List getAllSubclassNames(Class cls) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
// TODO Use JavaWorld tip for searching the classpath
return null;
}
// /**
// * Gets a list of subclasses of the specified class.
// * <p>
// * This method searches the classpath to find all the subclasses
// * of a particular class available. No classes are loaded, the
// * returned list contains class names, not classes.
// *
// * @param cls the class to find subclasses for
// * @return the list of subclass String class names
// * @throws IllegalArgumentException if the class is <code>null</code>
// */
// public static List getAllSubclassNames(Class cls) {
// if (cls == null) {
// throw new IllegalArgumentException("The class must not be null");
// }
// // TODO Use JavaWorld tip for searching the classpath
// return null;
// }
/**
* Gets a list of subclasses of the specified class.
* <p>
* This method searches the classpath to find all the subclasses
* of a particular class available.
*
* @param cls the class to find subclasses for
* @return the list of subclasses
* @throws IllegalArgumentException if the class is null
*/
public static List getAllSubclasses(Class cls) {
List names = getAllSubclassNames(cls);
return convertClassNamesToClasses(names);
}
// /**
// * Gets a list of subclasses of the specified class.
// * <p>
// * This method searches the classpath to find all the subclasses
// * of a particular class available.
// *
// * @param cls the class to find subclasses for
// * @return the list of subclasses
// * @throws IllegalArgumentException if the class is <code>null</code>
// */
// public static List getAllSubclasses(Class cls) {
// List names = getAllSubclassNames(cls);
// return convertClassNamesToClasses(names);
// }
/**
* Gets a list of implementations of the specified interface.
* <p>
* This method searches the classpath to find all the implementations
* of a particular interface available. No classes are loaded, the
* returned list contains class names, not classes.
*
* @param cls the class to find sub classes for
* @return the list of implementation String class names
* @throws IllegalArgumentException if the class is null
*/
public static List getAllImplementationClassNames(Class cls) {
if (cls == null) {
throw new IllegalArgumentException("The class must not be null");
}
// TODO Use JavaWorld tip for searching the classpath
return null;
}
// /**
// * Gets a list of implementations of the specified interface.
// * <p>
// * This method searches the classpath to find all the implementations
// * of a particular interface available. No classes are loaded, the
// * returned list contains class names, not classes.
// *
// * @param cls the class to find sub classes for
// * @return the list of implementation String class names
// * @throws IllegalArgumentException if the class is <code>null</code>
// */
// public static List getAllImplementationClassNames(Class cls) {
// if (cls == null) {
// throw new IllegalArgumentException("The class must not be null");
// }
// // TODO Use JavaWorld tip for searching the classpath
// return null;
// }
/**
* Given a list of class names, this method converts them into classes.
* A new list is returned. If the class name cannot be found, null is
* stored in the list. If the class name in the list is null, null is
* stored in the output list.
* A new list is returned. If the class name cannot be found, <code>null</code>
* is stored in the list. If the class name in the list is <code>null</code>,
* <code>null</code> is stored in the output list.
*
* @param classes the classNames to change, the class is stored back
* into the list. null will be stored in the list if no class is found.
* @param classNames the classNames to change, the class is stored back
* into the list. <code>null</code> will be stored in the list if no class is found.
* @return the list of Class objects corresponding to the class names
* @throws IllegalArgumentException if the classNames is null
* @throws IllegalArgumentException if the classNames is <code>null</code>
*/
public static List convertClassNamesToClasses(List classNames) {
if (classNames == null) {
@ -323,7 +320,7 @@ public class ClassUtils {
* @param classes the classes to check
* @param superclass the superclass to check for
* @return the list of subclasses or implementations
* @throws IllegalArgumentException if the classes or superClass is null
* @throws IllegalArgumentException if the classes or superClass is <code>null</code>
*/
public static List getAssignableFrom(List classes, Class superclass) {
if (classes == null) {
@ -353,13 +350,13 @@ public class ClassUtils {
* reflection invocation.
* <p>
* Unlike the Class.isAssignableFrom method, this method takes into
* account widenings of primitive classes and nulls.
* account widenings of primitive classes and <code>null</code>s.
* <p>
* Primitive widenings allow an int to be assigned to a long, float or
* double. This method returns the correct result for these cases.
* <p>
* Null may be assigned to any reference type. This method will return
* true if null is passed in and the toClass is non-primitive.
* <code>Null</code> may be assigned to any reference type. This method will return
* true if <code>null</code> is passed in and the toClass is non-primitive.
* <p>
* Specifically, this method tests whether the type represented by the
* specified <code>Class</code> parameter can be converted to the type
@ -368,8 +365,8 @@ public class ClassUtils {
* <em>The Java Language Specification</em>, sections 5.1.1, 5.1.2 and
* 5.1.4 for details.
*
* @param classArray the array of Classes to check, may be null
* @param toClassArray the array of Classes to try to assign into, may be null
* @param classArray the array of Classes to check, may be <code>null</code>
* @param toClassArray the array of Classes to try to assign into, may be <code>null</code>
* @return true if assignment possible
*/
public static boolean isAssignable(Class[] classArray, Class[] toClassArray) {
@ -394,13 +391,13 @@ public class ClassUtils {
* Checks if one Class can be assigned to a variable of another Class.
* <p>
* Unlike the Class.isAssignableFrom method, this method takes into
* account widenings of primitive classes and nulls.
* account widenings of primitive classes and <code>null</code>s.
* <p>
* Primitive widenings allow an int to be assigned to a long, float or
* double. This method returns the correct result for these cases.
* <p>
* Null may be assigned to any reference type. This method will return
* true if null is passed in and the toClass is non-primitive.
* true if <code>null</code> is passed in and the toClass is non-primitive.
* <p>
* Specifically, this method tests whether the type represented by the
* specified <code>Class</code> parameter can be converted to the type
@ -409,10 +406,10 @@ public class ClassUtils {
* <em>The Java Language Specification</em>, sections 5.1.1, 5.1.2 and
* 5.1.4 for details.
*
* @param cls the Class to check, may be null
* @param toClass the Class to try to assign into, must not be null
* @param cls the Class to check, may be <code>null</code>
* @param toClass the Class to try to assign into, must not be <code>null</code>
* @return true if assignment possible
* @throws IllegalArgumentException if the toClass is null
* @throws IllegalArgumentException if the toClass is <code>null</code>
*/
public static boolean isAssignable(Class cls, Class toClass) {
if (toClass == null) {
@ -477,7 +474,7 @@ public class ClassUtils {
*
* @param cls the class to check
* @return true if the class is an inner or static nested class
* @throws IllegalArgumentException if the class is null
* @throws IllegalArgumentException if the class is <code>null</code>
*/
public static boolean isInnerClass(Class cls) {
if (cls == null) {

View File

@ -73,7 +73,7 @@ import java.util.Iterator;
* @author <a href="mailto:rand_mcneely@yahoo.com">Rand McNeely</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:fredrik@westermarck.com">Fredrik Westermarck</a>
* @version $Id: StringUtils.java,v 1.21 2002/10/28 04:33:29 bayard Exp $
* @version $Id: StringUtils.java,v 1.22 2002/11/14 22:29:25 scolebourne Exp $
*/
public class StringUtils {
@ -1524,8 +1524,8 @@ public class StringUtils {
//--------------------------------------------------------------------------
/**
* Return either the passed in Object, or if it is <code>null</code>,
* then an empty String.
* Returns either the passed in Object as a String, or,
* if the Object is <code>null</code>, an empty String.
*
* @param str the Object to check
* @return the passed in Object's toString, or blank if it was null
@ -1535,8 +1535,8 @@ public class StringUtils {
}
/**
* Return either the passed in Object, or if it is <code>null</code>,
* then a passed in default String.
* Returns either the passed in Object as a String, or,
* if the Object is <code>null</code>, a passed in default String.
*
* @param obj the Object to check
* @param defaultString the default String to return if str is null
@ -1550,8 +1550,7 @@ public class StringUtils {
//--------------------------------------------------------------------------
/**
* Reverse a String, <code>null</code> String returns
* <code>null</code>.
* Reverse a String, <code>null</code> String returns <code>null</code>.
*
* @param str the String to reverse
* @return the reversed String