Java 6 Scripting API vs Rhino

Apologies if this isn't the right place for this question, but I can't see a more appropriate forum.

I have some classes that use the Mozilla Rhino API for invoking javascript, and I was planning to upgrade this to use the new javax.script classes in Java 6. However, there's one particular feature that seems to be missing.

In Rhino, you invoke JS functions through the Function class (See http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/Function.html). This has a method construct()

which invokes a JS function that has been implemented as a constructor, and returns the new JS object.

I can't find an equivalent method in the javax.script API. Am I missing something? Or was this feature deliberately left out because the new API is designed to be more general purpose, and support langauges that don't have constructors?

Thanks,

Alasdair

[904 byte] By [Alasdair.Mackintosha] at [2007-11-27 5:49:19]
# 1

If it was me I wouldn't get all excited just because it seems like the java API implements something that previously required a third party library.

I know that when initially the logging api showed up I thought log4j would never be needed again. That was until I actually looked at what the logging api provided. It wasn't close. So sticking with log4j was and still is by far the better choice.

Besides the actual API you might also note that as the first version that it is more likely to have bugs than a third party library that has been around for a while.

jschella at 2007-7-12 15:35:41 > top of Java-index,Java Essentials,Java Programming...