The static fields of the Java Class are presented as properties of the JavaClass object.
The static methods of the Java Class are presented as methods available to the JavaClass object. They may be presented as JavaMethod objects depending on how you access them from JavaScript.
The only properties and methods this object has, correspond to the public properties and methods of the Java class that it represents. You can enumerate these properties in a loop.
Java classes are either stored in individual class files or are collected together into groups stored in a ZIP file. Groups of classes will be represented by a JavaPackage object. Each individual class is represented by a JavaClass object. The JavaClass objects belong to a parent JavaPackage object.
To operate on these objects, you really need to know something about the Java classes they encapsulate. There are many standard classes and some that may have been custom written for your project.
<HTML> <HEAD> </HEAD> <BODY> <SCRIPT> // Create a JavaScript object that encapsulates a Java Class var myJavaDateClass = Packages.java.util.Date; var myJavaDateObject = new Packages.java.util.Date; // Write the date to a web page document.write(myJavaDateObject.toString()); // Write the same date value date to the Java console java.lang.System.out.println(myJavaDateObject); </SCRIPT> </BODY> </HTML>
Prev | Home | Next |
JavaArray.toString() | Up | JavaMethod object |
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. |