Package org.apache.spark.util
Interface SparkClassUtils
public interface SparkClassUtils
-
Method Summary
Modifier and TypeMethodDescription<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.boolean
classIsLoadable
(String clazz) Determines whether the provided class is loadable in the current thread.boolean
isMemberClass
(Class<?> cls) Returns true if and only if the underlying class is a member class.random()
-
Method Details
-
random
Random random() -
getSparkClassLoader
ClassLoader getSparkClassLoader() -
getContextOrSparkClassLoader
ClassLoader getContextOrSparkClassLoader() -
classForName
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
Determines whether the provided class is loadable in the current thread. -
isMemberClass
Returns true if and only if the underlying class is a member class.Note: jdk8u throws a "Malformed class name" error if a given class is a deeply-nested inner class (See SPARK-34607 for details). This issue has already been fixed in jdk9+, so we can remove this helper method safely if we drop the support of jdk8u.
- Parameters:
cls
- (undocumented)- Returns:
- (undocumented)
-