Replicant is a project mainly written in Scala, it's free.
Scala REPL tools
Replicant is a set of utilities intended to ease inspection of objects in the scala REPL. This is an 0.1 release, so it's currently
If you have bugs/requests/etc. please let me know
Replicant requires scala 2.8.1 (http://www.scala-lang.org/) and SBT (http://code.google.com/p/simple-build-tool/) if you want to build from source.
After cloning the project, run "sbt update package". This should create a jar file in target.
Once you have the jar, just add it to your scala classpath, e.g.
scala -cp replicant-0.1-SNAPSHOT.jar
Replicant provides a set of implicits in org.mccv.replicant.Replicant that you'll likely want to use. Just type
import org.mccv.replicant.Replicant._
To make them available
There are three high level commands available on any object.
scala> "s".m
res1: org.mccv.replicant.Methods =
=== methods from java.lang.String===
scala> "s".c
res2: org.mccv.replicant.Constructors =
=== methods from java.lang.String===
res3: org.mccv.replicant.Fields =
=== fields from java.lang.String===
F - value
F - offset
F - count
This is partial output. In the case of scala objects you may get a string hundreds (and hundreds) of lines long. Each method/field/constructor is displayed with a string representation of its modifiers, its name, and parameter types (for fields and constructors).
The complete list of possible modifier columns is...
AFIN-*+Ss|TV
Which correspond to abstract, final, interface, native, private, protected, public, static, strict, synchronized, transient and volatile.
Some objects have a ton of methods. Each replicant inspector takes a filter to restrict the set of displayed items. The default filter just passes everything through, but it's simple to apply additional filters. The following line finds all public methods that contain the term "index"
scala> "s".m.pub / "index"
res5: org.mccv.replicant.Methods =
=== methods from java.lang.String===
If you want to further restrict this to just methods that take a String argument, you can do that with
scala> "s".m.pub./("index").takes("String")
res6: org.mccv.replicant.Methods =
=== methods from java.lang.String===
Have a look at org.mccv.replicant.Replicant.scala for more predefined filters. You can also define your own like so:
scala> "s".m.filter(x => x.getName.endsWith("f"))
res9: org.mccv.replicant.Methods =
=== methods from java.lang.String===