OverviewSingleDeprecated

jsx3.lang

class AOP

Object
->jsx3.lang.Object
  ->jsx3.lang.AOP

class AOP
extends jsx3.lang.Object
Simple aspect oriented programming for TIBCO General Interface™.

Advice can be added before, after, and around any call to an instance method of a GI class.

Note that only the exact class and subclasses loaded after a pointcut is defined are affected.

Note that only instance methods and not static methods can define pointcuts.

The second argument to the before, after, and around methods is the advice function, examples of which are provided here:
jsx3.AOP.pc("myPointcut", {classes:"jsx3.xml.Document", methods:"load"});
jsx3.AOP.before("myPointcut", function(strURL, intTimeout) {
  jsx3.log("load() called on " + this + " with URL " + strURL + ".");
});
jsx3.AOP.after("myPointcut", function(rv, strURL, intTimeout) {
  jsx3.log("load() called on " + this + " with URL " + strURL + " returned " + rv + ".");
});
jsx3.AOP.around("myPointcut", function(aop, strURL, intTimeout) {
  var t1 = new Date().getTime();
  var rv = aop.proceed(strURL, intTimeout);
  var tTotal = new Date().getTime() - t1;
  jsx3.log("load() called on " + this + " with URL " + strURL + " took " + tTotal + " ms and returned " + rv + ".");
  return rv;
});
Note that after advice receives the method return value as the first method parameter. Note also that around advice must manage the AOP chain by calling proceed() on the first method parameter and by returning the return value of this call.

Since:

3.6

Method Summary
static void
after(strPName : String, fctAdvice : Function, bRemove : boolean)
static void
around(strPName : String, fctAdvice : Function, bRemove : boolean)
static void
before(strPName : String, fctAdvice : Function, bRemove : boolean)
static void
pc(strName : String, objConditions : Object)
Creates a new pointcut.
static void
pcrem(strName : String)
Removes a pointcut.
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf, toString
Method Detail

after

static void after(strPName : String, fctAdvice : Function, bRemove : boolean)

Parameters:

strPNamethe pointcut name.
fctAdvicethe advice function.
bRemoveif true, remove this advice.

around

static void around(strPName : String, fctAdvice : Function, bRemove : boolean)

Parameters:

strPNamethe pointcut name.
fctAdvicethe advice function.
bRemoveif true, remove this advice.

before

static void before(strPName : String, fctAdvice : Function, bRemove : boolean)

Parameters:

strPNamethe pointcut name.
fctAdvicethe advice function.
bRemoveif true, remove this advice.

pc

static void pc(strName : String, objConditions : Object)
Creates a new pointcut. The supported conditions are as follows:

Parameters:

strNamethe name of the pointcut to create.
objConditionsthe pointcut conditions.

pcrem

static void pcrem(strName : String)
Removes a pointcut.

Parameters:

strNamethe name of the pointcut to remove.