OverviewSingleDeprecatedPropertiesEventsXSL Parameters

jsx3.lang

class Package

Object
->jsx3.lang.Object
  ->jsx3.lang.Package

class Package
extends jsx3.lang.Object
The Package class provides an introspectable API for JavaScript/JSX packages. It also provides a way of defining new packages.

An instance of this class may be obtained in one of the following ways (this class may not be instantiated directly): In this example, the JavaScript object jsx3.lang is known as the package "namespace," which is a plain JavaScript object and is analogous to the constructor property of a jsx3.Class.

The following is an example of how to define a new package called eg.tests:
jsx3.lang.Package.definePackage(
  "eg.tests",                           // the full name of the package to create
  function(tests) {                  // name the argument of this function "eg"
    
    // define a static method like this:
    tests.staticMethod = function() {
      ...
    };
    // define a static field like this:
    tests.STATIC_FIELD = "...";
  }
);

Since:

3.1

Method Summary
static void
definePackage(strName : String, fctBody : Function)
Defines a new package so that it is available for introspection.
static jsx3.lang.Package
forName(strName : String)
Returns the defined package with name equal to strName.
Array<jsx3.lang.Class>
Returns an array of all the classes defined in this package.
String
Returns the fully-qualified name of this class.
Object
Returns the namespace of this package.
static Array<jsx3.lang.Package>
Returns a list of all defined packages.
Array<String>
Returns the array of static fields defined for this package.
jsx3.lang.Method
getStaticMethod(strMethodName : String)
Returns the static method defined in this package with name strMethodName.
Array<jsx3.lang.Method>
Returns the array of static methods defined for this package.
String
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Method Detail

definePackage

static void definePackage(strName : String, fctBody : Function)
Defines a new package so that it is available for introspection.

It is not an error if the namespace object already exists prior to calling this method. Any members defined by fctBody are simply added to the pre-existing namespace. Then, all members, whether defined before the call to this method or with the call to this method, are made introspectable.

This method may be called more than once with the same strName without causing an error. The package is simply redefined. Only the members that are defined in the namespace object after the last call to this method will be available for introspection.

It is an error if, after fctBody is executed, any two members of the namespace object equal the same function object. This is know as method aliasing, which can be a useful technique in JavaScript. Any method aliasing within the namespace object must occur after the call to this method. Therefore, method aliasing will cause an error if this package is redefined later.

Parameters:

strNamethe full package name
fctBodythe function that defines the body of the package. This function takes one argument which is the package "namespace".

forName

static jsx3.lang.Package forName(strName : String)
Returns the defined package with name equal to strName.

Parameters:

strNamethe full name of the package to retrieve

Returns:

the package or null if none matches  

getClasses

Array<jsx3.lang.Class> getClasses()
Returns an array of all the classes defined in this package.

Returns:

 

getName

String getName()
Returns the fully-qualified name of this class.

Returns:

 

getNamespace

Object getNamespace()
Returns the namespace of this package. The namespace is the JavaScript object, descending from window, that references this package by its property jsxpackage.

Returns:

 

getPackages

static Array<jsx3.lang.Package> getPackages()
Returns a list of all defined packages.

Returns:

 

getStaticFieldNames

Array<String> getStaticFieldNames()
Returns the array of static fields defined for this package.

Returns:

an array of String names  

getStaticMethod

jsx3.lang.Method getStaticMethod(strMethodName : String)
Returns the static method defined in this package with name strMethodName.

Parameters:

strMethodNamethe name of the method to find

Returns:

the method or null if none found matching strMethodName  

getStaticMethods

Array<jsx3.lang.Method> getStaticMethods()
Returns the array of static methods defined for this package.

Returns:

an array of jsx3.Method instances  

toString

String toString()

Returns:

 

Overrides:

toString in jsx3.lang.Object