KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > prose > crosscut > WildcardWildcardMcutAdvice


1 //
2
// This file is part of the prose package.
3
//
4
// The contents of this file are subject to the Mozilla Public License
5
// Version 1.1 (the "License"); you may not use this file except in
6
// compliance with the License. You may obtain a copy of the License at
7
// http://www.mozilla.org/MPL/
8
//
9
// Software distributed under the License is distributed on an "AS IS" basis,
10
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
// for the specific language governing rights and limitations under the
12
// License.
13
//
14
// The Original Code is prose.
15
//
16
// The Initial Developer of the Original Code is Andrei Popovici. Portions
17
// created by Andrei Popovici are Copyright (C) 2002 Andrei Popovici.
18
// All Rights Reserved.
19
//
20
// Contributor(s):
21
package ch.ethz.prose.crosscut;
22 import java.lang.IllegalAccessException JavaDoc;
23 import ch.ethz.jvmai.JoinPoint;
24 import java.lang.System JavaDoc;
25 import java.lang.Object JavaDoc;
26 import java.lang.reflect.InvocationTargetException JavaDoc;
27 /** An advice execution for an advice action of the form
28     * <code>XXX(ANY thisObj,REST otherParams</em>)</code>
29     */

30   class WildcardWildcardMcutAdvice extends McutAdvice
31   {
32     private final MethodCut methodCut;
33     WildcardWildcardMcutAdvice(MethodCut methodCut, JoinPoint m, MethodCutSignaturePattern a)
34       {super(methodCut, m,a);
35     this.methodCut = methodCut;}
36
37       /** Unpack the stack parameters and create two arguments objects
38        * of type ANY and REST.
39        */

40     protected void execute() throws IllegalAccessException JavaDoc, InvocationTargetException JavaDoc
41       {
42     ANY adviceThis = new ANY();
43     adviceThis.setObject(stackArgs[0]);
44     REST adviceRest = new REST();
45     Object JavaDoc[] restParams = new Object JavaDoc[stackArgsLength - 1 ];
46     System.arraycopy(stackArgs,1,restParams,0,restParams.length);
47     adviceRest.setObject(restParams);
48     advice.methodObj.invoke(methodCut,new Object JavaDoc[]{adviceThis,adviceRest});
49       }
50   }
51
Popular Tags