When Java methods are called from JavaScript in Netscape they are translated via LiveConnect so that the Java objects appear to be as much like JavaScript objects as possible.
When methods are called, often you want to pass some data to the method. JavaScript supports a variety of primitive data types and more complex objects. These need to be mapped usefully to their corresponding Java equivalent values and types. A similar thing happens when the methods return a result value.
There is some hysteresis effect here because there are not always direct equivalents and so it is possible for the data type to mutate across this boundary, even if the method does nothing other than to echo an input value without modifying it.
It simplifies things a great deal to consider the input arguments and returned values as a separate issue although many factors about the data conversion are similar. On the one hand, we are converting JavaScript values to their nearest and most sensible Java equivalents. On the other hand, we are converting Java values to their best possible JavaScript counterparts.
Prev | Home | Next |
Java method calls | Up | Java to JavaScript values |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |