Jen is a high-level Java classworking toolkit that harnesses the power and performance of ASM in a convenient, easy to work with package. Jen makes classworking almost as simple as Collections, and is designed to provide all the flexibility of libraries like Cglib, while it's powerful SoftClass core, convenient support for common requirements right 'out of the box', high performance and full support for recent Java features such as generics and annotations make Jen an ideal solution for any kind of generation, at compile, run, or any other time!
Jen combines the best ideas from contemporary classworking solutions, from Cglib to Javassist and BCEL, while incorporating a few new ideas, convenient wrapping, and many advanced configurations, strategies, and defaults right off the bat. Jen's layered API, carefully following the principle of least surprise with sensible defaults throughout, modular packaging and the lack of runtime dependencies between Jen and the classes it creates (even when working with proxies) all help make Jen as usable, and widely applicable, as possible.
Jen's main features include
- Class-like core API - The SoftClass class is at the heart of Jen, and provides a mutable model of the Java class. A SoftClass instance can be created with a .class file, java.lang.Class instance, an ASM ClassNode, or empty to start from scratch, and can directly output any of the first three at any time, with a single method call.
- Runtime classworking support - Jen is ready for forthcoming developments in the next generation JVMs, and recognises the increasing shift toward metaprogramming techniques, thanks to extensive support for runtime generation and transformation built on top of the bytecode-based core.
- Works the way you do. Jen lets you get as close to, or stay as far away from, the bare internals of the JVM as you like - as well as full-flexibility of working with internal names and ASM Types, Jen provides complete support for transparently converting language names and Classes to and from binary names and Types on the fly.
- Many common patterns supported out of the box - The optional Jen Members and Jen Tools libraries provides many generally-applicable class member implementations, and utilities to support common patterns in classworking, and programming in general. In many cases these features allow Class creation and transformation with Jen to be achieved without ever 'thinking in bytecode'.
- Tight integration with ASM - Jen is designed to wrap ASM, not smother it, and in many areas ASM's advanced functionality is directly surfaced through the Jen implementation. This allows sophisticated ASM utilities such as the GeneratorAdapter to be used with great ease, making for an really easy time when you do need to generate a method to spec. With Jen (and ASM) you get total control, but never have to think in terms of target bytecode offsets and constant pool indices.
- Full support for Java 5 features - Jen fully supports generation of classes targeted at any specification version up to and including J5 (and beyond), and includes designed in support for new features such as annotations, generics, and autoboxing.
- Unbelievable performance - Java bytecode generation has gained an reputation for being slow and heavy, but the combination of ASM and Jen finally lay that image to rest. Jen is carefully designed an implemented to follow ASM's lead when it comes to performant classworking, with the result that everything from parsing a class file to accessing member information to generating methods is almost certainly much faster than you'd expect.
Jen is a lightweight, low dependency library, relying only on the ASM core, attrs, tree and commons libraries. ASM itself is designed to be lightweight, however, and introduces no further dependencies beyond the platform, making for a small, fast library that can slot in almost anywhere.URL: https://jen.dev.java.net/
Licence: Apache License