KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > remoting > invocation > NameBasedInvocation


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  *
7  */

8
9 package org.jboss.remoting.invocation;
10
11 import java.lang.reflect.Method JavaDoc;
12
13 /**
14  * NameBasedInvocation.java is an invocation object in jmx style.
15  * <p/>
16  * <p/>
17  * Created: Mon Apr 28 09:14:46 2003
18  *
19  * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
20  * @version 1.0
21  */

22 public class NameBasedInvocation extends RemoteInvocation
23 {
24    /**
25     * @since 4.0.1
26     */

27    static final long serialVersionUID = -6507163932605308471L;
28
29    private final String JavaDoc[] sig;
30
31    public NameBasedInvocation(final Method JavaDoc method, final Object JavaDoc[] params)
32    {
33       super(method.getName(), params);
34       sig = generateSignatureFromMethod(method);
35    }
36
37    private String JavaDoc[] generateSignatureFromMethod(final Method JavaDoc method)
38    {
39       Class JavaDoc[] parameterTypes = method.getParameterTypes();
40       String JavaDoc[] signature = new String JavaDoc[parameterTypes.length];
41       for(int i = 0; i < parameterTypes.length; i++)
42       {
43          Class JavaDoc parameterType = parameterTypes[i];
44          signature[i] = parameterType.getName();
45       }
46       return signature;
47    }
48
49    public NameBasedInvocation(final String JavaDoc methodName, final Object JavaDoc[] params, final String JavaDoc[] sig)
50    {
51       super(methodName, params);
52       this.sig = sig;
53    } // NameBasedInvocation constructor
54

55    public String JavaDoc[] getSignature()
56    {
57       return sig;
58    }
59
60    public String JavaDoc toString()
61    {
62       return "NameBasedInvocation [" + methodName + "]";
63    }
64
65 } // NameBasedInvocation
66
Popular Tags