Re: Method completion
"Werner Schuster (murphee)" <[email protected]> Thu, 06 Apr 2006 14:40:29 +0200
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <[email protected]> |
WildDonkey wrote: >I'm trying to add some kind of method completion to the jconsole. >The basic idea was to use javap on the variable which then prints out the >filtered list matching the string between the . and the end of line. > > >kind of works but now I realise it's rather annoying not to be able to chain >methods as in: inst.methodA().methodB(a,b).methodC().TAB > > > Doesn't the jconsole run inside the same JVM as the code you want to execute? Then you won't need to use javap, but simply use reflection. Ie. ask bsh for the content of variable "inst", then use Reflection to get list of possible methods. If a method is chosen, you can query a Method object describing it, which will tell you it's return value, etc. For the chaining, you'll have to do some parsing... either - use the bsh parser (although that might not work for incomplete code like "foo.xxx().") - Or use a Hack that just looks for "." and "()" to search for method invocations. murphee -- Blog @ http://jroller.com/page/murphee Maintainer of EclipseShell @ http://eclipse-shell.sourceforge.net/ ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642