01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: *
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: /**
20: * @author Mikhail A. Markov, Vasily Zakharov
21: * @version $Revision: 1.1.2.1 $
22: */package org.apache.harmony.rmi.test;
23:
24: import java.io.Serializable;
25:
26: import java.lang.reflect.InvocationHandler;
27: import java.lang.reflect.Method;
28:
29: /**
30: * @author Mikhail A. Markov, Vasily Zakharov
31: * @version $Revision: 1.1.2.1 $
32: */
33: public class MyInvocationHandler implements InvocationHandler,
34: Serializable {
35:
36: public Object invoke(Object proxy, Method method, Object[] args)
37: throws Throwable {
38: if (method.getName().equals("hashCode")) {
39: return new Integer(0);
40: }
41:
42: System.out.print("MyInvocationHandler: method = " + method
43: + ", args = ");
44:
45: if (args == null) {
46: System.out.println("null");
47: } else if (args.length == 0) {
48: System.out.println("<>");
49: } else {
50: for (int i = 0; i < args.length - 1; ++i) {
51: System.out.print(args[i].toString() + ", ");
52: }
53: System.out.println(args[args.length - 1].toString());
54: }
55: return null;
56: }
57: }
|