Object

fm.common

ClassUtil

Related Doc: package common

Permalink

object ClassUtil extends Logging

This contains utility methods for scanning Classes or Files on the classpath.

Originally we used the classpath scanning functionality in the Spring Framework and then later switched to the Reflections library (https://code.google.com/p/reflections/) to avoid the dependency on Spring. At some point we ran into issues with the Reflections library not properly detecting classes so I ended up writing this as a replacement.

Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ClassUtil
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def classExists(cls: String, classLoader: ClassLoader = defaultClassLoader): Boolean

    Permalink

    Check if a class exists.

  6. def classpathContentLength(file: File, classLoader: ClassLoader): Long

    Permalink

    Lookup the legnth for a resource on the classpath

  7. def classpathContentLength(file: File): Long

    Permalink

    Lookup the legnth for a resource on the classpath

  8. def classpathContentLength(file: String, classLoader: ClassLoader): Long

    Permalink

    Lookup the legnth for a resource on the classpath

  9. def classpathContentLength(file: String): Long

    Permalink

    Lookup the legnth for a resource on the classpath

  10. def classpathDirExists(file: File, classLoader: ClassLoader): Boolean

    Permalink

    Check if a directory exists on the classpath

  11. def classpathDirExists(file: File): Boolean

    Permalink

    Check if a directory exists on the classpath

  12. def classpathDirExists(file: String, classLoader: ClassLoader): Boolean

    Permalink

    Check if a directory exists on the classpath

  13. def classpathDirExists(file: String): Boolean

    Permalink

    Check if a directory exists on the classpath

  14. def classpathFileExists(file: File, classLoader: ClassLoader): Boolean

    Permalink

    Check if a file exists on the classpath

  15. def classpathFileExists(file: File): Boolean

    Permalink

    Check if a file exists on the classpath

  16. def classpathFileExists(file: String, classLoader: ClassLoader): Boolean

    Permalink

    Check if a file exists on the classpath

  17. def classpathFileExists(file: String): Boolean

    Permalink

    Check if a file exists on the classpath

  18. def classpathLastModified(file: File, classLoader: ClassLoader): Long

    Permalink

    Lookup the lastModified timestamp for a resource on the classpath

  19. def classpathLastModified(file: File): Long

    Permalink

    Lookup the lastModified timestamp for a resource on the classpath

  20. def classpathLastModified(file: String, classLoader: ClassLoader): Long

    Permalink

    Lookup the lastModified timestamp for a resource on the classpath

  21. def classpathLastModified(file: String): Long

    Permalink

    Lookup the lastModified timestamp for a resource on the classpath

  22. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  23. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. def findAnnotatedClasses[T <: Annotation](basePackage: String, annotationClass: Class[T], classLoader: ClassLoader = defaultClassLoader): Set[Class[_]]

    Permalink

    Find all classes annotated with a Java Annotation.

    Find all classes annotated with a Java Annotation.

    Note: This loads ALL classes under the basePackage!

  26. def findClassNames(basePackage: String, classLoader: ClassLoader = defaultClassLoader): Set[String]

    Permalink

    Find all class names under the base package (includes anonymous/inner/objects etc...)

  27. def findClasspathFiles(basePackage: String, classLoader: ClassLoader = defaultClassLoader): Set[File]

    Permalink

    Recursively Find files on the classpath given a base package.

  28. def findImplementingClasses[T](basePackage: String, clazz: Class[T], classLoader: ClassLoader = defaultClassLoader): Set[Class[_ <: T]]

    Permalink

    Find all concrete classes that extend a trait/interface/class.

    Find all concrete classes that extend a trait/interface/class.

    Note: This loads ALL classes under the basePackage and uses Class.isAssignableFrom for checking.

  29. def findLoadedClass(cls: String, classLoader: ClassLoader = defaultClassLoader): Option[Class[_]]

    Permalink
  30. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  31. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  32. def isClassLoaded(cls: String, classLoader: ClassLoader = defaultClassLoader): Boolean

    Permalink

    Check if a class is loaded

  33. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  34. def listClasspathFiles(basePackage: String, classLoader: ClassLoader = defaultClassLoader): Set[File]

    Permalink

    Similar to File.listFiles() (i.e.

    Similar to File.listFiles() (i.e. a non-recursive findClassPathFiles)

  35. lazy val logger: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  36. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  37. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  38. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  39. def requireClass(cls: String, msg: ⇒ String, classLoader: ClassLoader = defaultClassLoader): Unit

    Permalink

    Check if a class exists.

    Check if a class exists. If it does not then a ClassNotFoundException is thrown.

  40. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  41. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  42. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped