ProxyObject (JNA API)

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

## Class ProxyObject

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

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

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

  This object acts as the invocation handler for interfaces annotated with ComInterface. It wraps all (necessary) low level COM calls and executes them on a 'ComThread' held by the Factory object.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) ComThread` | `comThread`
    `(package private) Factory` | `factory`
    `static WinDef.LCID` | `LOCALE_SYSTEM_DEFAULT` The Constant LOCALE_SYSTEM_DEFAULT.
    `static WinDef.LCID` | `LOCALE_USER_DEFAULT` The Constant LOCALE_USER_DEFAULT.
    `(package private) IDispatch` | `rawDispatch`
    `(package private) java.lang.Class<?>` | `theInterface`
    `(package private) long` | `unknownId`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProxyObject(java.lang.Class<?> theInterface, IDispatch rawDispatch, Factory factory)`
    `ProxyObject(java.lang.Class<?> theInterface, long unknownId, IDispatch rawDispatch, Factory factory)` when proxy is created for arguments on a call back, they are already on the com thread, and hence calling 'getUnknownId' will not work as it uses the ComThread however, the unknown pointer value is passed in;

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `IComEventCallbackCookie` | `advise(java.lang.Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener)`
    `void` | `dispose(int r)`
    `boolean` | `equals(java.lang.Object arg)`
    `(package private) ConnectionPoint` | `fetchRawConnectionPoint(Guid.IID iid)`
    `protected void` | `finalize()`
    `(package private) Guid.IID` | `getIID(ComInterface annotation)`
    `<T> T` | `getProperty(java.lang.Class<T> returnType, java.lang.String name, java.lang.Object... args)`
    `IDispatch` | `getRawDispatch()`
    `(package private) long` | `getUnknownId()`
    `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, java.lang.String name, java.lang.Object... args)`
    `(package private) java.lang.Object` | `invokeSynchronised(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)`
    `protected WinNT.HRESULT` | `oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId)`
    `protected WinNT.HRESULT` | `oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId, Variant.VARIANT pArg)`
    `protected WinNT.HRESULT` | `oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId, Variant.VARIANT[] pArgs)`
    `protected WinNT.HRESULT` | `oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, java.lang.String name)`
    `protected WinNT.HRESULT` | `oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, java.lang.String name, Variant.VARIANT pArg)`
    `protected WinNT.HRESULT` | `oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, java.lang.String name, Variant.VARIANT[] pArgs)`
    `<T> T` | `queryInterface(java.lang.Class<T> comInterface)` Returns a proxy object for the given interface.
    `<T> void` | `setProperty(java.lang.String name, T value)`
    `java.lang.String` | `toString()`
    `void` | `unadvise(java.lang.Class<?> comEventCallbackInterface, IComEventCallbackCookie cookie)`

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

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

- - ### Field Detail

    - #### unknownId

          long unknownId

    - #### theInterface

          java.lang.Class<?> theInterface

    - #### factory

          Factory factory

    - #### comThread

          ComThread comThread

    - #### rawDispatch

          IDispatch rawDispatch

    - #### LOCALE_USER_DEFAULT

          public static final WinDef.LCID LOCALE_USER_DEFAULT

      The Constant LOCALE_USER_DEFAULT.

    - #### LOCALE_SYSTEM_DEFAULT

          public static final WinDef.LCID LOCALE_SYSTEM_DEFAULT

      The Constant LOCALE_SYSTEM_DEFAULT.

  - ### Constructor Detail

    - #### ProxyObject

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

    - #### ProxyObject

          ProxyObject(java.lang.Class<?> theInterface,
                     long unknownId,
                     IDispatch rawDispatch,
                     Factory factory)

      when proxy is created for arguments on a call back, they are already on the com thread, and hence calling 'getUnknownId' will not work as it uses the ComThread however, the unknown pointer value is passed in;
      Parameters:
        `theInterface` -
        `unknownId` -
        `rawDispatch` -
        `factory` -

  - ### Method Detail

    - #### getUnknownId

          long getUnknownId()

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

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

    - #### dispose

          public void dispose(int r)

    - #### 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`

    - #### invokeSynchronised

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

      Throws:
        `java.lang.Throwable`

    - #### fetchRawConnectionPoint

          ConnectionPoint fetchRawConnectionPoint(Guid.IID iid)
                                            throws java.lang.InterruptedException,
                                                   java.util.concurrent.ExecutionException,
                                                   java.util.concurrent.TimeoutException

      Throws:
        `java.lang.InterruptedException`
        `java.util.concurrent.ExecutionException`
        `java.util.concurrent.TimeoutException`

    - #### advise

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

    - #### unadvise

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

    - #### setProperty

          public <T> void setProperty(java.lang.String name,
                             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`

    - #### invokeMethod

          public <T> T invokeMethod(java.lang.Class<T> returnType,
                           java.lang.String name,
                           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`

    - #### getIID

          Guid.IID getIID(ComInterface annotation)

    - #### oleMethod

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

      Throws:
        `COMException`

    - #### oleMethod

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

      Throws:
        `COMException`

    - #### oleMethod

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

      Throws:
        `COMException`

    - #### oleMethod

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

      Throws:
        `COMException`

    - #### oleMethod

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

      Throws:
        `COMException`

    - #### oleMethod

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

      Throws:
        `COMException`

Copyright © 2007-2016 Timothy Wall. All Rights Reserved.