abc.weaving.aspectinfo
Class AbstractAdviceDecl

java.lang.Object
  extended by abc.weaving.aspectinfo.Syntax
      extended by abc.weaving.aspectinfo.AbstractAdviceDecl
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
AdviceDecl, CflowSetup, DeclareMessage, DeclareSoft, PerSetupAdvice

public abstract class AbstractAdviceDecl
extends Syntax
implements java.lang.Cloneable

The base class for any kind of 'advice' declaration This can include both real advice declared directly in the aspect and other kinds of advice needed by abc for implementation reasons.

Author:
Ganesh Sittampalam

Field Summary
protected  Pointcut pc
           
 int sourceId
           
protected  AdviceSpec spec
           
 
Constructor Summary
protected AbstractAdviceDecl(Aspect aspct, AdviceSpec spec, Pointcut pc, java.util.List formals, Position pos)
           
protected AbstractAdviceDecl(Aspect aspct, AdviceSpec spec, Pointcut pc, java.util.List formals, Position pos, boolean normalized)
           
 
Method Summary
protected  java.lang.Object clone()
           
abstract  void debugInfo(java.lang.String prefix, java.lang.StringBuffer sb)
           
 java.lang.String errorInfo()
          Return a string describing the current piece of advice, for use in error messages
 AdviceSpec getAdviceSpec()
           
 int getApplCount()
          Returns how often this advice was applied during weaving.
 java.lang.String getApplWarning()
          Returns a warning if this AdviceDecl does not match any static joinpoints, otherwise returns null.
 Aspect getAspect()
          Every advice declaration is associated with a particular aspect.
 Aspect getDefiningAspect()
          Get the aspect an advice declaration was originally defined in.
 java.util.List getFormals()
           
 Pointcut getPointcut()
           
abstract  WeavingEnv getWeavingEnv()
           
 boolean hasEnclosingJoinPoint()
           
 boolean hasJoinPoint()
           
 boolean hasJoinPointStaticPart()
           
 void incrApplCount()
          Increment the number of times this advice is applied.
abstract  Chain makeAdviceExecutionStmts(AdviceApplication adviceappl, LocalGeneratorEx localgen, WeavingContext wc)
          Produce a chain containing the statements to execute this piece of advice.
 AbstractAdviceDecl makeCopyInAspect(Aspect newaspct)
          Make an exact copy of this advice declaration, but change the aspect to the given one.
abstract  WeavingContext makeWeavingContext()
           
 Residue postResidue(ShadowMatch sm)
           
 void preprocess()
          Pointcuts come in normalized and unnormalized versions.
 Residue preResidue(ShadowMatch sm)
           
 void reportMessages(AdviceApplication aa)
          Report any errors or warnings for this advice application.
 void resetForReweaving()
           
 
Methods inherited from class abc.weaving.aspectinfo.Syntax
getPosition
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourceId

public int sourceId

spec

protected AdviceSpec spec

pc

protected Pointcut pc
Constructor Detail

AbstractAdviceDecl

protected AbstractAdviceDecl(Aspect aspct,
                             AdviceSpec spec,
                             Pointcut pc,
                             java.util.List formals,
                             Position pos)

AbstractAdviceDecl

protected AbstractAdviceDecl(Aspect aspct,
                             AdviceSpec spec,
                             Pointcut pc,
                             java.util.List formals,
                             Position pos,
                             boolean normalized)
Method Detail

getAdviceSpec

public AdviceSpec getAdviceSpec()

getAspect

public Aspect getAspect()
Every advice declaration is associated with a particular aspect. This method returns the aspect.


getDefiningAspect

public Aspect getDefiningAspect()
Get the aspect an advice declaration was originally defined in.


clone

protected java.lang.Object clone()
Overrides:
clone in class java.lang.Object

makeCopyInAspect

public AbstractAdviceDecl makeCopyInAspect(Aspect newaspct)
Make an exact copy of this advice declaration, but change the aspect to the given one. This is needed to implement aspect inheritance, because that defines that advice defined in a base aspect is treated as occurring once in each derived aspect.


preprocess

public void preprocess()
Pointcuts come in normalized and unnormalized versions. (See Pointcut.normalize). An advice declaration can be constructed with the unnormalized version, in which case it is necessary to call this method before trying to use it for anything pointcut related. It is an error to call this method if the pointcut has already been normalized.


getPointcut

public Pointcut getPointcut()

getFormals

public java.util.List getFormals()

debugInfo

public abstract void debugInfo(java.lang.String prefix,
                               java.lang.StringBuffer sb)

getWeavingEnv

public abstract WeavingEnv getWeavingEnv()

makeWeavingContext

public abstract WeavingContext makeWeavingContext()

resetForReweaving

public void resetForReweaving()

hasJoinPoint

public boolean hasJoinPoint()

hasJoinPointStaticPart

public boolean hasJoinPointStaticPart()

hasEnclosingJoinPoint

public boolean hasEnclosingJoinPoint()

preResidue

public Residue preResidue(ShadowMatch sm)

postResidue

public Residue postResidue(ShadowMatch sm)

makeAdviceExecutionStmts

public abstract Chain makeAdviceExecutionStmts(AdviceApplication adviceappl,
                                               LocalGeneratorEx localgen,
                                               WeavingContext wc)
Produce a chain containing the statements to execute this piece of advice. If execution reaches the beginning of the chain, then the advice definitely applies.

Parameters:
adviceappl - The advice application structure.
localgen - A local variable generator for the method body being woven into
wc - The weaving context

incrApplCount

public void incrApplCount()
Increment the number of times this advice is applied.


getApplWarning

public java.lang.String getApplWarning()
Returns a warning if this AdviceDecl does not match any static joinpoints, otherwise returns null.


getApplCount

public int getApplCount()
Returns how often this advice was applied during weaving.

Returns:
the number of times this advice was applied during the last weaving process

errorInfo

public java.lang.String errorInfo()
Return a string describing the current piece of advice, for use in error messages


reportMessages

public void reportMessages(AdviceApplication aa)
Report any errors or warnings for this advice application.