2007-07-29

AOPFramework alpha released!

AOP Framework Icon

AOPFramework is released on Google Code.


Sample:



package {

import advancedflex.aop.advisor.InvocationAdvisor;
import advancedflex.aop.framework.AOPProxy;
import advancedflex.aop.framework.Advisor;
import advancedflex.aop.framework.JointPoint;
import advancedflex.aop.framework.MethodInfo;
import advancedflex.aop.framework.Pointcut;
import advancedflex.aop.pointcut.RegExpPointcut;
import advancedflex.aop.pointcut.StringPointcut;
import advancedflex.aop.proxy.StaticAOPProxy;

import flash.display.Graphics;
import flash.display.Sprite;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Transform;
import flash.utils.Dictionary;
public class AdvancedFlex extends Sprite{
public function AdvancedFlex(){
var s:Point = new Point(0,0);
var p:AOPProxy = new StaticAOPProxy(s);
var ad:InvocationAdvisor = new InvocationAdvisor();
ad.aroundAdvice = function(method:MethodInfo, join:JointPoint):void {
trace("#begin","name :", method.name,"args :", method.args, "result :", method.result);
join.proceed(method);
trace("@end","name :", method.name,"args :", method.args, "result :", method.result);
}
ad.beforeAdvice = function(method:MethodInfo):void {
trace("@before","name :", method.name,"args :", method.args, "result :", method.result);
}
ad.returningAdvice = function(method:MethodInfo):void {
trace("@return","name :", method.name,"args :", method.args, "result :", method.result);
}
ad.throwingAdvice = function(method:MethodInfo, e:Error):void {
trace("@throw","name :", method.name,"args :", method.args, "result :", method.result);
}
ad.afterAdvice = function(method:MethodInfo):void {
trace("@after","name :", method.name,"args :", method.args, "result :", method.result);
}
var pc:Pointcut = new RegExpPointcut(/ad+/, ad);
p.$addPointcut(pc);
trace(p.add(new Point(2,3)));
}
}
}

1 Comments:

Chris Charlton said...

Dope. Good start by showing package lists and their dev state.

If you're in the Los Angeles are, feel free to join our LA AIR Adobe user group - http://www.laair.org