JavaPackage

  • Enlace amigable (slug) de la revisión: Referencia_de_JavaScript_1.5/Objetos_globales/JavaPackage
  • Título de la revisión: JavaPackage
  • Id de la revisión: 185470
  • Creada:
  • Creador: Mgjbot
  • ¿Es la revisión actual?
  • Comentario robot Añadido: [[en:Core JavaScript 1.5 Reference:Global Objects:JavaPackage]] <<langbot>>

Contenido de la revisión

Summary

Core Object

A JavaScript reference to a Java package.

Created by

A reference to the package name used with the Packages keyword:

Packages.JavaPackage

JavaPackage is the name of the object's Java package. If the package is in the java, netscape, or sun packages, the Packages keyword is optional.

Description

In Java, a package is a collection of Java classes or other Java packages. For example, the netscape package contains the package netscape.javascript; the netscape.javascript package contains the classes JSObject and JSException.

In JavaScript, a JavaPackage is a reference to a Java package. For example, a reference to netscape is a JavaPackage. netscape.javascript is both a JavaPackage and a property of the netscape JavaPackage.

A JavaClass object is a reference to one of the classes in a package, such as netscape.javascript.JSObject. The JavaPackage and JavaClass hierarchy reflect the Java package and class hierarchy.

Although the packages and classes contained in a JavaPackage are its properties, you cannot use a for...in statement to enumerate them as you can enumerate the properties of other objects.

Properties

The properties of a JavaPackage are the JavaClass objects and any other JavaPackage objects it contains.

Examples

Suppose the Redwood corporation uses the Java redwood package to contain various Java classes that it implements. The following code creates the JavaPackage red:

var red = Packages.redwood;

See also

JavaArray, JavaClass, JavaObject, Packages

{{ languages( { "en": "en/Core_JavaScript_1.5_Reference/Global_Objects/JavaPackage", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/JavaPackage" } ) }}

Fuente de la revisión

<p>
</p>
<h3 id="Summary" name="Summary"> Summary </h3>
<p><b>Core Object</b>
</p><p>A JavaScript reference to a Java package.
</p>
<h3 id="Created_by" name="Created_by"> Created by </h3>
<p>A reference to the package name used with the <code>Packages</code> keyword:
</p>
<pre class="eval">Packages.<i>JavaPackage</i>
</pre>
<p><i>JavaPackage</i> is the name of the object's Java package. If the package is in the <code>java</code>, <code>netscape</code>, or <code>sun</code> packages, the <code>Packages</code> keyword is optional.
</p>
<h3 id="Description" name="Description"> Description </h3>
<p>In Java, a package is a collection of Java classes or other Java packages. For example, the <code>netscape</code> package contains the package <code>netscape.javascript</code>; the <code>netscape.javascript</code> package contains the classes <code>JSObject</code> and <code>JSException</code>.
</p><p>In JavaScript, a <code>JavaPackage</code> is a reference to a Java package. For example, a reference to <code>netscape</code> is a <code>JavaPackage</code>. <code>netscape.javascript</code> is both a <code>JavaPackage</code> and a property of the <code>netscape</code> JavaPackage.
</p><p>A <code>JavaClass</code> object is a reference to one of the classes in a package, such as <code>netscape.javascript.JSObject</code>. The <code>JavaPackage</code> and <code>JavaClass</code> hierarchy reflect the Java package and class hierarchy.
</p><p>Although the packages and classes contained in a <code>JavaPackage</code> are its properties, you cannot use a <code>for...in</code> statement to enumerate them as you can enumerate the properties of other objects. </p>
<h3 id="Properties" name="Properties"> Properties </h3>
<p>The properties of a <code>JavaPackage</code> are the <code>JavaClass</code> objects and any other <code>JavaPackage</code> objects it contains.
</p>
<h3 id="Examples" name="Examples"> Examples </h3>
<p>Suppose the Redwood corporation uses the Java <code>redwood</code> package to contain various Java classes that it implements. The following code creates the <code>JavaPackage</code> red:
</p>
<pre class="eval">var red = Packages.redwood;
</pre>
<h3 id="See_also" name="See_also"> See also </h3>
<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaArray">JavaArray</a>,
<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaClass">JavaClass</a>,
<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/JavaObject">JavaObject</a>,
<a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Packages">Packages</a>
</p>
<div class="noinclude">
</div>
{{ languages( { "en": "en/Core_JavaScript_1.5_Reference/Global_Objects/JavaPackage", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Obiekty/JavaPackage" } ) }}
Revertir a esta revisión