Class ObjectUtils

java.lang.Object
org.springframework.util.ObjectUtils

public abstract class ObjectUtils extends Object
Miscellaneous object utility methods.

Mainly for internal use within the framework.

Thanks to Alex Ruiz for contributing several enhancements to this class!

Since:
19.03.2004
Author:
Juergen Hoeller, Keith Donald, Rod Johnson, Rob Harrop, Chris Beams, Sam Brannen
See Also:
  • Constructor Details

    • ObjectUtils

      public ObjectUtils()
  • Method Details

    • isCheckedException

      public static boolean isCheckedException(Throwable ex)
      Return whether the given throwable is a checked exception: that is, neither a RuntimeException nor an Error.
      Parameters:
      ex - the throwable to check
      Returns:
      whether the throwable is a checked exception
      See Also:
    • isCompatibleWithThrowsClause

      public static boolean isCompatibleWithThrowsClause(Throwable ex, @Nullable Class<?>... declaredExceptions)
      Check whether the given exception is compatible with the specified exception types, as declared in a throws clause.
      Parameters:
      ex - the exception to check
      declaredExceptions - the exception types declared in the throws clause
      Returns:
      whether the given exception is compatible
    • isArray

      public static boolean isArray(@Nullable Object obj)
      Determine whether the given object is an array: either an Object array or a primitive array.
      Parameters:
      obj - the object to check
    • isEmpty

      public static boolean isEmpty(@Nullable Object[] array)
      Determine whether the given array is empty: i.e. null or of zero length.
      Parameters:
      array - the array to check
      See Also:
    • isEmpty

      public static boolean isEmpty(@Nullable Object obj)
      Determine whether the given object is empty.

      This method supports the following object types.