Re: SUGGESTION to overcome Beanshell interfacing problem.

Patrick Niemeyer <[email protected]> Thu, 28 Oct 2004 16:33:03 -0500
Newsgroups gmane.comp.java.beanshell.user,gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
On Oct 28, 2004, at 3:28 PM, Colbert Philippe wrote:

> This is a follow-up to the email reporting Beanshell intefacing 
> shortcoming.
> Let me suggest the following solution
>
> PROBLEM:  We have java class MyHouse with two simple interfaces 1) 
> interface
> Door with 1 method 2) interface Window with one method also.  The 
> problem is
> that Beanshell does not allow one to create an instance of MyHouse with
> methods from both interfaces implemented in Beanshell.

Hi,

Well, you are correct that in the scripted form there is currently no 
syntax for this, but there are two solutions:

1) In version 2.x you should be able to write a regular Java class 
using standard Java syntax:

class MyHouse implements Door, Window { ... }

But bsh 2.x is still in beta.

2) There is a mechanism for getting the interface not documented well, 
using a 'this' reference.   e..g

// script
method1() { }
method2() { }
interface = this.getInterface( new Class[] { i1.class, i2.class } );

The Interpreter should have the new getInterface() method as well at 
some point.  I'm not sure what syntax we'd use to represent this in the 
scripted form.


Pat



-------------------------------------------------------
This Newsletter Sponsored by: Macrovision 
For reliable Linux application installations, use the industry's leading
setup authoring tool, InstallShield X. Learn more and evaluate 
today. http://clk.atdmt.com/MSI/go/ins0030000001msi/direct/01/