A collection of Java classes are represented as a package. The complete set of all available Java Packages are contained within a single parent JavaPackage object. This constructs a hierarchy of JavaPackage and JavaClass objects.
The properties of the JavaPackage object are those that refer to any Java Class or Java Packages that belong to it. However, these are generally not enumerable so you do need to know what they are called before you can access them.
Because you cannot enumerate the properties of this object you won't be able to walk a Java package hierarchy with a script-driven tree walker.
The JavaPackage tree structure resembles the directory structure that the Java class files are stored in. Some class files are collected into ZIP archives but even then the hierarchy is still intact and there will be one package that represents the ZIP file and corresponds to that node in the tree. Any arbitrary collection of classes will be represented by a JavaPackage object, regardless of how they are stored in the file system.
// Create a JavaScript object that encapsulates a Java Package var myJavaPackage = Packages.java.util;
Prev | Home | Next |
JavaObject.getClass() | Up | JavaScript Bookmark URLs |
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. |