org.codehaus.aspectwerkz.aspect
Class Introduction

java.lang.Object
  extended byorg.codehaus.aspectwerkz.aspect.Introduction
All Implemented Interfaces:
Mixin

public class Introduction
extends Object
implements Mixin

Interface+Implementation Introduction

This represents the inner class mixin based implementation in the system

Author:
Alexandre Vasseur , Jonas Bonér

Field Summary
static Object[] EMPTY_OBJECT_ARRAY
          An empty Object array.
protected  int m_deploymentModel
          Holds the deployment model.
 
Constructor Summary
Introduction(String name, Class implClass, CrossCuttingInfo crossCuttingInfo, IntroductionDefinition definition)
          Create a new introduction
 
Method Summary
 void createMixin()
          Creates a new mixin instance.
 CrossCuttingInfo getCrossCuttingInfo()
          Returns the cross-cutting info.
 int getDeploymentModel()
          Returns the mixin deployment model.
 Object getImplementation()
          Returns the implementation object for the mixin.
 Class getImplementationClass()
          Returns the implementation object for the mixin.
 String getImplementationClassName()
          Returns the implementation class name for the mixin.
 IntroductionDefinition getIntroductionDefinition()
          Returns the definition.
 String getName()
          Returns the name of the mixin.
 Object invokeMixin(int methodIndex, Object callingObject)
          Invokes the method with the index specified.
 Object invokeMixin(int methodIndex, Object[] parameters, Object callingObject)
          Invokes an introduced method with the index specified.
static Introduction newInstance(Introduction prototype, CrossCuttingInfo crossCuttingInfo)
          Clone the prototype Introduction.
 void setContainer(IntroductionContainer container)
          Set the container.
 void setDeploymentModel(int deploymentModel)
          Sets the deployment model.
 void swapImplementation(String className)
          Swaps the current introduction implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_OBJECT_ARRAY

public static final Object[] EMPTY_OBJECT_ARRAY
An empty Object array.


m_deploymentModel

protected int m_deploymentModel
Holds the deployment model. The deployment model of an introduction is tight to the aspect deployment model that defines it

Constructor Detail

Introduction

public Introduction(String name,
                    Class implClass,
                    CrossCuttingInfo crossCuttingInfo,
                    IntroductionDefinition definition)
Create a new introduction

Parameters:
name - of this introduction - by convention the AspectClassFQN $ InnerClass
implClass -
crossCuttingInfo - which defines this mixin
definition -
Method Detail

newInstance

public static Introduction newInstance(Introduction prototype,
                                       CrossCuttingInfo crossCuttingInfo)
Clone the prototype Introduction.

Parameters:
prototype - introduction
crossCuttingInfo - the cross-cutting info
Returns:
new introduction instance

createMixin

public void createMixin()
Creates a new mixin instance.


setContainer

public void setContainer(IntroductionContainer container)
Set the container.

Parameters:
container -

getCrossCuttingInfo

public CrossCuttingInfo getCrossCuttingInfo()
Returns the cross-cutting info.

Returns:
the cross-cutting info.

getIntroductionDefinition

public IntroductionDefinition getIntroductionDefinition()
Returns the definition.

Returns:
definition related to this introduction

getName

public String getName()
Returns the name of the mixin.

Specified by:
getName in interface Mixin
Returns:
the name

getDeploymentModel

public int getDeploymentModel()
Returns the mixin deployment model.

Specified by:
getDeploymentModel in interface Mixin
Returns:
the deployment model

setDeploymentModel

public void setDeploymentModel(int deploymentModel)
Sets the deployment model.

Parameters:
deploymentModel - the deployment model

invokeMixin

public Object invokeMixin(int methodIndex,
                          Object callingObject)
                   throws Throwable
Invokes the method with the index specified. Invoked by methods without any parameters (slight performance gain since we are saving us one array creation).

Specified by:
invokeMixin in interface Mixin
Parameters:
methodIndex - the method index
callingObject - a reference to the calling object
Returns:
the result from the invocation
Throws:
Throwable

invokeMixin

public Object invokeMixin(int methodIndex,
                          Object[] parameters,
                          Object callingObject)
                   throws Throwable
Invokes an introduced method with the index specified.

Specified by:
invokeMixin in interface Mixin
Parameters:
methodIndex - the method index
parameters - the parameters for the invocation
callingObject - a reference to the calling object
Returns:
the result from the invocation
Throws:
Throwable

getImplementationClassName

public String getImplementationClassName()
Returns the implementation class name for the mixin.

Specified by:
getImplementationClassName in interface Mixin
Returns:
the implementation class name for the mixin

getImplementationClass

public Class getImplementationClass()
Returns the implementation object for the mixin.

Returns:
the implementation for the mixin

getImplementation

public Object getImplementation()
Returns the implementation object for the mixin.

Returns:
the implementation for the mixin

swapImplementation

public void swapImplementation(String className)
Swaps the current introduction implementation.

Specified by:
swapImplementation in interface Mixin
Parameters:
className - the class name of the new implementation


Copyright © 2002-2004 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.