jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject dealing with reserved terms 'this', 'super'
Date Mon, 03 Feb 2003 22:09:13 GMT
I'm using BSF in a method of a class kinda like this:


public class Test{

     protected BSFManager manager = null;

     protected doulbe value;

     public Test()throws BSFException{

         manager = new BSFManager();

         manager.declareBean("this",this, this.getClass());
     }

     public Object myMethod(String script) throws BSFException{

        BSFEngine engine = manager.loadScriptingEngine("javascript");

        return engine.eval("my_generated_method",0, 0, script);

    }

    public void setValue(double value){
        this.value = value;
    }

    public double getVlaue(){
        return value;
    }
}

this idea is that I could write script that looks very much like java
code that would normally go into "myMethod". However, it appears that
words like "this" and "super" are reserved words. Is there anyway I can
get "this" to "reference the object instance of this class in my scripts?

I.E. I want a javascript that looks something like this to run an object
instance of this class.

{
this.setValue(0.04322*100);
this.getValue();
}

Is there a means to access this in BSF?

-Mark Diggory


---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-user-help@jakarta.apache.org



Mime
View raw message