Class ProxyObject
java.lang.Object
com.sun.jna.platform.win32.COM.util.ProxyObject
- All Implemented Interfaces:
IConnectionPoint,IDispatch,IRawDispatchHandle,IUnknown,InvocationHandler
public class ProxyObject
extends Object
implements 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.
-
Constructor Summary
ConstructorsConstructorDescriptionProxyObject(Class<?> theInterface, IDispatch rawDispatch, ObjectFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionadvise(Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener) Set up the comEventCallbackListener to receive callback events from the target COM objectvoiddispose()booleanprotected voidfinalize()<T> TgetProperty(Class<T> returnType, OaIdl.DISPID dispID, Object... args) <T> TgetProperty(Class<T> returnType, String name, Object... args) inthashCode()<T> TinvokeMethod(Class<T> returnType, OaIdl.DISPID dispID, Object... args) <T> TinvokeMethod(Class<T> returnType, String name, Object... args) protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId) Deprecated.protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId, Variant.VARIANT pArg) Deprecated.protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, OaIdl.DISPID dispId, Variant.VARIANT[] pArgs) Deprecated.protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, String name) Deprecated.protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, String name, Variant.VARIANT pArg) Deprecated.protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, String name, Variant.VARIANT[] pArgs) Deprecated.protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, OaIdl.DISPID dispId) protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, OaIdl.DISPID dispId, Variant.VARIANT pArg) protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, OaIdl.DISPID dispId, Variant.VARIANT[] pArgs) protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, String name) protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, String name, Variant.VARIANT pArg) protected WinNT.HRESULToleMethod(int nType, Variant.VARIANT.ByReference pvResult, String name, Variant.VARIANT[] pArgs) <T> TqueryInterface(Class<T> comInterface) Returns a proxy object for the given interface.protected OaIdl.DISPIDresolveDispId(IDispatch pDisp, String name) Deprecated.protected OaIdl.DISPIDresolveDispId(String name) <T> voidsetProperty(OaIdl.DISPID dispId, T value) <T> voidsetProperty(String name, T value) toString()voidunadvise(Class<?> comEventCallbackInterface, IComEventCallbackCookie cookie) Stop listening for callback events
-
Constructor Details
-
ProxyObject
-
-
Method Details
-
finalize
-
dispose
public void dispose() -
getRawDispatch
- Specified by:
getRawDispatchin interfaceIRawDispatchHandle
-
equals
-
hashCode
public int hashCode() -
toString
-
invoke
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
advise
public IComEventCallbackCookie advise(Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener) throws COMException Description copied from interface:IConnectionPointSet up the comEventCallbackListener to receive callback events from the target COM object- Specified by:
advisein interfaceIConnectionPoint- Parameters:
comEventCallbackInterface- - the COM interface that the listener will receive events fromcomEventCallbackListener- - 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(Class<?> comEventCallbackInterface, IComEventCallbackCookie cookie) throws COMException Description copied from interface:IConnectionPointStop listening for callback events- Specified by:
unadvisein interfaceIConnectionPoint- Parameters:
comEventCallbackInterface- - the interface that is being listened tocookie- - the cookie that was returned when advise was called- Throws:
COMException
-
setProperty
- Specified by:
setPropertyin interfaceIDispatch
-
setProperty
- Specified by:
setPropertyin interfaceIDispatch
-
getProperty
- Specified by:
getPropertyin interfaceIDispatch
-
getProperty
- Specified by:
getPropertyin interfaceIDispatch
-
invokeMethod
- Specified by:
invokeMethodin interfaceIDispatch
-
invokeMethod
- Specified by:
invokeMethodin interfaceIDispatch
-
queryInterface
Description copied from interface:IUnknownReturns 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:
queryInterfacein interfaceIUnknown- Throws:
COMException
-
resolveDispId
-
oleMethod
protected WinNT.HRESULT oleMethod(int nType, Variant.VARIANT.ByReference pvResult, 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, 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, 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. -
oleMethod
@Deprecated protected WinNT.HRESULT oleMethod(int nType, Variant.VARIANT.ByReference pvResult, IDispatch pDisp, 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, 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, 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
-