View Javadoc

1   /**
2    * 
3    */
4   package org.sourceforge.jemmrpc.shared;
5   
6   /**
7    * The RPCCallMessage details an RPC call, giving information about the calling thread, target
8    * interface,method arguments and whether the call is synchronous or asynchronous.
9    * 
10   * @author Rory Graves
11   * 
12   */
13  public class RPCCallMessage extends Message
14  {
15      private static final long serialVersionUID = 1L;
16  
17      /** Whether this is an asynchronous call rather than a synchronous one. */
18      public final boolean asyncCall;
19  
20      /** Target interface class. */
21      protected final Class<?> ifClass;
22  
23      /** Target method name. */
24      protected final String methodName;
25  
26      /** Call parameters. */
27      private final Object[] parameters;
28  
29      /** method parameter types. */
30      public final Class<?>[] parameterTypes;
31  
32      /**
33       * @param threadId The threadId of the caller.
34       * @param asyncCall True for asynchronous call, false for synchronous.
35       * @param ifClass The target interface class.
36       * @param methodName The target method name.
37       * @param parameterTypes The parameter types of the target method.
38       * @param parameters The parameter values (wrapped if base types)
39       */
40      public RPCCallMessage(String threadId, boolean asyncCall, Class<?> ifClass,
41              String methodName, Class<?>[] parameterTypes, Object[] parameters)
42      {
43          super(threadId);
44          this.asyncCall = asyncCall;
45          this.ifClass = ifClass;
46          this.methodName = methodName;
47          this.parameterTypes = parameterTypes.clone();
48          this.parameters = parameters.clone();
49      }
50  
51      /**
52       * Return the called interface class.
53       * @return The class of the called interface.
54       */
55      public Class<?> getIfClass()
56      {
57          return ifClass;
58      }
59  
60      /**
61       * Return the parameters to the RPC call.
62       * @return The RPC call parameters.
63       */
64      public Object[] getParameters()
65      {
66          return parameters.clone();
67      }
68  }