OverviewSingleDeprecated

jsx3.lang

class Object

Object
->jsx3.lang.Object

Direct Known Subclasses:

jsx3.EVT, jsx3.app.AddIn, jsx3.app.Cache, jsx3.app.DOM, jsx3.app.Model, jsx3.app.Properties, jsx3.app.Server, jsx3.app.Settings, jsx3.app.UserSettings, jsx3.gui.Event, jsx3.gui.Heavyweight, jsx3.gui.HotKey, jsx3.gui.Matrix.ColumnFormat, jsx3.html.Tag, jsx3.lang.Class, jsx3.lang.Exception, jsx3.lang.Method, jsx3.lang.Package, jsx3.lang.System, jsx3.net.Form, jsx3.net.Request, jsx3.net.Service, jsx3.net.URI, jsx3.util.DateFormat, jsx3.util.List, jsx3.util.Locale, jsx3.util.Logger, jsx3.util.Logger.Handler, jsx3.util.Logger.Manager, jsx3.util.Logger.Record, jsx3.util.MessageFormat, jsx3.util.NumberFormat, jsx3.xml.Entity, jsx3.xml.Processor, jsx3.xml.Template

class Object
extends Object
Base class for all classes defined with jsx3.lang.Class.

Determining the Class of an Object

The class of an object can be determined in one of several ways.
  1. jsx3.lang.Object defines the method getClass(), which returns an instance of jsx3.lang.Class. This method is useful for testing whether an object is an instance of exactly (not a superclass of) a class.
  2. To test whether an object is an instance of a class or one of its superclasses, use the JavaScript operator instanceof: obj instanceof jsx3.lang.Object. Note that the right hand argument of this expression must be the constructor function of a class and not of an interface defined with jsx3.Class.defineInterface()).
  3. To test whether an object implements an interface, use the method instanceOf() defined in jsx3.lang.Object. This method will check against all classes and interfaces but is probably slower than the instanceof operator.
Examples:
var doc = new jsx3.gui.Block();
doc.getClass().equals(jsx3.gui.Block.jsxclass);  // true
doc.getClass().equals(jsx3.app.Model.jsxclass);  // false, even though Block extends Model
doc instanceof jsx3.gui.Block;  // true
doc instanceof jsx3.app.Model;  // true
doc instanceof jsx3.util.EventDispatcher;  // false, EventDispatcher is an interface
doc instanceof Object;          // true, works on non-jsx3.Class class constructors

doc.instanceOf(jsx3.gui.Block);            // true
doc.instanceOf(jsx3.app.Model.jsxclass);   // true, accepts arguments of type jsx3.Class
doc.instanceOf('jsx3.lang.Object');        // true, accepts arguments of type String
doc.instanceOf(jsx3.util.EventDispatcher); // true, works on interfaces
doc.instanceOf(Object);                    // true, works on non-jsx3.Class class constructors

Since:

3.1

Constructor Summary
void
Instance initializer.
Method Summary
jsx3.lang.Object
Returns a shallow copy of this object.
boolean
equals(obj : Object)
Returns true if this object is equals to the obj parameter.
Object
eval(strScript : String, objContext : Object)
Eval a string of code with a particular this and local variable stack context.
jsx3.lang.Class
Returns the class of this object.
String
Deprecated. use Object.getClass()
String
Deprecated. use Object.getClass().getName() and parse out final token
String
Deprecated. use Object.getClass().getPackageName()
boolean
Determines whether this object is an instance of objClass, that is, whether objClass is equal to or a superclass or superinterface of this object's class.
boolean
isInstanceOf(strClassName : String, strPropName : String, bIsRecurse : boolean)
Deprecated. use instanceof or Object.instanceOf()
boolean
isSubclassOf(strClassName : String)
Deprecated. no direct replacement
void
jsxmix(arg : Object...)
Invokes any method mixins registered with the method that calls jsxmix().
protected Object | undefined
jsxsuper(arg : Object...)
Calls the supermethod overridden by the method that calls jsxsuper().
protected Object | undefined
jsxsupermix(arg : Object...)
Like jsxsuper() but traverses up through all the interfaces implemented by this class and its super classes.
void
setInstanceOf(strInstanceOf : String)
Deprecated. no direct replacement
String
Constructor Detail

init

void init()
Instance initializer.
Method Detail

clone

jsx3.lang.Object clone()
Returns a shallow copy of this object.

Returns:

 

equals

boolean equals(obj : Object)
Returns true if this object is equals to the obj parameter.

Parameters:

obj

Returns:

 

eval

Object eval(strScript : String, objContext : Object)
Eval a string of code with a particular this and local variable stack context.

Parameters:

strScriptthe code to execute
objContexta map containing the local variable stack context

Returns:

the eval value of the script  

getClass

jsx3.lang.Class getClass()
Returns the class of this object.

Returns:

 

getInstanceOf

String getInstanceOf()
Deprecated. use Object.getClass()
gets the class name for the object (the function that was instanced via 'new' to create the object). For example, jsx3.gui.Block, jsx3.gui.Tree, etc.

Returns:

class name of object 

getInstanceOfClass

String getInstanceOfClass()
Deprecated. use Object.getClass().getName() and parse out final token
gets the class name (less the package prefix) that this object is an instance of

Returns:

 

getInstanceOfPackage

String getInstanceOfPackage()
Deprecated. use Object.getClass().getPackageName()
returns the name of the package that this class belongs to; returns empty string if no package found

Returns:

 

instanceOf

boolean instanceOf(objClass : Function | jsx3.lang.Class | String)
Determines whether this object is an instance of objClass, that is, whether objClass is equal to or a superclass or superinterface of this object's class.

Parameters:

objClassthe class to test, may be either the class constructor, and instance of jsx3.lang.Class, or the fully-qualified class name

Throws:

{jsx3.lang.IllegalArgumentException}if objClass is a string that is not the name of a registered class

Returns:

 

isInstanceOf

boolean isInstanceOf(strClassName : String, strPropName : String, bIsRecurse : boolean)
Deprecated. use instanceof or Object.instanceOf()
returns whether or not this object is an instance of @strClassName

Parameters:

strClassNamenamed class
strPropNamedefault is INTERFACES; one of the strings: INTERFACES or SUPERS
bIsRecurseBRIDGE CODE; remove when old names fully deprecated/unsupported (release 4.0)

Returns:

 

isSubclassOf

boolean isSubclassOf(strClassName : String)
Deprecated. no direct replacement
Returns whether or not this object is an instance of a subclass of @strClassName

Parameters:

strClassNamenamed superclass

Returns:

 

jsxmix

void jsxmix(arg : Object...)
Invokes any method mixins registered with the method that calls jsxmix(). A method mixin is only invoked if this object is an instance of the class registered with the mixin.

jsxmix() is useful when a method of a base or abstract class is designed to be overridden and chained by a subclass and when interface(s) that the subclass implements need to "inject" behavior into the method chain. For example:
jsx3.Class.defineClass("BaseClass", null, null, function(BaseClass) {
  BaseClass.prototype.onEvent = function(objEvent) {
    this.jsxmix(objEvent);
    jsx3.log("Handling event " + objEvent + " in BaseClass.");
  };
});
jsx3.Class.defineInterface("Mixin", null, function(Mixin) {
  Mixin.prototype._onEvent = function(objEvent) {
    jsx3.log("Handling event " + objEvent + " in Mixin.");
  };
  BaseClass.jsxclass.addMethodMixin("onEvent", Mixin.jsxclass, "_onEvent");
});
jsx3.Class.defineClass("SubClass", BaseClass, [Mixin], function(SubClass) {
  SubClass.prototype.onEvent = function(objEvent) {
    jsx3.log("Handling event " + objEvent + " in SubClass.");
    this.jsxsuper(objEvent);
  };
});

Parameters:

argthe variable number of arguments passed to the method mixins.

Since:

3.5

See Also:

jsx3.lang.Class.addMethodMixin()

jsxsuper

protected Object | undefined jsxsuper(arg : Object...)
Calls the supermethod overridden by the method that calls jsxsuper(). The following example shows a chained instance initializer method:
Subclass.prototype.init = function(a, b, c) {
  this.jsxsuper(a, b);  // calls the init() method in the superclass of Subclass
  this.c = c;
};

Parameters:

argthe variable number of arguments passed to the supermethod

Throws:

{jsx3.lang.Exception}if called by a static method, if called by a method not defined in a call to jsx3.lang.Class.defineClass()/defineInterface(), or if no suitable super method exists

Returns:

returns the result of the supermethod 

jsxsupermix

protected Object | undefined jsxsupermix(arg : Object...)
Like jsxsuper() but traverses up through all the interfaces implemented by this class and its super classes. This method facilitates modifying the functionality of a mixin interface for a particular class that implements the interface, as the following example shows:
// imagine that the jsx3.Testable mixin interface defines a method test() that provides basic testing functionality
jsx3.Class.defineClass('eg.Test', null, [jsx3.Testable], function(Test){
  Test.prototype.test = function() {
    this.setUpTest();      // do something before running the test
    this.jsxsupermix();    // calls test() in jsx3.Testable
    this.tearDownTest();   // do something after running the test
  };
});

Parameters:

argthe variable number of arguments passed to the supermethod

Throws:

{jsx3.lang.Exception}if called by a static method, if called by a method not defined in a call to jsx3.lang.Class.defineClass()/defineInterface(), or if no suitable super method exists

Returns:

returns the result of the supermethod 

setInstanceOf

void setInstanceOf(strInstanceOf : String)
Deprecated. no direct replacement
sets the JSX object type (only set during object initialization; although custom code can be written to 'cast' an object type to another object type)

Parameters:

strInstanceOftype of JSX object, such as jsx3.gui.Tree, jsx3.gui.Button, etc.

toString

String toString()

Returns:

a string representation of this object  

Overrides:

toString in Object