Class org.as2lib.aop.pointcut.DynamicPointcutFactory

org.as2lib.core.BasicClass
   +--org.as2lib.aop.pointcut.DynamicPointcutFactory

Implemented Interfaces

PointcutFactory

Description

DynamicPointcutFactory is a pointcut factory that can be dynamically expanded with new pointcut types at run-time. You can do so by adding a new pointcut factory. This pointcut factory is mapped to a pointcut rule that determines whether the given pointcut factory is used to create the pointcut to return based on a given pointcut pattern.

This pointcut factory allows for execution, within, set and get access join points and for composite pointcuts combined with AND or OR logic. execution(org.as2lib.env.Logger.debug) set(org.as2lib.MyClass.myProperty) get(org.as2lib.MyClass.myProperty) within(org.as2lib.MyClass) execution(org.as2lib.env.Logger.debug) || set(org.as2lib.MyClass.myProperty)

Negation is also supported for every kind of pointcut: execution(org.as2lib..*.*) && !within(org.as2lib.MyAspect)

You may of course enhance the list of supported pointcuts by binding new ones with the bindPointcutFactory method.

Method Index

new DynamicPointcutFactory()

bindPointcutFactory(), getPointcut()

Inherited from BasicClass

toString()

Constructor Detail

DynamicPointcutFactory

public function DynamicPointcutFactory(Void)

Constructs a new DynamicPointcutFactory instance.

Method Detail

getPointcut

public function getPointcut(pattern:String):Pointcut

Returns a pointcut based on the passed-in pattern representation.

The pointcut to return is determined by the rules of the added pointcut factories. The pointcut factory whose rule applies first to the given pattern is used to get the pointcut to return. This means that order matters.

Parameters

patternthe string representation of the pointcut

Return

the object-oriented view of the passed-in pointcut pattern

Specified By

getPointcut() in org.as2lib.aop.pointcut.PointcutFactory

bindPointcutFactory

public function bindPointcutFactory(rule:PointcutRule, factory:PointcutFactory):Void

Binds a new factory to the given rule.

Parameters

rulethe rule that must evaluate to true to indicate that the factory shall be used for a given pointcut pattern
factorythe factory to add

Throws

IllegalArgumentExceptionif rule is null or undefined
IllegalArgumentExceptionif factory is null or undefined