Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Top level class "alias"

2 views
Skip to first unread message

Daryl Stultz

unread,
Jan 19, 2010, 4:05:55 PM1/19/10
to Rhino JS User List
Hello,

I'm currently inserting text like this before compiling my script:

"Bar = Packages." + foo.Bar.class.getName() + ";\n" + theScriptToRun

as a way to "alias" the Bar class. I'd prefer not to do it this way. I'm
currently trying to do this:

final FunctionObject functionObject = new FunctionObject("Bar",
Bar.class.getConstructor(), scope);
ScriptableObject.putProperty(scope, "Bar", functionObject);

The first line is failing with:
org.mozilla.javascript.EvaluatorException: Construction of objects of type
"foo.Bar" is not supported.

My ClassShutter allows access to foo.Bar. Anyone know what the problem is,
or how I can "import" classes into the top-level scope?

Thanks.

--Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com

0 new messages