Packagejfraboni.easybake
Interfacepublic interface IBatch extends jfraboni.epitome.IDestroyable
Implementors Batch



Public Properties
 PropertyDefined By
  behaviours : Vector.<IInterceptor>
[read-only] Returns a Clone of the Vector of IInterceptor, the collection of AOP behaviour to be applied to all proxied-instances in the batch.
IBatch
Public Methods
 MethodDefined By
  
Handler is auto removed, added once only per proxy batch being baked.
IBatch
  
addBehaviour(interceptor:IInterceptor):IBatch
Add any object instance that implements org.as3commons.bytecode.interception.IInterceptor to define AOP behaviour for the proxied instance.
IBatch
  
addType(Type:Class):IBatch
Takes a Class to be proxied in the batch.
IBatch
  
After adding all definitions to the batch via addType(), add an onBatchComplete handler via addBatchCompleteHandler(), then call bake().
IBatch
  
createInstance(Type:Class, ... constructorArgs):*
As long as the Batch as been baked with the given Type definition, returns a generated-proxied instance of the Type.
IBatch
  
getBehaviour(Type:Class):IInterceptor
Returns the instance of the IInterceptor by its type.
IBatch
  
getClassProxyInfo(Type:Class):IClassProxyInfo
IBatch
Property Detail
behavioursproperty
behaviours:Vector.<IInterceptor>  [read-only]

Returns a Clone of the Vector of IInterceptor, the collection of AOP behaviour to be applied to all proxied-instances in the batch.


Implementation
    public function get behaviours():Vector.<IInterceptor>
Method Detail
addBatchCompleteHandler()method
public function addBatchCompleteHandler(handler:Function):IBatch

Handler is auto removed, added once only per proxy batch being baked. Handlers must implement signature: function onBatchComplete(batch:IBatch){ //...; }

Parameters

handler:Function

Returns
IBatch
addBehaviour()method 
public function addBehaviour(interceptor:IInterceptor):IBatch

Add any object instance that implements org.as3commons.bytecode.interception.IInterceptor to define AOP behaviour for the proxied instance. Example:

         // ...other code in Class ... //
         public function intercept(invocation:IMethodInvocation):void {
               switch(invocation.kind){
                   case InvocationKind.CONSTRUCTOR:
                       trace("{0} was instantiated", invocation.targetInstance);
                       break;
                   case InvocationKind.METHOD:
                       trace("{0} was invoked with parameter {0}", invocation.targetMember, invocation.arguments[0]);
                       break;
                   }
               }
         }
         // ...other code in Class ... //
         

Parameters

interceptor:IInterceptor

Returns
IBatch — fluent interface.
addType()method 
public function addType(Type:Class):IBatch

Takes a Class to be proxied in the batch. It is recommended to only include Classes of similar type in the batch, as the added behaviour will be applied to all proxied-instances in the batch created from the batch.

Parameters

Type:Class — Any Class.

Returns
IBatch — fluent interface.
bake()method 
public function bake():IBatch

After adding all definitions to the batch via addType(), add an onBatchComplete handler via addBatchCompleteHandler(), then call bake(). This will load the load the proxied Classes, and onBatchComplete instances of the Classes can be created by calling createInstance(MyClass).

Returns
IBatch — fluent interface.
createInstance()method 
public function createInstance(Type:Class, ... constructorArgs):*

As long as the Batch as been baked with the given Type definition, returns a generated-proxied instance of the Type.

Parameters

Type:Class — The Class to be proxied - must have already been baked into the Batch.
 
... constructorArgs — ...rest style constructor arguments of the Type, if required.

Returns
* — An instance of the proxied Type.
getBehaviour()method 
public function getBehaviour(Type:Class):IInterceptor

Returns the instance of the IInterceptor by its type.

Parameters

Type:Class — The Class of the IInterceptor

Returns
IInterceptor — The instance of the IInterceptor, if mapped.
getClassProxyInfo()method 
public function getClassProxyInfo(Type:Class):IClassProxyInfo

Parameters

Type:Class

Returns
IClassProxyInfo