org.jboss.aop.instrument
Class OptimizedBehaviourInvocations

java.lang.Object
  extended by org.jboss.aop.instrument.OptimizedInvocations
      extended by org.jboss.aop.instrument.OptimizedBehaviourInvocations
Direct Known Subclasses:
OptimizedCallerInvocations, OptimizedConstructionInvocations, OptimizedConstructorInvocations, OptimizedMethodInvocations

public abstract class OptimizedBehaviourInvocations
extends OptimizedInvocations

Comment

Version:
$Revision$
Author:
Kabir Khan

Field Summary
static String ENFORCE_ARGS_CONSISTENCY
          Name of method that enforces consistency between the values contained in typed argument fields and those contained in arguments array.
protected static String INVOKE_TARGET
           
 
Constructor Summary
OptimizedBehaviourInvocations()
           
 
Method Summary
protected static void addArgumentFieldsAndAccessors(javassist.ClassPool pool, javassist.CtClass invocation, javassist.CtClass[] params, boolean hasMarshalledArguments)
          Adds typed argument fields to invocation and overwrites its arguments field accessor methods accordingly.
protected static void addDispatch(javassist.CtClass invocation, String methodName, javassist.CtClass[] params, String dispatchLine, String beforeDispatch, String afterDispatch)
          Creates a method that dispatches execution to a joinpoint, and adds this method to invocation class.
protected static String setArguments(int length)
          Returns a piece of code that sets all typed argument fields to the parameter values of current behaviour (i.e., arg0 = $1; arg1 = $2...).
 
Methods inherited from class org.jboss.aop.instrument.OptimizedInvocations
defrostClassIfExists, makeInvocationClass, makeInvocationClassNoCtors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENFORCE_ARGS_CONSISTENCY

public static final String ENFORCE_ARGS_CONSISTENCY
Name of method that enforces consistency between the values contained in typed argument fields and those contained in arguments array. This method is added to all optimized invocations that contain arguments field.

See Also:
Constant Field Values

INVOKE_TARGET

protected static final String INVOKE_TARGET
See Also:
Constant Field Values
Constructor Detail

OptimizedBehaviourInvocations

public OptimizedBehaviourInvocations()
Method Detail

setArguments

protected static String setArguments(int length)
Returns a piece of code that sets all typed argument fields to the parameter values of current behaviour (i.e., arg0 = $1; arg1 = $2...).

Parameters:
length - total number of parameters
Returns:
code that sets all argument fields to the values of current behaviour parameters

addArgumentFieldsAndAccessors

protected static void addArgumentFieldsAndAccessors(javassist.ClassPool pool,
                                                    javassist.CtClass invocation,
                                                    javassist.CtClass[] params,
                                                    boolean hasMarshalledArguments)
                                             throws javassist.NotFoundException,
                                                    javassist.CannotCompileException
Adds typed argument fields to invocation and overwrites its arguments field accessor methods accordingly.

Parameters:
pool - class pool that contains invocation
invocation - invocation class to which fields and methods will be added
params - list of the parameter types
hasMarshalledArguments - indicates whether invocationhas a marshalled arguments field
Throws:
javassist.NotFoundException
javassist.CannotCompileException

addDispatch

protected static void addDispatch(javassist.CtClass invocation,
                                  String methodName,
                                  javassist.CtClass[] params,
                                  String dispatchLine,
                                  String beforeDispatch,
                                  String afterDispatch)
                           throws javassist.NotFoundException,
                                  javassist.CannotCompileException
Creates a method that dispatches execution to a joinpoint, and adds this method to invocation class.
Except for its name, the generated method is constrained to have the same signature as InvocationBase.invokeTarget().

Parameters:
invocation - optimized invocation class
methodName - name of the generated method
dispatchLine - line that dispatches the execution to joinpoint. This line must not cointain ';' nor brackets or the arguments list.
params - joinpoint parameters type
beforeDispatch - one or more lines of code that should be executed before dispatchLine (this code must be complete, without compilation errors)
afterDispatch - one or more lines of code that should be executed after dispatchLine (this code must be complete, without compilation errors)
Throws:
javassist.NotFoundException
javassist.CannotCompileException
See Also:
InvocationBase.invokeTarget()


Copyright © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.