Package com.sun.jna.platform.win32.COM.util

## Class ProxyObject

- java.lang.Object
- - com.sun.jna.platform.win32.COM.util.ProxyObject

All Implemented Interfaces:
  `IConnectionPoint`, `IDispatch`, `IRawDispatchHandle`, `IUnknown`, `java.lang.reflect.InvocationHandler`

    public class ProxyObject
    extends java.lang.Object
    implements java.lang.reflect.InvocationHandler, IDispatch, IRawDispatchHandle, IConnectionPoint

This object acts as the invocation handler for interfaces annotated with ComInterface. It wraps all (necessary) low level COM calls and dispatches them through the COM runtime.

The caller of the methods is responsible for correct initialization of the COM runtime and appropriate thread-handling - depending on the choosen handling model.

See Also:
  MSDN - Processes, Threads, and Apartments, MSDN - Understanding and Using COM Threading Models

### Constructor Summary

Constructors
`ProxyObject​(java.lang.Class<?> theInterface, IDispatch rawDispatch, ObjectFactory factory)`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`IComEventCallbackCookie` `advise​(java.lang.Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener)` Set up the comEventCallbackListener to receive callback events from the target COM object
`void` `dispose()`
`boolean` `equals​(java.lang.Object arg)`
`protected void` `finalize()`
`<T> T` `getProperty​(java.lang.Class<T> returnType, OaIdl.DISPID dispID, java.lang.Object... args)`
`<T> T` `getProperty​(java.lang.Class<T> returnType, java.lang.String name, java.lang.Object... args)`
`IDispatch` `getRawDispatch()`
`int` `hashCode()`
`java.lang.Object` `invoke​(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)`
`<T> T` `invokeMethod​(java.lang.Class<T> returnType, OaIdl.DISPID dispID, java.lang.Object... args)`
`<T> T` `invokeMethod​(java.lang.Class<T> returnType, java.lang.String name, java.lang.Object... args)`
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId)` Deprecated.
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId, Variant.VARIANT pArg)` Deprecated.
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId, Variant.VARIANT[] pArgs)` Deprecated.
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, java.lang.String name)` Deprecated.
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, java.lang.String name, Variant.VARIANT pArg)` Deprecated.
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, java.lang.String name, Variant.VARIANT[] pArgs)` Deprecated.
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, OaIdl.DISPID dispId)`
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, OaIdl.DISPID dispId, Variant.VARIANT pArg)`
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, OaIdl.DISPID dispId, Variant.VARIANT[] pArgs)`
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, java.lang.String name)`
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, java.lang.String name, Variant.VARIANT pArg)`
`protected WinNT.HRESULT` `oleMethod​(int nType, Variant.VARIANT.ByReference pvResult, java.lang.String name, Variant.VARIANT[] pArgs)`
`<T> T` `queryInterface​(java.lang.Class<T> comInterface)` Returns a proxy object for the given interface.
`protected OaIdl.DISPID` `resolveDispId​(IDispatch pDisp, java.lang.String name)` Deprecated.
`protected OaIdl.DISPID` `resolveDispId​(java.lang.String name)`
`<T> void` `setProperty​(OaIdl.DISPID dispId, T value)`
`<T> void` `setProperty​(java.lang.String name, T value)`
`java.lang.String` `toString()`
`void` `unadvise​(java.lang.Class<?> comEventCallbackInterface, IComEventCallbackCookie cookie)` Stop listening for callback events

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

`clone, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### ProxyObject

    public ProxyObject​(java.lang.Class<?> theInterface,
                       IDispatch rawDispatch,
                       ObjectFactory factory)

### Method Detail

#### finalize

    protected void finalize()
                     throws java.lang.Throwable

Overrides:
  `finalize` in class `java.lang.Object`
Throws:
  `java.lang.Throwable`

#### dispose

    public void dispose()

#### getRawDispatch

    public IDispatch getRawDispatch()

Specified by:
  `getRawDispatch` in interface `IRawDispatchHandle`

#### equals

    public boolean equals​(java.lang.Object arg)

Overrides:
  `equals` in class `java.lang.Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### invoke

    public java.lang.Object invoke​(java.lang.Object proxy,
                                   java.lang.reflect.Method method,
                                   java.lang.Object[] args)
                            throws java.lang.Throwable

Specified by:
  `invoke` in interface `java.lang.reflect.InvocationHandler`
Throws:
  `java.lang.Throwable`

#### advise

    public IComEventCallbackCookie advise​(java.lang.Class<?> comEventCallbackInterface,
                                          IComEventCallbackListener comEventCallbackListener)
                                   throws COMException

Description copied from interface: `IConnectionPoint`
Set up the comEventCallbackListener to receive callback events from the target COM object

Specified by:
  `advise` in interface `IConnectionPoint`
Parameters:
  `comEventCallbackInterface` - - the COM interface that the listener will receive events from
  `comEventCallbackListener` - - and object that will receive the callback events
Returns:
  - a cookie that can be used to detach (unadvise) the event callback listener throws COMException if an error occurs trying to set up the listener on the target COM object, see exception cause for details.
Throws:
  `COMException`

#### unadvise

    public void unadvise​(java.lang.Class<?> comEventCallbackInterface,
                         IComEventCallbackCookie cookie)
                  throws COMException

Description copied from interface: `IConnectionPoint`
Stop listening for callback events

Specified by:
  `unadvise` in interface `IConnectionPoint`
Parameters:
  `comEventCallbackInterface` - - the interface that is being listened to
  `cookie` - - the cookie that was returned when advise was called
Throws:
  `COMException`

#### setProperty

    public <T> void setProperty​(java.lang.String name,
                                T value)

Specified by:
  `setProperty` in interface `IDispatch`

#### setProperty

    public <T> void setProperty​(OaIdl.DISPID dispId,
                                T value)

Specified by:
  `setProperty` in interface `IDispatch`

#### getProperty

    public <T> T getProperty​(java.lang.Class<T> returnType,
                             java.lang.String name,
                             java.lang.Object... args)

Specified by:
  `getProperty` in interface `IDispatch`

#### getProperty

    public <T> T getProperty​(java.lang.Class<T> returnType,
                             OaIdl.DISPID dispID,
                             java.lang.Object... args)

Specified by:
  `getProperty` in interface `IDispatch`

#### invokeMethod

    public <T> T invokeMethod​(java.lang.Class<T> returnType,
                              java.lang.String name,
                              java.lang.Object... args)

Specified by:
  `invokeMethod` in interface `IDispatch`

#### invokeMethod

    public <T> T invokeMethod​(java.lang.Class<T> returnType,
                              OaIdl.DISPID dispID,
                              java.lang.Object... args)

Specified by:
  `invokeMethod` in interface `IDispatch`

#### queryInterface

    public <T> T queryInterface​(java.lang.Class<T> comInterface)
                         throws COMException

Description copied from interface: `IUnknown`
Returns a proxy object for the given interface. Assuming that the interface is annotated with a ComInterface annotation that provides a valid iid.

Will throw COMException if an error occurs trying to retrieve the requested interface, see exception cause for details.

Specified by:
  `queryInterface` in interface `IUnknown`
Throws:
  `COMException`

#### resolveDispId

    protected OaIdl.DISPID resolveDispId​(java.lang.String name)

#### oleMethod

    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      java.lang.String name,
                                      Variant.VARIANT pArg)
                               throws COMException

Throws:
  `COMException`

#### oleMethod

    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      OaIdl.DISPID dispId,
                                      Variant.VARIANT pArg)
                               throws COMException

Throws:
  `COMException`

#### oleMethod

    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      java.lang.String name)
                               throws COMException

Throws:
  `COMException`

#### oleMethod

    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      OaIdl.DISPID dispId)
                               throws COMException

Throws:
  `COMException`

#### oleMethod

    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      java.lang.String name,
                                      Variant.VARIANT[] pArgs)
                               throws COMException

Throws:
  `COMException`

#### oleMethod

    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      OaIdl.DISPID dispId,
                                      Variant.VARIANT[] pArgs)
                               throws COMException

Throws:
  `COMException`

#### resolveDispId

    @Deprecated
    protected OaIdl.DISPID resolveDispId​(IDispatch pDisp,
                                         java.lang.String name)

Deprecated.

#### oleMethod

    @Deprecated
    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      IDispatch pDisp,
                                      java.lang.String name,
                                      Variant.VARIANT pArg)
                               throws COMException

Deprecated.

Throws:
  `COMException`

#### oleMethod

    @Deprecated
    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      IDispatch pDisp,
                                      OaIdl.DISPID dispId,
                                      Variant.VARIANT pArg)
                               throws COMException

Deprecated.

Throws:
  `COMException`

#### oleMethod

    @Deprecated
    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      IDispatch pDisp,
                                      java.lang.String name)
                               throws COMException

Deprecated.

Throws:
  `COMException`

#### oleMethod

    @Deprecated
    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      IDispatch pDisp,
                                      OaIdl.DISPID dispId)
                               throws COMException

Deprecated.

Throws:
  `COMException`

#### oleMethod

    @Deprecated
    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      IDispatch pDisp,
                                      java.lang.String name,
                                      Variant.VARIANT[] pArgs)
                               throws COMException

Deprecated.

Throws:
  `COMException`

#### oleMethod

    @Deprecated
    protected WinNT.HRESULT oleMethod​(int nType,
                                      Variant.VARIANT.ByReference pvResult,
                                      IDispatch pDisp,
                                      OaIdl.DISPID dispId,
                                      Variant.VARIANT[] pArgs)
                               throws COMException

Deprecated.

Throws:
  `COMException`