Subj : How to use methods importClass and importPackage of class To : mozilla-jseng@mozilla.org From : hasan@savvion.com (S. Hasan Rizvi) Date : Thu Jul 17 2003 02:06 pm --------------883058DA3B2A5C705CA7DAC2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi : I am using Rhino1.5 release 4.1 and I have a doubt about the usage of methods importClass and importPackage of class ImporterTopLevel. I had a look at the api docs both methods expect 4 arguments. Also ApiDocs of these methods are no proper and don't give much detail. The API doc of the class has following explaination: This class can be used to create a top-level scope using the following code: Scriptable scope = new ImporterTopLevel(cx); Then JavaScript code will have access to the following methods: * importClass - will "import" a class by making its unqualified name available as a property of the top-level scope * importPackage - will "import" all the classes of the package by searching for unqualified names as classes qualified by the given package. The following code from the shell illustrates this use: js> importClass(java.io.File) js> f = new File('help.txt') help.txt js> importPackage(java.util) js> v = new Vector() [] Reading this explaination leavs lots of question marks, about the 1)argumets required to use the methods(importClass and importPackage) 2)What is code from the shell?? Do we have the overloaded version of these methods which just expects only one string Package/ClassName as agrument? Thanks -Hasan --------------883058DA3B2A5C705CA7DAC2 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi :
I am using Rhino1.5 release 4.1 and I have a doubt about the usage of
methods importClass and importPackage of class
ImporterTopLevel.
I had a look at the api docs both methods expect 4 arguments. Also
ApiDocs of these methods are no proper and don't give much
detail.
The API doc of the class has following explaination:
This class can be used to create a top-level scope using the following
code:
Scriptable scope = new ImporterTopLevel(cx);
Then JavaScript code will have access to the following methods:
The following code from the shell illustrates this use:
js> importClass(java.io.File)
js> f = new File('help.txt')
help.txt
js> importPackage(java.util)
js> v = new Vector()
[]
Reading this explaination leavs lots of question marks, about the
1)argumets required to use the methods(importClass and importPackage)
2)What is code from the shell??
Do we have the overloaded version of these methods which just expects
only one string Package/ClassName as agrument?
Thanks
-Hasan
--------------883058DA3B2A5C705CA7DAC2--
.