Top Description Fields Constructors Methods
com.sun.jna.platform.win32.COM.util

public Class ObjectFactory

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.jna.platform.win32.COM.util.Factory
Imports
java.lang.reflect.Proxy, com.sun.jna.platform.win32.Guid.CLSID, .Guid.GUID, .Ole32, .OleAuto, .WTypes, .WinDef, .WinNT, .Kernel32, .WinDef.LCID, .WinNT.HRESULT, com.sun.jna.platform.win32.COM.COMException, .COMUtils, .Dispatch, .IDispatch, .IDispatchCallback, com.sun.jna.platform.win32.COM.util.annotation.ComObject, com.sun.jna.ptr.PointerByReference, java.lang.ref.WeakReference, java.util.ArrayList, .Iterator, .LinkedList, .List

Factory keeps track of COM objects - all objects created with this factory can be disposed by calling Factory#disposeAll().

Field Summary

Modifier and TypeField and Description
private WinDef.LCID
private static final WinDef.LCID
LOCALE_USER_DEFAULT

The Constant LOCALE_USER_DEFAULT.

private final List<WeakReference<ProxyObject>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv IDispatchCallback
createDispatchCallback(Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener)

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.

public <T> T
createProxy(Class<T> comInterface, IDispatch dispatch)

Creates a ProxyObject for the given interface and IDispatch pointer.

pack-priv Guid.GUID
public void
public <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()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
public WinDef.LCID

Returns:

If setLCID is not called retrieves the users default locale, else the set LCID.
getLCID
()

Retrieve the LCID to be used for COM calls.

public IRunningObjectTable

Returns:

running object table
getRunningObjectTable
()

CoInitialize must be called be fore this method.

public void
register(ProxyObject proxyObject)

public void
setLCID(WinDef.LCID
override LCID. NULL resets to default.
value
)

Set the LCID to use for COM calls.

public void
unregister(ProxyObject proxyObject)

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LCIDback to summary
private WinDef.LCID LCID
LOCALE_USER_DEFAULTback to summary
private static final WinDef.LCID LOCALE_USER_DEFAULT

The Constant LOCALE_USER_DEFAULT.

registeredObjectsback to summary
private final List<WeakReference<ProxyObject>> registeredObjects

Constructor Detail

ObjectFactoryback to summary
public ObjectFactory()

Method Detail

createDispatchCallbackback to summary
pack-priv IDispatchCallback createDispatchCallback(Class<?> comEventCallbackInterface, IComEventCallbackListener comEventCallbackListener)
createObjectback to summary
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.

createProxyback to summary
public <T> T createProxy(Class<T> comInterface, IDispatch dispatch)

Creates a ProxyObject for the given interface and IDispatch pointer.

discoverClsIdback to summary
pack-priv Guid.GUID discoverClsId(ComObject annotation)
disposeAllback to summary
public void disposeAll()
fetchObjectback to summary
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.

finalizeback to summary
protected void finalize() throws Throwable

Overrides java.lang.Object.finalize.

Doc from java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

When running in a Java virtual machine in which finalization has been disabled or removed, the garbage collector will never call finalize(). In a Java virtual machine in which finalization is enabled, the garbage collector might call finalize only after an indefinite delay.

The general contract of finalize is that it is invoked if and when the Java virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.

Annotations
@Override
Exceptions
Throwable:
the Exception raised by this method
getLCIDback to summary
public WinDef.LCID getLCID()

Retrieve the LCID to be used for COM calls.

Returns:WinDef.LCID

If setLCID is not called retrieves the users default locale, else the set LCID.

getRunningObjectTableback to summary
public IRunningObjectTable getRunningObjectTable()

CoInitialize must be called be fore this method. Either explicitly or implicitly via other methods.

Returns:IRunningObjectTable

running object table

registerback to summary
public void register(ProxyObject proxyObject)
setLCIDback to summary
public void setLCID(WinDef.LCID value)

Set the LCID to use for COM calls.

Parameters
value:WinDef.LCID

override LCID. NULL resets to default.

unregisterback to summary
public void unregister(ProxyObject proxyObject)