Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

ch.ethz.prose.crosscut
Class McutAdvice  view McutAdvice download McutAdvice.java

java.lang.Object
  extended bych.ethz.prose.crosscut.McutAdvice
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ConcreteConcreteMcutAdvice, ConcreteWildcardMcutAdvice, DefaultMcutAdvice, WildcardConcreteMcutAdvice, WildcardWildcardMcutAdvice

abstract class McutAdvice
extends java.lang.Object
implements java.io.Serializable

The McutAdvice encapsulates the transformation of the join-point data (e.g., target, stack parameters) to the types required to execute the UserDefinedMCSignature of this crosscut. The execute method does this job.

An McutAdvice object contains all the data needed for the advice method invocation:

  1. An array of objects containing the arguments of the method being currently invoked (stackArgs). The this object (if existent, that is, if the invoked method is not static) is the first argument.
  2. the number of valid arguments
  3. the UserDefinedMCSignature object describing the static information about the advice action to be invoked.

      Because of performance reasons, thi class expose a part of the inner structure of this class. In addition to the protected stackArgs,stackArgsLength, and advice, for which no setters/getters are provided, the construtor invokes the allocStackArgs template method to allocate the space for the stackArgs array. This way, subclasses have the chance to override this method and create an array in which the number of arguments (stackArgsLength) is equal to the actual length of the argument array. Having an array with no trailing nulls will make execute's task more efficient (because execute will avoid array copying).


      Field Summary
      protected  MethodCutSignaturePattern advice
                 
      private  MethodCut methodCut
                 
      protected  java.lang.Object[] stackArgs
                 
      protected  int stackArgsLength
                 
      private static int UNKNOWN
                 
       
      Constructor Summary
      protected McutAdvice(MethodCut methodCut, ch.ethz.jvmai.JoinPoint joinPoint, MethodCutSignaturePattern advice)
                 
       
      Method Summary
      protected  void allocStackArgs(int expectedLength)
                 
      protected abstract  void execute()
                 
       
      Methods inherited from class java.lang.Object
      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
       

      Field Detail

      methodCut

      private final MethodCut methodCut

      UNKNOWN

      private static final int UNKNOWN
      See Also:
      Constant Field Values

      stackArgs

      protected transient java.lang.Object[] stackArgs

      stackArgsLength

      protected transient int stackArgsLength

      advice

      protected transient MethodCutSignaturePattern advice
      Constructor Detail

      McutAdvice

      protected McutAdvice(MethodCut methodCut,
                           ch.ethz.jvmai.JoinPoint joinPoint,
                           MethodCutSignaturePattern advice)
      Method Detail

      allocStackArgs

      protected void allocStackArgs(int expectedLength)

      execute

      protected abstract void execute()
                               throws java.lang.IllegalAccessException,
                                      java.lang.reflect.InvocationTargetException