|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jinterop.dcom.win32.JIComFactory
public class JIComFactory
Helper class for creating COM
interfaces.
Sample Usage:-
//Assume comStub is the reference to JIComServer, obtained earlier...
IJIUnknown unknown = comStub.createInstance();
// This call will result into a QueryInterface for the IDispatch
IJIDispatch dispatch = (IJIDispatch)JIComFactory.createCOMInstance(JIComFactory.IID_IDispatch,unknown);
Another example:-
//From MSExcel2 example
int dispId = dispatch.getIDsOfNames("Workbooks");
JIVariant outVal = dispatch.get(dispId);
JIInterfacePointer ptr = outVal.getObjectAsInterfacePointer();
// This call wraps the JIInterfacePointer into it's actual type, based on it's IID (ptr.getIID())
IJIDispatch dispatchOfWorkBooks =(IJIDispatch)JIComFactory.createCOMInstance(unknown,ptr);
Field Summary | |
---|---|
static java.lang.String |
IID_IDispatch
IID of IDispatch [IJIDispatch] . |
static java.lang.String |
IID_IEnumVARIANT
IID of IEnumVARIANT [IJIEnumVARIANT] . |
static java.lang.String |
IID_ITypeInfo
IID of ITypeInfo [IJITypeInfo] . |
static java.lang.String |
IID_ITypeLib
IID of ITypeLib [IJITypeLib] . |
Constructor Summary | |
---|---|
JIComFactory()
|
Method Summary | |
---|---|
static java.lang.String |
attachEventHandler(IJIComObject comObject,
java.lang.String sourceUUID,
JIInterfacePointer eventListener)
Attaches an Event Handler to this comObject for the source event interface of COM , identified by the
sourceUUID . |
static IJIComObject |
createCOMInstance(IJIComObject template,
JIInterfacePointer ptr)
Returns an IJIComObject as reference to the interface defined by ptr.getIID() . |
static IJIComObject |
createCOMInstance(java.lang.String IID,
IJIComObject iUnknown)
Returns an IJIComObject as reference to the interface defined by IID . |
static void |
detachEventHandler(IJIComObject comObject,
java.lang.String identifier)
Detaches the event handler identified by identifier and associated with this comObject . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String IID_IDispatch
IDispatch [IJIDispatch]
.
public static final java.lang.String IID_ITypeInfo
ITypeInfo [IJITypeInfo]
.
public static final java.lang.String IID_ITypeLib
ITypeLib [IJITypeLib]
.
public static final java.lang.String IID_IEnumVARIANT
IEnumVARIANT [IJIEnumVARIANT]
.
Constructor Detail |
---|
public JIComFactory()
Method Detail |
---|
public static IJIComObject createCOMInstance(java.lang.String IID, IJIComObject iUnknown) throws JIException
IID
. Performs a QueryInterface on the iUnknown
parameter for this IID.
IID
- interface identifier of the requested interface.iUnknown
- unknown reference to queryInterface on.
JIException
public static IJIComObject createCOMInstance(IJIComObject template, JIInterfacePointer ptr) throws JIException
Returns an IJIComObject as reference to the interface defined by ptr.getIID()
. This API creates a IJIComObject based on the ptr
, the JISession
and JIComServer
is taken from the template
. No QueryInterface is performed in this case. The new object will belong to the session to which the
template
belongs.
template
- IJIComObject
whose basic parameters such as JIComServer
will be used while creating the new Instance.ptr
- reference used for creating the new instance.
template
or ptr
is null then an exception will be thrown
JIException
public static java.lang.String attachEventHandler(IJIComObject comObject, java.lang.String sourceUUID, JIInterfacePointer eventListener) throws JIException
Attaches an Event Handler to this comObject
for the source event interface of COM , identified by the
sourceUUID
. The event listener is itself identified by eventListener
. It is obtained
by JIInterfacePointer.getInterfacePointer(JISession,JIJavaCoClass)
api. A JIException will get thrown if
sourceUUID
is not supported by the COM Server.
comObject
- sourceUUID
- eventListener
-
detachEventHandler
JIException
public static void detachEventHandler(IJIComObject comObject, java.lang.String identifier) throws JIException
identifier
and associated with this comObject
.
comObject
- identifier
-
JIException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |