com.moesol.bindings
Class DispatchJavaMethod

java.lang.Object
  extended by com.moesol.bindings.DispatchJavaMethod

public class DispatchJavaMethod
extends Object

Internal helper. Record the dispatch id, invocation kind, reflection method, method name, and method signature. This class is used by the native GenericIDispatch class to call the correct Java method when IDispatch::Invoke is called. It is also used by the ComInterfaceThunk to call the correct Java method when the vtable entry is thunked.


Constructor Summary
DispatchJavaMethod(int disp_id, short invkind, String name, String sig)
          Construct a Dispatch ID to Java Method mapping.
 
Method Summary
 void fillInMethod(Class iface_class)
          Fill in the Java Method for this mapping if not already filled in.
static Class findDispClassForIID(Object object, GUID iid)
          Find the Disp implementation class for an IID.
 int getDispId()
           
 short getInvKind()
           
 Method getJavaMethod()
           
 String getMethodName()
           
 String getMethodSig()
           
 Object invoke(Object target, Object[] args)
          Call underlying Java method.
 boolean isMatch(int disp_id, short invkind)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DispatchJavaMethod

public DispatchJavaMethod(int disp_id,
                          short invkind,
                          String name,
                          String sig)
Construct a Dispatch ID to Java Method mapping.

Parameters:
disp_id - dispatch id
invkind - invocation kind (DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF).
name - Java method name
sig - JNI method signature
Method Detail

findDispClassForIID

public static Class findDispClassForIID(Object object,
                                        GUID iid)
Find the Disp implementation class for an IID. This is a relatively slow search, so users of this method will probably want to cache the results.

Parameters:
object - A Java object we think implements an interface with an IID of iid.
iid - The GUID we are trying to find.
Returns:
The Class found. If we are looking for IFoo.IID then we will return IFoo.Disp
Throws:
COMException - if we cannot find the class.

isMatch

public boolean isMatch(int disp_id,
                       short invkind)

invoke

public Object invoke(Object target,
                     Object[] args)
              throws IllegalArgumentException,
                     IllegalAccessException,
                     InvocationTargetException
Call underlying Java method.

Parameters:
target -
args -
Returns:
result of invoking the java method.
Throws:
IllegalArgumentException
IllegalAccessException
InvocationTargetException

getDispId

public int getDispId()
Returns:
dispatch id

getInvKind

public short getInvKind()
Returns:
invocation kind

getJavaMethod

public Method getJavaMethod()
Returns:
Java method's reflected Method

getMethodName

public String getMethodName()
Returns:
Java method name.

getMethodSig

public String getMethodSig()
Returns:
Java method's JNI signature.

fillInMethod

public void fillInMethod(Class iface_class)
                  throws NoSuchMethodException
Fill in the Java Method for this mapping if not already filled in.

Parameters:
iface_class -
Throws:
NoSuchMethodException


Copyright © 2004 Moebius Solutions, Inc. All Rights Reserved.