Class ClassUtils

java.lang.Object
org.springframework.data.repository.util.ClassUtils

@Deprecated(since="3.5", forRemoval=true) public abstract class ClassUtils extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
since 3.5, use ClassUtils instead.
Utility class to work with classes.
Author:
Oliver Gierke, Mark Paluch, Johannes Englmeier
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    assertReturnTypeAssignable(Method method, Class<?>... types)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Asserts the given Method's return type to be one of the given types.
    static int
    static int
    getNumberOfOccurrences(Method method, Class<?> parameterType)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the number of occurrences for the given parameter type in the given Method.
    static boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns whether the given Method has a parameter that is assignable to the given type.
    static boolean
    hasParameterOfType(Method method, Class<?> type)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns whether the given Method has a parameter of the given type.
    static boolean
    hasProperty(Class<?> type, String property)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns whether the given class contains a property with the given name.
    static void
    ifPresent(String className, ClassLoader classLoader, Consumer<Class<?>> action)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Determine whether the Class identified by the supplied className is present * and can be loaded and call the action if the Class could be loaded.
    static boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns wthere the given type is the Repository interface.
    static boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns whether the given type name is a repository interface name.
    static boolean
    isOfType(Object object, Collection<Class<?>> types)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns whether the given object is of one of the given types.
    static void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Helper method to extract the original exception that can possibly occur during a reflection call.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • hasProperty

      public static boolean hasProperty(Class<?> type, String property)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns whether the given class contains a property with the given name.
      Parameters:
      type -
      property -
      Returns:
    • ifPresent

      public static void ifPresent(String className, @Nullable ClassLoader classLoader, Consumer<Class<?>> action)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Determine whether the Class identified by the supplied className is present * and can be loaded and call the action if the Class could be loaded.
      Parameters:
      className - the name of the class to check.
      classLoader - the class loader to use.
      action - the action callback to notify. (may be null which indicates the default class loader)
      Throws:
      IllegalStateException - if the corresponding class is resolvable but there was a readability mismatch in the inheritance hierarchy of the class (typically a missing dependency declaration in a Jigsaw module definition for a superclass or interface implemented by the class to be checked here)
    • isGenericRepositoryInterface

      public static boolean isGenericRepositoryInterface(Class<?> interfaze)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns wthere the given type is the Repository interface.
      Parameters:
      interfaze -
      Returns:
    • isGenericRepositoryInterface

      public static boolean isGenericRepositoryInterface(@Nullable String interfaceName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns whether the given type name is a repository interface name.
      Parameters:
      interfaceName -
      Returns:
    • getNumberOfOccurences

      public static int getNumberOfOccurences(Method method, Class<?> type)
    • getNumberOfOccurrences

      public static int getNumberOfOccurrences(@NonNull Method method, @NonNull Class<?> parameterType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the number of occurrences for the given parameter type in the given Method.
      Parameters:
      method - Method to evaluate.
      parameterType - Class of the Method parameter type to count.
      Returns:
      the number of occurrences for the given parameter type in the given Method.
      See Also:
    • assertReturnTypeAssignable

      public static void assertReturnTypeAssignable(Method method, Class<?>... types)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Asserts the given Method's return type to be one of the given types. Will unwrap known wrapper types before the assignment check (see QueryExecutionConverters).
      Parameters:
      method - must not be null.
      types - must not be null or empty.
    • isOfType

      public static boolean isOfType(@Nullable Object object, Collection<Class<?>> types)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns whether the given object is of one of the given types. Will return false for null.
      Parameters:
      object -
      types -
      Returns:
    • hasParameterOfType

      public static boolean hasParameterOfType(Method method, Class<?> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns whether the given Method has a parameter of the given type.
      Parameters:
      method -
      type -
      Returns:
    • hasParameterAssignableToType

      public static boolean hasParameterAssignableToType(Method method, Class<?> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns whether the given Method has a parameter that is assignable to the given type.
      Parameters:
      method -
      type -
      Returns:
    • unwrapReflectionException

      public static void unwrapReflectionException(Exception ex) throws Throwable
      Deprecated, for removal: This API element is subject to removal in a future version.
      Helper method to extract the original exception that can possibly occur during a reflection call.
      Parameters:
      ex -
      Throws:
      Throwable