org.codehaus.aspectwerkz.xmldef.introduction
Class Introduction

java.lang.Object
  extended byorg.codehaus.aspectwerkz.xmldef.introduction.Introduction
All Implemented Interfaces:
Mixin, java.io.Serializable

public class Introduction
extends java.lang.Object
implements java.io.Serializable, Mixin

Implements the concept of Introductions, which is similar to the concept of Open Classes A Mixins.
An Introduction makes it possible to extend a class with a new interface A a new implementation (methods A fields).

Supports four different deployment models: PER_JVM, PER_CLASS, PER_INSTANCE A PER_THREAD.
The PER_JVM deployment model performance a bit better than the other models since no synchronization A object creation is needed. todo: m_container is transient but not restored. is that ok ?

Author:
Jonas Bonér
See Also:
Serialized Form

Field Summary
static java.lang.Object[] EMPTY_OBJECT_ARRAY
          An empty Object array.
 
Constructor Summary
Introduction(java.lang.String name, java.lang.String anInterface)
          Creates an introduction with an interface.
Must be an interface without any methods.
Introduction(java.lang.String name, java.lang.String intf, java.lang.Class implClass, int deploymentModel)
          Creates an introduction with an interface A an implementation.
 
Method Summary
 int ___AW_getDeploymentModel()
          Returns the deployment model.
 java.lang.String ___AW_getImplementationClassName()
          Returns the implementation class name for the mixin.
 java.lang.String ___AW_getName()
          Returns the name of the introduction.
 java.lang.Object ___AW_invokeMixin(int methodIndex, java.lang.Object callingObject)
          Invokes the method with the index specified.
 java.lang.Object ___AW_invokeMixin(int methodIndex, java.lang.Object[] parameters, java.lang.Object callingObject)
          Invokes the method with the index specified.
 void ___AW_swapImplementation(java.lang.String className)
          Swaps the current introduction implementation.
 IntroductionContainer getContainer()
          Returns the container.
 ContainerType getContainerType()
          Returns the container type.
 java.lang.String getInterface()
          Returns the interface.
 java.lang.reflect.Method getMethod(int index)
          Returns a specific method by the method index.
 java.lang.reflect.Method[] getMethods()
          Returns all the methods for this introduction.
 void setContainer(IntroductionContainer container)
          Sets the container.
 void setName(java.lang.String name)
          Sets the name of the introduction.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_OBJECT_ARRAY

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

Constructor Detail

Introduction

public Introduction(java.lang.String name,
                    java.lang.String anInterface)
Creates an introduction with an interface.
Must be an interface without any methods.

Parameters:
name - the name of the introduction
anInterface - an interface

Introduction

public Introduction(java.lang.String name,
                    java.lang.String intf,
                    java.lang.Class implClass,
                    int deploymentModel)
Creates an introduction with an interface A an implementation.

Parameters:
name - the name of the introduction
intf - the interface
implClass - the implementation class
deploymentModel - the deployment model
Method Detail

___AW_invokeMixin

public java.lang.Object ___AW_invokeMixin(int methodIndex,
                                          java.lang.Object callingObject)
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:
___AW_invokeMixin in interface Mixin
Parameters:
methodIndex - the method index
callingObject - a reference to the calling object
Returns:
the result from the invocation

___AW_invokeMixin

public java.lang.Object ___AW_invokeMixin(int methodIndex,
                                          java.lang.Object[] parameters,
                                          java.lang.Object callingObject)
Invokes the method with the index specified.

Specified by:
___AW_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

___AW_getImplementationClassName

public java.lang.String ___AW_getImplementationClassName()
Returns the implementation class name for the mixin.

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

___AW_swapImplementation

public void ___AW_swapImplementation(java.lang.String className)
Swaps the current introduction implementation.

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

___AW_getName

public java.lang.String ___AW_getName()
Returns the name of the introduction.

Specified by:
___AW_getName in interface Mixin
Returns:
the name

___AW_getDeploymentModel

public int ___AW_getDeploymentModel()
Returns the deployment model.

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

setName

public void setName(java.lang.String name)
Sets the name of the introduction.

Parameters:
name - the name of the introduction

getInterface

public java.lang.String getInterface()
Returns the interface.

Returns:
the interface

getMethod

public java.lang.reflect.Method getMethod(int index)
Returns a specific method by the method index.

Parameters:
index - the method index
Returns:
the method

getMethods

public java.lang.reflect.Method[] getMethods()
Returns all the methods for this introduction.

Returns:
the methods

setContainer

public void setContainer(IntroductionContainer container)
Sets the container.

Parameters:
container - the container

getContainer

public IntroductionContainer getContainer()
Returns the container.

Returns:
the container

getContainerType

public ContainerType getContainerType()
Returns the container type.

Returns:
the container type


Copyright (c) 2002-2004 The AspectWerkz Team. All Rights Reserved.