General Interface is an open source project hosted by the Dojo Foundation

Class-Like Constructs

The jsx3.lang package defines three class-like constructs— Class, Interface, and Package. These constructs are not exactly equivalent to their Java/C++ namesakes.

Classes

Classes have the following characteristics:

  • Are defined with the jsx3.lang.Class.defineClass() method
  • Define static fields, static methods, instance fields, instance methods, and abstract instance methods
  • Are instantiated
  • Can be the superclass of another class
  • Descend from jsx3.lang.Object

Interfaces

Interfaces have the following characteristics:

  • Are defined with the jsx3.lang.Class.defineInterface() method
  • Define static fields, static methods, instance methods and abstract instance methods
  • Are not instantiated
  • Can be the superclass of another interface
  • Can be implemented by a class

Packages

Packages have the following characteristics:

  • Are defined with the jsx3.lang.Package.definePackage() method
  • Define static fields and static methods
  • Contain classes and interfaces defined with jsx3.lang.Class

Unlike in Java, General Interface interfaces may contain concrete instance methods. When a class implements an interface, the instance methods of the interface are mixed into the class. A mixed in method overrides a method of the same name inherited from the superclass but doesn't override a method defined in the implementing class or mixed in from an interface coming earlier in the arrImplements parameter to the Class.defineClass() method.

Packages must be explicitly defined with the jsx3.lang.Package.definePackage() method in order to be introspectable. Simply defining the class com.tibco.Widget will not define the package com.tibco. Defining a package isn't required for the class to work. It simply allows the package to be introspected.

Classes, interfaces, and packages can "contain" classes/interfaces. Consider the following code assuming that the class com.tibco.Widget.Encoding is defined:

// returns [com.tibco.Widget, com.tibco.Widget.Encoding]
jsx3.lang.Package.forName("com.tibco").getClasses();

// returns [com.tibco.Widget.Encoding]
jsx3.lang.Class.forName("com.tibco.Widget").getClasses();

Contents

Searching General Interface Docs

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.