Class org.as2lib.aop.advice.SimpleDynamicAdviceFactory

org.as2lib.core.BasicClass
   +--org.as2lib.aop.advice.SimpleDynamicAdviceFactory

Implemented Interfaces

DynamicAdviceFactory

Description

SimpleDynamicAdviceFactory manages the creation of advices for different advice types in a simple manner.

Method Index

new SimpleDynamicAdviceFactory()

bindAdviceFactory(), bindAdviceFactoryByAdviceClass(), bindAdviceFactoryByAdviceFactory(), getAdvice(), getAdviceByTypeAndPointcutAndCall(), getAdviceByTypeAndStringAndCall()

Inherited from BasicClass

toString()

Constructor Detail

SimpleDynamicAdviceFactory

public function SimpleDynamicAdviceFactory(Void)

Constructs a new SimpleDynamicAdviceFactory instance.

Method Detail

bindAdviceFactory

public function bindAdviceFactory()

bindAdviceFactoryByAdviceFactory

public function bindAdviceFactoryByAdviceFactory(adviceType:Number, adviceFactory:AdviceFactory):Void

Binds the given adviceFactory to the adviceType. If a request is made with the given adviceType as type, the bound adviceFactory will be used to create the advice that gets returned.

If there is already an advice factory bound to the given adviceType the old binding gets overwritten.

If you want to remove a binding pass an adviceFactory of value null or undefined

Parameters

adviceTypethe type to bind the adviceFactory to
adviceFactorythe advice factory to bind to the given adviceType

Throws

IllegalArgumentExceptionif argument adviceType is null or undefined

bindAdviceFactoryByAdviceClass

public function bindAdviceFactoryByAdviceClass(adviceType:Number, adviceClass:Function):AdviceFactory

Creates a new SimpleAdviceFactory instance for the given adviceClass, binds the created advice factory to the given adviceType and returns the factory.

If there is already an advice factory bound to the given adviceType the old binding gets overwritten.

Parameters

adviceTypethe type to bind the adviceFactory to
adviceClassthe class of the advice to create instances of if a advice request for the given adviceType is made

Return

an advice factory configured for the given adviceClass

Throws

IllegalArgumentExceptionif argument adviceType is null or undefined
IllegalArgumentExceptionif argument adviceClass is null or undefined

getAdvice

public function getAdvice():Advice

getAdviceByTypeAndStringAndCall

public function getAdviceByTypeAndStringAndCall(type:Number, pointcut:String, callback:Call):Advice

Returns the advice corresponding to the given type. The returned advice uses the passed-in pointcut and callback.

The callback is invoked if the execute method of the returned advice is executed.

Commonly supported types are defined as constants in the AbstractAdvice class.

Parameters

typethe type of the advice to return
pointcutthe string representation of a pointcut used by the returned advice
callbackthe callback that is executed if you invoke the execute method on the returned advice

Return

the advice corresponding to the type and configured with the given pointcut and callback

Throws

IllegalArgumentExceptionif argument type is null or undefined

Specified By

getAdviceByTypeAndStringAndCall() in org.as2lib.aop.advice.DynamicAdviceFactory

getAdviceByTypeAndPointcutAndCall

public function getAdviceByTypeAndPointcutAndCall(type:Number, pointcut:Pointcut, callback:Call):Advice

Returns the advice corresponding to the given type. The returned advice uses the passed-in pointcut and callback.

The callback is invoked if the execute method of the returned advice is executed.

Commonly supported types are defined as constants in the AbstractAdvice class.

Parameters

typethe type of the advice to return
pointcutthe pointcut used by the returned advice
callbackthe callback that is executed if you invoke the execute method on the returned advice

Return

the advice corresponding to the type and configured with the given pointcut and callback

Throws

IllegalArgumentExceptionif argument type is null or undefined

Specified By

getAdviceByTypeAndPointcutAndCall() in org.as2lib.aop.advice.DynamicAdviceFactory