com.jacob.com

## Class InvocationProxy

- java.lang.Object
- - com.jacob.com.InvocationProxy

Direct Known Subclasses:
  ActiveXInvocationProxy, InvocationProxyAllVariants

    public abstract class InvocationProxy
    extends java.lang.Object

Version:
  $Id$
Author:
  joe DispatchEvents wraps this class around any event handlers before making the JNI call that sets up the link with EventProxy. This means that EventProxy.cpp just calls invoke(String,Variant[]) against the instance of this class. Then this class does reflection against the event listener to call the actual event methods. The event methods can return void or return a Variant. Any value returned will be passed back to the calling windows module by the Jacob JNI layer.

  The void returning signature is the standard legacy signature. The Variant returning signature was added in 1.10 to support event handlers returning values.

### Field Summary

Fields
`protected java.lang.Object` `mTargetObject` the object we will try and forward to.

### Constructor Summary

Constructors
`protected` `InvocationProxy()` dummy constructor for subclasses that don't actually wrap anything and just want to override the invoke() method

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`Variant` `getVariant()` used by EventProxy.cpp to create variant objects in the right thread
`abstract Variant` `invoke(java.lang.String methodName, Variant[] targetParameters)` The method actually invoked by EventProxy.cpp.
`void` `setTarget(java.lang.Object pTargetObject)` Sets the target for this InvocationProxy.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mTargetObject

    protected java.lang.Object mTargetObject

the object we will try and forward to.

### Constructor Detail

#### InvocationProxy

    protected InvocationProxy()

dummy constructor for subclasses that don't actually wrap anything and just want to override the invoke() method

### Method Detail

#### invoke

    public abstract Variant invoke(java.lang.String methodName,
                                   Variant[] targetParameters)

The method actually invoked by EventProxy.cpp. The method name is calculated by the underlying JNI code from the MS windows Callback function name. The method is assumed to take an array of Variant objects. The method may return a Variant or be a void. Those are the only two options that will not blow up.

Subclasses that override this should make sure mTargetObject is not null before processing.

Parameters:
  `methodName` - name of method in mTargetObject we will invoke
  `targetParameters` - Variant[] that is the single parameter to the method
Returns:
  an object that will be returned to the com event caller

#### getVariant

    public Variant getVariant()

used by EventProxy.cpp to create variant objects in the right thread

Returns:
  Variant object that will be used by the COM layer

#### setTarget

    public void setTarget(java.lang.Object pTargetObject)

Sets the target for this InvocationProxy.

Parameters:
  `pTargetObject` -
Throws:
  `java.lang.IllegalArgumentException` - if target is not publicly accessible