Package org.apache.spark.util
Interface SparkClassUtils
public interface SparkClassUtils
- 
Method SummaryModifier 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.booleanclassIsLoadable(String clazz) Determines whether the provided class is loadable in the current thread.booleanclassIsLoadableAndAssignableFrom(String clazz, Class<?> targetClass) Determines whether the provided class is loadable in the current thread and assignable from the target class.Return the class name of the given object, removing all dollar signsgetSimpleName(Class<?> cls) Safer than Class obj's getSimpleName which may throw Malformed class name error in scala.random()Remove trailing dollar signs from qualified class name, and return the trailing part after the last dollar sign in the middlestripPackages(String fullyQualifiedName) Remove the packages from full qualified class name
- 
Method Details- 
randomRandom random()
- 
getSparkClassLoaderClassLoader getSparkClassLoader()
- 
getContextOrSparkClassLoaderClassLoader getContextOrSparkClassLoader()
- 
classForNamePreferred 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)
 
- 
classIsLoadableDetermines whether the provided class is loadable in the current thread.
- 
classIsLoadableAndAssignableFromDetermines 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 clazzis loadable and assignable fromtarget, otherwise false
 
- 
getFormattedClassNameReturn the class name of the given object, removing all dollar signs
- 
getSimpleNameSafer 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)
 
- 
stripPackagesRemove the packages from full qualified class name- Parameters:
- fullyQualifiedName- (undocumented)
- Returns:
- (undocumented)
 
- 
stripDollarsRemove 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)
 
 
-