public class Factory extends ObjectFactory
The Factory abstracts the necessity to handle COM threading by introducing a dispatching thread, that is correctly COM initialized and is used to handle all outgoing calls.
NOTE: Remember to call factory.getComThread().terminate() at some appropriate point, when the factory is not used anymore
Modifier and Type | Method and Description |
---|---|
(package private) IDispatchCallback |
createDispatchCallback(Class<?> comEventCallbackInterface,
IComEventCallbackListener comEventCallbackListener) |
<T> T |
createObject(Class<T> comInterface)
Creates a new COM object (CoCreateInstance) for the given progId and
returns a ProxyObject for the given interface.
|
<T> T |
createProxy(Class<T> comInterface,
IDispatch dispatch)
Creates a ProxyObject for the given interface and IDispatch pointer.
|
(package private) Guid.GUID |
discoverClsId(ComObject annotation) |
<T> T |
fetchObject(Class<T> comInterface)
Gets and existing COM object (GetActiveObject) for the given progId and
returns a ProxyObject for the given interface.
|
ComThread |
getComThread() |
IRunningObjectTable |
getRunningObjectTable()
CoInitialize must be called be fore this method.
|
disposeAll, finalize, getLCID, register, setLCID, unregister
public Factory()
public Factory(ComThread comThread)
public <T> T createProxy(Class<T> comInterface, IDispatch dispatch)
ObjectFactory
createProxy
in class ObjectFactory
Guid.GUID discoverClsId(ComObject annotation)
discoverClsId
in class ObjectFactory
public <T> T fetchObject(Class<T> comInterface)
ObjectFactory
fetchObject
in class ObjectFactory
public <T> T createObject(Class<T> comInterface)
ObjectFactory
createObject
in class ObjectFactory
IDispatchCallback createDispatchCallback(Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener)
createDispatchCallback
in class ObjectFactory
public IRunningObjectTable getRunningObjectTable()
ObjectFactory
getRunningObjectTable
in class ObjectFactory
public ComThread getComThread()