OverviewSingleDeprecatedPropertiesEventsXSL Parameters

jsx3.amp

class ExtProc

Object
->jsx3.lang.Object
  ->jsx3.amp.ExtProc

class ExtProc
extends jsx3.lang.Object
An extension processor utility class.

See Also:

process(), jsx3.amp.ExtPoint.processExts()

Field Summary
static jsx3.amp.ExtProc
EVAL
Processes an extension by intepreting each child element of the XML extension declaration as code to evaluate.
static jsx3.amp.ExtProc
RETURN
Processes an extension by intepreting each child element of the XML extension declaration as code to evaluate.
static jsx3.amp.ExtProc
RETURN_ASYNC
Processes an extension by intepreting each child element of the XML extension declaration as code to evaluate.
Method Summary
static void
addProcessorFactory(strType : String, fctFactory : Function)
Registers a processor factory.
static void
getProcessor(strType : String, xml : jsx3.amp.XML)
Creates a processor object from a element.
static jsx3.amp.ExtProc
Creates a new extension processor that creates instances of a certain class.
static jsx3.$Array
process(arrExt : Array<jsx3.amp.Ext>, objVisitor : Function | Object)
Processes a list of extensions using the visitor pattern.
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf, toString
Field Detail

EVAL

static jsx3.amp.ExtProc EVAL
Processes an extension by intepreting each child element of the XML extension declaration as code to evaluate. The element should be named "eval" and the text body of the element is taken as the JavaScript to evaluate. The script is evaluated in the context of the extension object. So, for example, this.getPlugIn() grants access in the script to the plug-in defining the extension.

No value is returned from the extension processing. If the load attribute of the eval element is equal to "true" then the plug-in owning the extension is loaded before the script is evaluated. Therefore, the script may be evaluated either synchronously or asynchronously, but since there is no value returned from the processing, there is no way of knowing which one actually occurred.

RETURN

static jsx3.amp.ExtProc RETURN
Processes an extension by intepreting each child element of the XML extension declaration as code to evaluate. The element should be named "eval" and the text body of the element is taken as the JavaScript to evaluate. The script is evaluated in the context of the extension object. So, for example, this.getPlugIn() grants access in the script to the plug-in defining the extension.

The value that the script evaluates to is returned from the extension processing.

RETURN_ASYNC

static jsx3.amp.ExtProc RETURN_ASYNC
Processes an extension by intepreting each child element of the XML extension declaration as code to evaluate. The element should be named "eval" and the text body of the element is taken as the JavaScript to evaluate. The script is evaluated in the context of the extension object. So, for example, this.getPlugIn() grants access in the script to the plug-in defining the extension.

The value returned from the extension processing is an asynchronous return value as defined in the contract for jsx3.$Y(). The return value may be notified either asynchronously or synchronously, depending on whether the load attribute of the eval element is equal to "true". If it is, then the plug-in owning the extension is loaded first and then the script is evaluated asynchronously. The asynchronous return value is notified of completion with the value that the script evaluates to.
Method Detail

addProcessorFactory

static void addProcessorFactory(strType : String, fctFactory : Function)
Registers a processor factory. A processor factory is the object responsible for creating a processor when a <processor> is found as a child of an <extension-point> element. Each processor element must declare a type attribute. The factory that has been registered with the matching type is used to create the processor. The method signature of the factory method is: function(xml : jsx3.amp.XML) : jsx3.amp.ExtProc where xml is the XML representation of the <processor> element.

Parameters:

strTypethe type of processor that the factory creates.
fctFactorythe factory function.

getProcessor

static void getProcessor(strType : String, xml : jsx3.amp.XML)
Creates a processor object from a <processor> element.

Parameters:

strTypethe type attribute of the <processor> element.
xmlthe <processor> element.

See Also:

addProcessorFactory()

newDescrProc

static jsx3.amp.ExtProc newDescrProc(objClass : String | jsx3.lang.Class | Function)
Creates a new extension processor that creates instances of a certain class. The only requirement of the class is that is have a two-argument constructor with the signature: function init(ext : jsx3.amp.Ext, xml : jsx3.amp.XML).

The processing visitor will create a new instance of objClass for each child element of each extension. If any child element defines a ext-class attribute, this is interpreted as the fully-qualified class name of a subclass of objClass. This class, if it is defined, will be used instead of objClass to process that particular child element.

Parameters:

objClassa class or constructor.

Returns:

 

process

static jsx3.$Array process(arrExt : Array<jsx3.amp.Ext>, objVisitor : Function | Object)
Processes a list of extensions using the visitor pattern. For each extension in arrExt, this method iterates over each child element of the extension declaration and invokes objVisitor for each element. At each iteration the visitor is passed as arguments the extension object and an XML object representing the child element.

Parameters:

arrExt
objVisitoran object that defines method process(ext : jsx3.amp.Ext, data: jsx3.amp.XML) : Object or the function itself.

Returns: