Interface InstructionBuilder

  • All Known Implementing Classes:
    InstructionBuilderImpl

    public interface InstructionBuilder
    Simplifies the generation of method instructions for a particular method (or constructor), allowing bytecode to be created with a friendlier API that focuses on Java type names (names as they would appear in Java source) rather than JVM descriptors or internal names. In some limited cases, types may be specified as Java Class instances as well. In addition, there is good support for primitive type boxing and unboxing. Most methods return the same instance of InstructionBuilder, allowing for a "fluid" API. More complex functionality, such as try/catch blocks, is more like a DSL (domain specific language), and is based on callbacks. This looks better in Groovy and will be more reasonable once JDK 1.8 closures are available; in the meantime, it means some deeply nested inner classes, but helps ensure that correct bytecode is generated and helps to limit the amount of bookkeeping is necessary on the part of code using InstructionBuilder.