Interface SparkClassUtils


public interface SparkClassUtils
  • Method Details

    • random

      Random random()
    • getSparkClassLoader

      ClassLoader getSparkClassLoader()
    • getContextOrSparkClassLoader

      ClassLoader getContextOrSparkClassLoader()
    • classForName

      <C> Class<C> classForName(String className, boolean initialize, boolean noSparkClassLoader)
      Preferred alternative to Class.forName(className), as well as Class.forName(className, initialize, loader) with current thread's ContextClassLoader.
      Parameters:
      className - (undocumented)
      initialize - (undocumented)
      noSparkClassLoader - (undocumented)
      Returns:
      (undocumented)
    • classIsLoadable

      boolean classIsLoadable(String clazz)
      Determines whether the provided class is loadable in the current thread.
    • classIsLoadableAndAssignableFrom

      boolean classIsLoadableAndAssignableFrom(String clazz, Class<?> targetClass)
      Determines whether the provided class is loadable in the current thread and assignable from the target class.

      Parameters:
      clazz - the fully qualified class name of the class to check for loadability and inheritance from parent
      targetClass - the target class which the class represented. If target is null, only checks if the class is loadable
      Returns:
      true if clazz is loadable and assignable from target, otherwise false
    • getFormattedClassName

      String getFormattedClassName(Object obj)
      Return the class name of the given object, removing all dollar signs
    • getSimpleName

      String getSimpleName(Class<?> cls)
      Safer than Class obj's getSimpleName which may throw Malformed class name error in scala. This method mimics scalatest's getSimpleNameOfAnObjectsClass.
      Parameters:
      cls - (undocumented)
      Returns:
      (undocumented)
    • stripPackages

      String stripPackages(String fullyQualifiedName)
      Remove the packages from full qualified class name
      Parameters:
      fullyQualifiedName - (undocumented)
      Returns:
      (undocumented)
    • stripDollars

      String stripDollars(String s)
      Remove trailing dollar signs from qualified class name, and return the trailing part after the last dollar sign in the middle
      Parameters:
      s - (undocumented)
      Returns:
      (undocumented)