1 /***************************************************************************************
2 * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
3 * http://aspectwerkz.codehaus.org *
4 * ---------------------------------------------------------------------------------- *
5 * The software in this package is published under the terms of the LGPL license *
6 * a copy of which has been included with this distribution in the license.txt file. *
7 **************************************************************************************/
8 package org.codehaus.aspectwerkz;
9
10 /***
11 * Interface for the mixin implementations.
12 *
13 * @author <a href="mailto:jboner@codehaus.org">Jonas Bonér </a>
14 */
15 public interface Mixin {
16 /***
17 * Returns the name of the mixin.
18 *
19 * @return the name
20 */
21 String getName();
22
23 /***
24 * Returns the deployment model.
25 *
26 * @return the deployment model
27 */
28 int getDeploymentModel();
29
30 /***
31 * Invokes the method with the index specified. Invoked by methods without any parameters (slight performance gain
32 * since we are saving us one array creation).
33 *
34 * @param methodIndex the method index
35 * @param callingObject a reference to the calling object
36 * @return the result from the invocation
37 */
38 Object invokeMixin(int methodIndex, Object callingObject) throws Throwable;
39
40 /***
41 * Invokes an introduced method with the index specified.
42 *
43 * @param methodIndex the method index
44 * @param parameters the parameters for the invocation
45 * @param callingObject a reference to the calling object
46 * @return the result from the invocation
47 */
48 Object invokeMixin(int methodIndex, Object[] parameters, Object callingObject) throws Throwable;
49
50 /***
51 * Returns the implementation class name for the mixin.
52 *
53 * @return the implementation class name for the mixin
54 */
55 String getImplementationClassName();
56
57 /***
58 * Swaps the current introduction implementation.
59 *
60 * @param className the class name of the new implementation
61 */
62 void swapImplementation(String className);
63 }