bmc / classutil   1.5.1

Website GitHub

Scala-friendly, fast class-finder library (using ASM under the covers)

Scala versions: 2.13 2.12 2.11

classutil: Fast class finder utilities, plus some extras

Build Status Maven Central

Introduction

The org.clapper.classutil (ClassUtil) library is a Scala package that provides various class location and class generation capabilities, including:

  • Methods to locate and filter classes quickly, at runtime—more quickly, in fact, than can be done with the JVM's runtime reflection capabilities.
  • Methods for converting Scala maps into Java Beans, on the fly—which can be useful when generating data for use with APIs (e.g., template APIs) that accept Java Beans, but not maps.

Under the covers, ClassUtil uses the ASM bytecode library, though it can be extended to use a different byte code library.

ClassUtil is fast for several reasons:

  • A bytecode library like ASM loads compiled bytecode without using a JVM class loader. So, it avoids all the class loader's overhead.
  • ClassUtil's class-finder methods load and return information about classes using an efficient lazy iterator, which offers minimal startup penalty and the ability to cut the traversal short.

Please see the full documentation on the library's home page for all the gory details, including caveats.

ClassUtil is copyright © 2010-2019 Brian M. Clapper.