Hello,

I don't understand...  I would like to use the class (methods) from Java 
not from Javascript.  Ideally, the compiler would create a class that 
would contain all or some of the functions exposed as methods.  For example:


Javascript:
   function sum1(a, b) {
       return a+b;
   }

   function times(a, b) {
       return a*b;
   }

jsc generates "simple.class"

Java:

   ...
     private void junk(int a, int b) {
        return simple.sum(a, b);
     }
   ...

Can this be done with JavaAdapter?


-Edwin S. Ramirez-

Norris Boyd wrote:
> On Jan 31, 11:12 am, [EMAIL PROTECTED] wrote:
>> Hello,
>>
>> Is it possible to expose a script's functions as methods of the class
>> when compiling Javascript to a Java class?  If yes, how?
>>
>> Reason:
>>
>> I would like to use Javascript functions as SQL functions within Oracle
>> triggers, avoiding recoding these in PL/SQL.  Oracle allows for public
>> methods within Java classes to be used for this purpose.
>>
>> I am able to compile the Javascript using jsc but the functions are not
>> directly (as far as I can tell) available from Java.
>>
>> Thanks,
>> -Edwin S. Ramirez-
> 
> If you create a Java interface with the methods you want to expose,
> then you can create a JavaAdapter in Rhino. The JavaAdapter can then
> be used to have JavaScript objects implement  the interface you
> defined, and calls to that interface's methods will be resolved to
> functions in your object.
> 
> --N
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to