jvm-visitor
This module extends kylestev/jvm.js
by
exposing classes used for traversing the contents of a ClassInfo
object from
jvm.js (a JavaScript representation of the JVM class file format) by utilizing
the Visitor Pattern.
Examples
Field Logging Visitor
;; // instantiate a new ClassVisitor objectlet visitor = ;// bind an event listener to the `visit-field` event whose callback is passed// a `ClassInfo` object as well as a `FieldInfo` object.visitor; // parse the jar contentsJar // called when the Promise returned from `Jar#unpack(string)` succeeds // catch any uncaught errors during this Promise chain and log them to the console ;
VerboseClassVisitor
jvm-visitor
ships with a verbose version of the default ClassVisitor
which
has the same interface for interacting with it and behaves the same way with
one caveat: it binds event listeners for each type of even that ClassVisitor
emits and prints out basic information about the class file when visited.
This can aid debugging efforts without hampering development time as you can
simply swap new ClassVisitor
references with new VerboseClassVisitor
in
your code -- even if you're binding your own event listeners on top of those
used by VerboseClassVisitor
.
;; let visitor = ; Jar ;