org.jboss.aop.instrument
Class WrapperTransformer

java.lang.Object
  extended by org.jboss.aop.instrument.WrapperTransformer

public class WrapperTransformer
extends Object

This class is responsible for wrapping joinpoints. In this context, wrapping means just changing a joinpoint status according to it's wrapping state. A joinpoint is identified by a class member and a transformation text, because there may be more than one joinpoint associated with a classe member, and whe have to differentiate them (pick, for exemple, the field read and field write joinpoints; in this case we have two joinponts associated with a single field). When more than a joinpont is associated with a class member, we say that there is more than one transformation type available to be applied to this class member. The transformation types available to a member are identified by a String array passed to WrapperTransformer constructor. There must be a WrapperTransformer instance for each transformer. That means that when we talk about transformation types available to a class member, we mean the member associated with the transformer (for exemple, in the case of ConstructorExecutionTransformer, the member is a constructor).

Author:
Flavia Rainone

Field Summary
protected static String[] SINGLE_TRANSFORMATION
          May be used as the transformations array in the constructor, if a class member will be affected by only one type of transformation.
protected static int SINGLE_TRANSFORMATION_INDEX
          Index that identifies the single transformation contained in SINGLE_TRANSFORMATION.
 
Constructor Summary
WrapperTransformer(String[] transformations)
          Creates a wrapper transformer.
 
Method Summary
 boolean isNotPrepared(javassist.CtMember member, int transformationIndex)
          Checks if the joinpoint is not prepared.
 boolean isWrapped(javassist.CtMember member, int transformationIndex)
          Checks if the joinpoint is wrapped.
 void prepareForWrapping(javassist.CtMember member, int transformationIndex)
          Prepares the joinpoint for wrapping.
 void unwrap(javassist.CtMember member, int transformationIndex)
          Unwraps the joinpoint.
 void wrap(javassist.CtMember member, int transformationIndex)
          Wraps the joinpoint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLE_TRANSFORMATION

protected static final String[] SINGLE_TRANSFORMATION
May be used as the transformations array in the constructor, if a class member will be affected by only one type of transformation. In this case, a joinpoint can be identified only by a class member.


SINGLE_TRANSFORMATION_INDEX

protected static final int SINGLE_TRANSFORMATION_INDEX
Index that identifies the single transformation contained in SINGLE_TRANSFORMATION. If SINGLE_TRANSFORMATION was passed as the transformations argument to the constructor, this variable has to be used as the transformation index value in the WrapperTransformer methods calls.

See Also:
Constant Field Values
Constructor Detail

WrapperTransformer

public WrapperTransformer(String[] transformations)
Creates a wrapper transformer.

Parameters:
transformations - list of all transformations that may be applied to a joinpoint. It may be SINGLE_TRANSFORMATION if a class member will be affected by only one type of transformation (i. e. if a joinpont can be identified only by the class member).
Method Detail

prepareForWrapping

public void prepareForWrapping(javassist.CtMember member,
                               int transformationIndex)
Prepares the joinpoint for wrapping.

Parameters:
member - the member associated with the joinpoint.
transformationIndex - index of the transformation text which, along with member, identifies the joinpoint to be prepared.

wrap

public void wrap(javassist.CtMember member,
                 int transformationIndex)
Wraps the joinpoint.

Parameters:
member - the member associated with the joinpoint.
transformationIndex - index of the transformation text which, along with member, identifies the joinpoint to be wrapped.

unwrap

public void unwrap(javassist.CtMember member,
                   int transformationIndex)
Unwraps the joinpoint.

Parameters:
member - the member associated with the joinpoint.
transformationIndex - index of the transformation text which, along with member, identifies the joinpoint to be unwrapped.

isNotPrepared

public boolean isNotPrepared(javassist.CtMember member,
                             int transformationIndex)
Checks if the joinpoint is not prepared.

Parameters:
member - the member associated with the joinpoint.
transformationIndex - index of the transformation text which, along with member, identifies the joinpoint whose status will be checked.

isWrapped

public boolean isWrapped(javassist.CtMember member,
                         int transformationIndex)
Checks if the joinpoint is wrapped.

Parameters:
member - the member associated with the joinpoint.
transformationIndex - index of the transformation text which, along with member, identifies the joinpoint whose status will be checked.


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