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

# Class ObjectFactory

java.lang.Object
com.sun.jna.platform.win32.COM.util.ObjectFactory

Direct Known Subclasses:
  `Factory`

public class ObjectFactory extends Object
Factory keeps track of COM objects - all objects created with this factory can be disposed by calling `disposeAll()`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObjectFactory()`

- ## Method Summary

  Modifier and Type
  Method
  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)`
  `void`
  `disposeAll()`
  `<T> T`
  `fetchObject(Class<T> comInterface)`
  Gets and existing COM object (GetActiveObject) for the given progId and returns a ProxyObject for the given interface.
  `protected void`
  `finalize()`
  `WinDef.LCID`
  `getLCID()`
  Retrieve the LCID to be used for COM calls.
  `IRunningObjectTable`
  `getRunningObjectTable()`
  CoInitialize must be called be fore this method.
  `void`
  `register(ProxyObject proxyObject)`
  `void`
  `setLCID(WinDef.LCID value)`
  Set the LCID to use for COM calls.
  `void`
  `unregister(ProxyObject proxyObject)`

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

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

- ## Constructor Details

  - ### ObjectFactory

    public ObjectFactory()

- ## Method Details

  - ### finalize

    protected void finalize() throws Throwable
    Overrides:
      `finalize` in class `Object`
    Throws:
      `Throwable`

  - ### getRunningObjectTable

    public IRunningObjectTable getRunningObjectTable()
    CoInitialize must be called be fore this method. Either explicitly or implicitly via other methods.
    Returns:
      running object table

  - ### createProxy

    public <T> T createProxy(Class<T> comInterface, IDispatch dispatch)
    Creates a ProxyObject for the given interface and IDispatch pointer.

  - ### createObject

    public <T> T createObject(Class<T> comInterface)
    Creates a new COM object (CoCreateInstance) for the given progId and returns a ProxyObject for the given interface.

  - ### fetchObject

    public <T> T fetchObject(Class<T> comInterface) throws COMException
    Gets and existing COM object (GetActiveObject) for the given progId and returns a ProxyObject for the given interface.
    Throws:
      `COMException`

  - ### discoverClsId

    Guid.GUID discoverClsId(ComObject annotation)

  - ### createDispatchCallback

    IDispatchCallback createDispatchCallback(Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener)

  - ### register

    public void register(ProxyObject proxyObject)

  - ### unregister

    public void unregister(ProxyObject proxyObject)

  - ### disposeAll

    public void disposeAll()

  - ### getLCID

    public WinDef.LCID getLCID()
    Retrieve the LCID to be used for COM calls.
    Returns:
      If `setLCID` is not called retrieves the users default locale, else the set LCID.

  - ### setLCID

    public void setLCID(WinDef.LCID value)
    Set the LCID to use for COM calls.
    Parameters:
      `value` - override LCID. NULL resets to default.