This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new 345bc18b4 Javadoc
345bc18b4 is described below
commit 345bc18b46f1df7d9495eba119757c71fb9678da
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Nov 18 12:55:49 2025 -0500
Javadoc
---
.../java/org/apache/commons/lang3/ClassUtils.java | 207 ++++++++++-----------
1 file changed, 103 insertions(+), 104 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java
b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index bc377bbec..38962488f 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -185,9 +185,9 @@ public static Comparator<Class<?>> comparator() {
* A new {@link List} is returned. {@code null} objects will be copied
into the returned list as {@code null}.
* </p>
*
- * @param classes the classes to change
- * @return a {@link List} of class names corresponding to the Class
objects, {@code null} if null input
- * @throws ClassCastException if {@code classes} contains a non-{@link
Class} entry
+ * @param classes the classes to change.
+ * @return a {@link List} of class names corresponding to the Class
objects, {@code null} if null input.
+ * @throws ClassCastException if {@code classes} contains a non-{@link
Class} entry.
*/
public static List<String> convertClassesToClassNames(final List<Class<?>>
classes) {
return classes == null ? null : classes.stream().map(e -> getName(e,
null)).collect(Collectors.toList());
@@ -201,9 +201,9 @@ public static List<String> convertClassesToClassNames(final
List<Class<?>> class
* class name in the {@link List} is {@code null}, {@code null} is stored
in the output {@link List}.
* </p>
*
- * @param classNames the classNames to change
- * @return a {@link List} of Class objects corresponding to the class
names, {@code null} if null input
- * @throws ClassCastException if classNames contains a non String entry
+ * @param classNames the classNames to change.
+ * @return a {@link List} of Class objects corresponding to the class
names, {@code null} if null input.
+ * @throws ClassCastException if classNames contains a non String entry.
*/
public static List<Class<?>> convertClassNamesToClasses(final List<String>
classNames) {
if (classNames == null) {
@@ -223,10 +223,10 @@ public static List<Class<?>>
convertClassNamesToClasses(final List<String> class
/**
* Gets the abbreviated name of a {@link Class}.
*
- * @param cls the class to get the abbreviated name for, may be {@code
null}
- * @param lengthHint the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len <= 0
+ * @param cls the class to get the abbreviated name for, may be {@code
null}.
+ * @param lengthHint the desired length of the abbreviated name.
+ * @return the abbreviated name or an empty string.
+ * @throws IllegalArgumentException if len <= 0.
* @see #getAbbreviatedName(String, int)
* @since 3.4
*/
@@ -303,11 +303,11 @@ public static String getAbbreviatedName(final Class<?>
cls, final int lengthHint
* </tr>
* </table>
*
- * @param className the className to get the abbreviated name for, may be
{@code null}
- * @param lengthHint the desired length of the abbreviated name
+ * @param className the className to get the abbreviated name for, may be
{@code null}.
+ * @param lengthHint the desired length of the abbreviated name.
* @return the abbreviated name or an empty string if the specified class
name is {@code null} or empty string. The
* abbreviated name may be longer than the desired length if it
cannot be abbreviated to the desired length.
- * @throws IllegalArgumentException if {@code len <= 0}
+ * @throws IllegalArgumentException if {@code len <= 0}.
* @since 3.4
*/
public static String getAbbreviatedName(final String className, final int
lengthHint) {
@@ -352,8 +352,8 @@ public static String getAbbreviatedName(final String
className, final int length
* maintained.
* </p>
*
- * @param cls the class to look up, may be {@code null}
- * @return the {@link List} of interfaces in order, {@code null} if null
input
+ * @param cls the class to look up, may be {@code null}.
+ * @return the {@link List} of interfaces in order, {@code null} if null
input.
*/
public static List<Class<?>> getAllInterfaces(final Class<?> cls) {
if (cls == null) {
@@ -367,8 +367,8 @@ public static List<Class<?>> getAllInterfaces(final
Class<?> cls) {
/**
* Gets the interfaces for the specified class.
*
- * @param cls the class to look up, may be {@code null}
- * @param interfacesFound the {@link Set} of interfaces for the class
+ * @param cls the class to look up, may be {@code null}.
+ * @param interfacesFound the {@link Set} of interfaces for the class.
*/
private static void getAllInterfaces(Class<?> cls, final HashSet<Class<?>>
interfacesFound) {
while (cls != null) {
@@ -385,8 +385,8 @@ private static void getAllInterfaces(Class<?> cls, final
HashSet<Class<?>> inter
/**
* Gets a {@link List} of superclasses for the given class.
*
- * @param cls the class to look up, may be {@code null}
- * @return the {@link List} of superclasses in order going up from this
one {@code null} if null input
+ * @param cls the class to look up, may be {@code null}.
+ * @return the {@link List} of superclasses in order going up from this
one {@code null} if null input.
*/
public static List<Class<?>> getAllSuperclasses(final Class<?> cls) {
if (cls == null) {
@@ -404,8 +404,8 @@ public static List<Class<?>> getAllSuperclasses(final
Class<?> cls) {
/**
* Gets the canonical class name for a {@link Class}.
*
- * @param cls the class for which to get the canonical class name; may be
null
- * @return the canonical name of the class, or the empty String
+ * @param cls the class for which to get the canonical class name; may be
null.
+ * @return the canonical name of the class, or the empty String.
* @since 3.7
* @see Class#getCanonicalName()
*/
@@ -416,9 +416,9 @@ public static String getCanonicalName(final Class<?> cls) {
/**
* Gets the canonical name for a {@link Class}.
*
- * @param cls the class for which to get the canonical class name; may be
null
- * @param valueIfNull the return value if null
- * @return the canonical name of the class, or {@code valueIfNull}
+ * @param cls the class for which to get the canonical class name; may be
null.
+ * @param valueIfNull the return value if null.
+ * @return the canonical name of the class, or {@code valueIfNull}.
* @since 3.7
* @see Class#getCanonicalName()
*/
@@ -433,8 +433,8 @@ public static String getCanonicalName(final Class<?> cls,
final String valueIfNu
/**
* Gets the canonical name for an {@link Object}.
*
- * @param object the object for which to get the canonical class name; may
be null
- * @return the canonical name of the object, or the empty String
+ * @param object the object for which to get the canonical class name; may
be null.
+ * @return the canonical name of the object, or the empty String.
* @since 3.7
* @see Class#getCanonicalName()
*/
@@ -445,9 +445,9 @@ public static String getCanonicalName(final Object object) {
/**
* Gets the canonical name for an {@link Object}.
*
- * @param object the object for which to get the canonical class name; may
be null
- * @param valueIfNull the return value if null
- * @return the canonical name of the object or {@code valueIfNull}
+ * @param object the object for which to get the canonical class name; may
be null.
+ * @param valueIfNull the return value if null.
+ * @return the canonical name of the object or {@code valueIfNull}.
* @since 3.7
* @see Class#getCanonicalName()
*/
@@ -478,7 +478,7 @@ public static String getCanonicalName(final Object object,
final String valueIfN
*
* @param name the name of class.
* @return canonical form of class name.
- * @throws IllegalArgumentException if the class name is invalid
+ * @throws IllegalArgumentException if the class name is invalid.
*/
private static String getCanonicalName(final String name) {
String className = StringUtils.deleteWhitespace(name);
@@ -635,8 +635,8 @@ public static <T> Class<T> getComponentType(final
Class<T[]> cls) {
/**
* Null-safe version of {@code cls.getName()}
*
- * @param cls the class for which to get the class name; may be null
- * @return the class name or the empty string in case the argument is
{@code null}
+ * @param cls the class for which to get the class name; may be null.
+ * @return the class name or the empty string in case the argument is
{@code null}.
* @since 3.7
* @see Class#getSimpleName()
*/
@@ -647,8 +647,8 @@ public static String getName(final Class<?> cls) {
/**
* Null-safe version of {@code cls.getName()}
*
- * @param cls the class for which to get the class name; may be null
- * @param valueIfNull the return value if the argument {@code cls} is
{@code null}
+ * @param cls the class for which to get the class name; may be null.
+ * @param valueIfNull the return value if the argument {@code cls} is
{@code null}.
* @return the class name or {@code valueIfNull}
* @since 3.7
* @see Class#getName()
@@ -664,8 +664,8 @@ static String getName(final Class<?> cls, final String
valueIfNull, final boolea
/**
* Null-safe version of {@code object.getClass().getName()}
*
- * @param object the object for which to get the class name; may be null
- * @return the class name or the empty String
+ * @param object the object for which to get the class name; may be null.
+ * @return the class name or the empty String.
* @since 3.7
* @see Class#getSimpleName()
*/
@@ -676,9 +676,9 @@ public static String getName(final Object object) {
/**
* Null-safe version of {@code object.getClass().getSimpleName()}
*
- * @param object the object for which to get the class name; may be null
- * @param valueIfNull the value to return if {@code object} is {@code null}
- * @return the class name or {@code valueIfNull}
+ * @param object the object for which to get the class name; may be null.
+ * @param valueIfNull the value to return if {@code object} is {@code
null}.
+ * @return the class name or {@code valueIfNull}.
* @since 3.0
* @see Class#getName()
*/
@@ -690,7 +690,7 @@ public static String getName(final Object object, final
String valueIfNull) {
* Gets the package name from the canonical name of a {@link Class}.
*
* @param cls the class to get the package name for, may be {@code null}.
- * @return the package name or an empty string
+ * @return the package name or an empty string.
* @since 2.4
*/
public static String getPackageCanonicalName(final Class<?> cls) {
@@ -703,9 +703,9 @@ public static String getPackageCanonicalName(final Class<?>
cls) {
/**
* Gets the package name from the class name of an {@link Object}.
*
- * @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
+ * @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.
* @since 2.4
*/
public static String getPackageCanonicalName(final Object object, final
String valueIfNull) {
@@ -725,8 +725,8 @@ public static String getPackageCanonicalName(final Object
object, final String v
* If the class is in the default package, return an empty string.
* </p>
*
- * @param name the name to get the package name for, may be {@code null}
- * @return the package name or an empty string
+ * @param name the name to get the package name for, may be {@code null}.
+ * @return the package name or an empty string.
* @since 2.4
*/
public static String getPackageCanonicalName(final String name) {
@@ -749,9 +749,9 @@ public static String getPackageName(final Class<?> cls) {
/**
* Gets the package name of an {@link Object}.
*
- * @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
+ * @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.
*/
public static String getPackageName(final Object object, final String
valueIfNull) {
if (object == null) {
@@ -815,14 +815,14 @@ static Class<?> getPrimitiveClass(final String className)
{
* Object result = method.invoke(set, new Object[]);}
* </pre>
*
- * @param cls the class to check, not null
- * @param methodName the name of the method
- * @param parameterTypes the list of parameters
- * @return the method
- * @throws NullPointerException if the class is null
- * @throws SecurityException if a security violation occurred
+ * @param cls the class to check, not null.
+ * @param methodName the name of the method.
+ * @param parameterTypes the list of parameters.
+ * @return the method.
+ * @throws NullPointerException if the class is null.
+ * @throws SecurityException if a security violation occurred.
* @throws NoSuchMethodException if the method is not found in the given
class or if the method doesn't conform with the
- * requirements
+ * requirements.
*/
public static Method getPublicMethod(final Class<?> cls, final String
methodName, final Class<?>... parameterTypes) throws NoSuchMethodException {
final Method declaredMethod = cls.getMethod(methodName,
parameterTypes);
@@ -851,8 +851,8 @@ public static Method getPublicMethod(final Class<?> cls,
final String methodName
/**
* Gets the canonical name minus the package name from a {@link Class}.
*
- * @param cls the class for which to get the short canonical class name;
may be null
- * @return the canonical name without the package name or an empty string
+ * @param cls the class for which to get the short canonical class name;
may be null.
+ * @return the canonical name without the package name or an empty string.
* @since 2.4
* @see Class#getCanonicalName()
*/
@@ -863,9 +863,9 @@ public static String getShortCanonicalName(final Class<?>
cls) {
/**
* Gets the canonical name minus the package name for an {@link Object}.
*
- * @param object the class to get the short name for, may be null
- * @param valueIfNull the value to return if null
- * @return the canonical name of the object without the package name, or
the null value
+ * @param object the class to get the short name for, may be null.
+ * @param valueIfNull the value to return if null.
+ * @return the canonical name of the object without the package name, or
the null value.
* @since 2.4
* @see Class#getCanonicalName()
*/
@@ -963,8 +963,8 @@ public static String getShortCanonicalName(final Object
object, final String val
* </tr>
* </table>
*
- * @param canonicalName the class name to get the short name for
- * @return the canonical name of the class without the package name or an
empty string
+ * @param canonicalName the class name to get the short name for.
+ * @return the canonical name of the class without the package name or an
empty string.
* @since 2.4
*/
public static String getShortCanonicalName(final String canonicalName) {
@@ -998,10 +998,10 @@ public static String getShortClassName(final Class<?>
cls) {
* {@link #getShortClassName(Class)} (see relevant notes there).
* </p>
*
- * @param object the class to get the short name for, may be {@code null}
- * @param valueIfNull the value to return if the object is {@code null}
+ * @param object the class to get the short name for, may be {@code null}.
+ * @param valueIfNull the value to return if the object is {@code null}.
* @return the class name of the object without the package name, or
{@code valueIfNull} if the argument {@code object}
- * is {@code null}
+ * is {@code null}.
*/
public static String getShortClassName(final Object object, final String
valueIfNull) {
if (object == null) {
@@ -1037,7 +1037,7 @@ public static String getShortClassName(final Object
object, final String valueIf
* </p>
*
* @param className the className to get the short name for. It has to be
formatted as returned by
- * {@code Class.getName()} and not {@code Class.getCanonicalName()}
+ * {@code Class.getName()} and not {@code Class.getCanonicalName()}.
* @return the class name of the class without the package name or an
empty string. If the class is an inner class then
* value contains the outer class or classes and the separator is
replaced to be {@code .} (dot) character.
*/
@@ -1072,8 +1072,8 @@ public static String getShortClassName(String className) {
/**
* Null-safe version of {@code cls.getSimpleName()}
*
- * @param cls the class for which to get the simple name; may be null
- * @return the simple class name or the empty string in case the argument
is {@code null}
+ * @param cls the class for which to get the simple name; may be null.
+ * @return the simple class name or the empty string in case the argument
is {@code null}.
* @since 3.0
* @see Class#getSimpleName()
*/
@@ -1084,9 +1084,9 @@ public static String getSimpleName(final Class<?> cls) {
/**
* Null-safe version of {@code cls.getSimpleName()}
*
- * @param cls the class for which to get the simple name; may be null
- * @param valueIfNull the value to return if null
- * @return the simple class name or {@code valueIfNull} if the argument
{@code cls} is {@code null}
+ * @param cls the class for which to get the simple name; may be null.
+ * @param valueIfNull the value to return if null.
+ * @return the simple class name or {@code valueIfNull} if the argument
{@code cls} is {@code null}.
* @since 3.0
* @see Class#getSimpleName()
*/
@@ -1105,8 +1105,8 @@ public static String getSimpleName(final Class<?> cls,
final String valueIfNull)
* in that case.
* </p>
*
- * @param object the object for which to get the simple class name; may be
null
- * @return the simple class name or the empty string in case the argument
is {@code null}
+ * @param object the object for which to get the simple class name; may be
null.
+ * @return the simple class name or the empty string in case the argument
is {@code null}.
* @since 3.7
* @see Class#getSimpleName()
*/
@@ -1117,9 +1117,9 @@ public static String getSimpleName(final Object object) {
/**
* Null-safe version of {@code object.getClass().getSimpleName()}
*
- * @param object the object for which to get the simple class name; may be
null
- * @param valueIfNull the value to return if {@code object} is {@code null}
- * @return the simple class name or {@code valueIfNull} if the argument
{@code object} is {@code null}
+ * @param object the object for which to get the simple class name; may be
null.
+ * @param valueIfNull the value to return if {@code object} is {@code
null}.
+ * @return the simple class name or {@code valueIfNull} if the argument
{@code object} is {@code null}.
* @since 3.0
* @see Class#getSimpleName()
*/
@@ -1131,8 +1131,8 @@ public static String getSimpleName(final Object object,
final String valueIfNull
* Gets an {@link Iterable} that can iterate over a class hierarchy in
ascending (subclass to superclass) order,
* excluding interfaces.
*
- * @param type the type to get the class hierarchy from
- * @return Iterable an Iterable over the class hierarchy of the given class
+ * @param type the type to get the class hierarchy from.
+ * @return Iterable an Iterable over the class hierarchy of the given
class.
* @since 3.2
*/
public static Iterable<Class<?>> hierarchy(final Class<?> type) {
@@ -1142,9 +1142,9 @@ public static Iterable<Class<?>> hierarchy(final Class<?>
type) {
/**
* Gets an {@link Iterable} that can iterate over a class hierarchy in
ascending (subclass to superclass) order.
*
- * @param type the type to get the class hierarchy from
- * @param interfacesBehavior switch indicating whether to include or
exclude interfaces
- * @return Iterable an Iterable over the class hierarchy of the given class
+ * @param type the type to get the class hierarchy from.
+ * @param interfacesBehavior switch indicating whether to include or
exclude interfaces.
+ * @return Iterable an Iterable over the class hierarchy of the given
class.
* @since 3.2
*/
public static Iterable<Class<?>> hierarchy(final Class<?> type, final
Interfaces interfacesBehavior) {
@@ -1247,9 +1247,9 @@ private void walkInterfaces(final Set<Class<?>> addTo,
final Class<?> c) {
* VMs running Java versions > 1.5.
* </p>
*
- * @param cls the Class to check, may be null
- * @param toClass the Class to try to assign into, returns false if null
- * @return {@code true} if assignment possible
+ * @param cls the Class to check, may be null.
+ * @param toClass the Class to try to assign into, returns false if null.
+ * @return {@code true} if assignment possible.
*/
public static boolean isAssignable(final Class<?> cls, final Class<?>
toClass) {
return isAssignable(cls, toClass, true);
@@ -1280,10 +1280,10 @@ public static boolean isAssignable(final Class<?> cls,
final Class<?> toClass) {
* Specification</a></em>, sections 5.1.1, 5.1.2 and 5.1.4 for details.
* </p>
*
- * @param cls the Class to check, may be null
- * @param toClass the Class to try to assign into, returns false if null
- * @param autoboxing whether to use implicit autoboxing/unboxing between
primitives and wrappers
- * @return {@code true} if assignment possible
+ * @param cls the Class to check, may be null.
+ * @param toClass the Class to try to assign into, returns false if null.
+ * @param autoboxing whether to use implicit autoboxing/unboxing between
primitives and wrappers.
+ * @return {@code true} if assignment possible.
*/
public static boolean isAssignable(Class<?> cls, final Class<?> toClass,
final boolean autoboxing) {
if (toClass == null) {
@@ -1380,9 +1380,9 @@ public static boolean isAssignable(Class<?> cls, final
Class<?> toClass, final b
* VMs running Java versions > 1.5.
* </p>
*
- * @param classArray the array of Classes to check, may be {@code null}
- * @param toClassArray the array of Classes to try to assign into, may be
{@code null}
- * @return {@code true} if assignment possible
+ * @param classArray the array of Classes to check, may be {@code null}.
+ * @param toClassArray the array of Classes to try to assign into, may be
{@code null}.
+ * @return {@code true} if assignment possible.
*/
public static boolean isAssignable(final Class<?>[] classArray, final
Class<?>... toClassArray) {
return isAssignable(classArray, toClassArray, true);
@@ -1441,8 +1441,8 @@ public static boolean isAssignable(Class<?>[] classArray,
Class<?>[] toClassArra
/**
* Tests whether the specified class an inner class or static nested class.
*
- * @param cls the class to check, may be null
- * @return {@code true} if the class is an inner or static nested class,
false if not or {@code null}
+ * @param cls the class to check, may be null.
+ * @return {@code true} if the class is an inner or static nested class,
false if not or {@code null}.
*/
public static boolean isInnerClass(final Class<?> cls) {
return cls != null && cls.getEnclosingClass() != null;
@@ -1559,8 +1559,8 @@ private static String toCanonicalName(final String
className) {
* This method returns {@code null} for a {@code null} input array.
* </p>
*
- * @param array an {@link Object} array
- * @return a {@link Class} array, {@code null} if null array input
+ * @param array an {@link Object} array.
+ * @return a {@link Class} array, {@code null} if null array input.
* @since 2.4
*/
public static Class<?>[] toClass(final Object... array) {
@@ -1586,13 +1586,12 @@ public static Class<?>[] toClass(final Object... array)
{
* </p>
*
* @param runAheadTarget the target index (where the characters were
copied to) pointing after the last character copied
- * when the current part was copied
+ * when the current part was copied.
* @param source the source index (where the characters were copied from)
pointing after the last character copied when
- * the current part was copied
- * @param originalLength the original length of the class full name, which
is abbreviated
- * @param desiredLength the desired length of the abbreviated class name
- * @return {@code true} if it can be kept in its original length {@code
false} if the current part has to be abbreviated
- * and
+ * the current part was copied.
+ * @param originalLength the original length of the class full name, which
is abbreviated.
+ * @param desiredLength the desired length of the abbreviated class name.
+ * @return {@code true} if it can be kept in its original length; {@code
false} if the current part has to be abbreviated.
*/
private static boolean useFull(final int runAheadTarget, final int source,
final int originalLength, final int desiredLength) {
return source >= originalLength || runAheadTarget + originalLength -
source <= desiredLength;
@@ -1605,7 +1604,7 @@ private static boolean useFull(final int runAheadTarget,
final int source, final
* This method invokes {@code wrapperToPrimitive()} for each element of
the passed in array.
* </p>
*
- * @param classes the class array to convert, may be null or empty
+ * @param classes the class array to convert, may be null or empty.
* @return an array which contains for each given class, the primitive
class or <strong>null</strong> if the original class is not a wrapper class.
* {@code null} if null input. Empty array if an empty array
passed in.
* @see #wrapperToPrimitive(Class)
@@ -1630,8 +1629,8 @@ public static Class<?>[] wrappersToPrimitives(final
Class<?>... classes) {
* classes, or if the parameter is <strong>null</strong>, the return value
is <strong>null</strong>.
* </p>
*
- * @param cls the class to convert, may be <strong>null</strong>
- * @return the corresponding primitive type if {@code cls} is a wrapper
class, <strong>null</strong> otherwise
+ * @param cls the class to convert, may be <strong>null</strong>.
+ * @return the corresponding primitive type if {@code cls} is a wrapper
class, <strong>null</strong> otherwise.
* @see #primitiveToWrapper(Class)
* @since 2.4
*/