01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tcclient.object;
06:
07: /**
08: * Representation of a distributed method call
09: */
10: public class DistributedMethodCall {
11: private final Object receiver;
12: private final Object[] parameters;
13: private final String methodName;
14: private final String paramDesc;
15:
16: /**
17: * Construct DMI call
18: * @param receiver Receiver object, should never be null
19: * @param parameters Parameters to method call, should never be null
20: * @param methodName Receiver method name, should never be null
21: * @param paramDesc Description of parameter types on method call, should never be null
22: */
23: public DistributedMethodCall(final Object receiver,
24: final Object[] parameters, final String methodName,
25: final String paramDesc) {
26: this .receiver = receiver;
27: this .parameters = parameters;
28: this .methodName = methodName;
29: this .paramDesc = paramDesc;
30: }
31:
32: /**
33: * @return Receiver object
34: */
35: public Object getReceiver() {
36: return receiver;
37: }
38:
39: /**
40: * @return Method name
41: */
42: public String getMethodName() {
43: return this .methodName;
44: }
45:
46: /**
47: * @return Parameters description
48: */
49: public String getParameterDesc() {
50: return paramDesc;
51: }
52:
53: /**
54: * @return Parameter values, never null
55: */
56: public final Object[] getParameters() {
57: // The parameters array is read here to make sure the elements are resolved -- passing the internal array to
58: // non-instrumented code would fail to resolve the elements, probably resulting in an NPE
59: Object[] rv = new Object[parameters.length];
60: for (int i = 0; i < parameters.length; i++)
61: rv[i] = parameters[i];
62: return rv;
63: }
64:
65: public String toString() {
66: return receiver.getClass().getName() + "." + methodName
67: + paramDesc;
68: }
69: }
|