01: //
02: // This file is part of the prose package.
03: //
04: // The contents of this file are subject to the Mozilla Public License
05: // Version 1.1 (the "License"); you may not use this file except in
06: // compliance with the License. You may obtain a copy of the License at
07: // http://www.mozilla.org/MPL/
08: //
09: // 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:
23: import java.lang.IllegalAccessException;
24: import ch.ethz.jvmai.JoinPoint;
25: import java.lang.System;
26: import java.lang.Object;
27: import java.lang.reflect.InvocationTargetException;
28:
29: /** An advice execution for an advice action of the form
30: * <code>XXX(ANY thisObj,REST otherParams</em>)</code>
31: */
32: class WildcardWildcardMcutAdvice extends McutAdvice {
33: private static final long serialVersionUID = 3257002163988607286L;
34: private final MethodCut methodCut;
35:
36: WildcardWildcardMcutAdvice(MethodCut methodCut, JoinPoint m,
37: MethodCutSignaturePattern a) {
38: super (methodCut, m, a);
39: this .methodCut = methodCut;
40: }
41:
42: /** Unpack the stack parameters and create two arguments objects
43: * of type ANY and REST.
44: */
45: protected void execute() throws IllegalAccessException,
46: InvocationTargetException {
47: ANY adviceThis = new ANY();
48: adviceThis.setObject(stackArgs[0]);
49: REST adviceRest = new REST();
50: Object[] restParams = new Object[stackArgsLength - 1];
51: System
52: .arraycopy(stackArgs, 1, restParams, 0,
53: restParams.length);
54: adviceRest.setObject(restParams);
55: advice.methodObj.invoke(methodCut, new Object[] { adviceThis,
56: adviceRest });
57: }
58: }
|