public interface IJIDispatch extends IJIComObject
Represents the Windows COM IDispatch Interface.
Sample Usage :-
//Assume comServer is the reference to JIComServer, obtained earlier...
IJIComObject comObject = comServer.createInstance();
// This call will result into a QueryInterface for the IDispatch
IJIDispatch dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));
Another example :-
int dispId = dispatch.getIDsOfNames("Workbooks");
JIVariant outVal = dispatch.get(dispId);
IJIDispatch dispatchOfWorkBooks =(IJIDispatch)JIObjectFactory.narrowObject(outVal.getObjectAsComObject());
JIVariant[] outVal2 = dispatchOfWorkBooks.callMethodA("Add",new Object[]{JIVariant.OPTIONAL_PARAM()});
dispatchOfWorkBook =(IJIDispatch)JIObjectFactory.narrowObject(outVal2[0].getObjectAsComObject());
outVal = dispatchOfWorkBook.get("Worksheets");
dispatchOfWorkSheets = (IJIDispatch)JIObjectFactory.narrowObject(outVal.getObjectAsComObject());
Please note that all [in] parameters are converted to
before being sent to the COM server through the JIVariantIJIDispatch
interface. If any [in] parameter is already a JIVariant , it is left as it is.
for example:-
//From MSADO example.
dispatch = (IJIDispatch)JIObjectFactory.narrowObject(comObject.queryInterface(IJIDispatch.IID));
dispatch.callMethod("Open",new Object[]{new JIString("driver=Microsoft Access Driver (*.mdb);dbq=C:\\temp\\products.mdb"),
JIVariant.OPTIONAL_PARAM,JIVariant.OPTIONAL_PARAM,new Integer(-1)});
JIVariant variant[] = dispatch.callMethodA("Execute",new Object[]{new JIString("SELECT * FROM Products"),new Integer(-1)});
if (variant[0].isNull())
{
System.out.println("Recordset is empty.");
}
else
{
//Do something...
}
Where ever the corresponding COM interface API requires an [optional] parameter,
the developer can use JIVariant.OPTIONAL_PARAM() , like in the example above.
| Modifier and Type | Field and Description |
|---|---|
static int |
DISPATCH_DISPID_PUTPUTREF
COM
DISPID for property "put" or "putRef". |
static int |
DISPATCH_METHOD
Flag for selecting a
method. |
static int |
DISPATCH_PROPERTYGET
Flag for selecting a Property
propget. |
static int |
DISPATCH_PROPERTYPUT
Flag for selecting a Property
propput. |
static int |
DISPATCH_PROPERTYPUTREF
Flag for selecting a Property
propputref. |
static String |
IID
IID representing the COM
IDispatch. |
| Modifier and Type | Method and Description |
|---|---|
void |
callMethod(int dispId)
Performs a
method call for the method identified by the dispId parameter. |
void |
callMethod(int dispId,
Object[] inparams)
Performs a
method call for the method identified by the dispId parameter. |
void |
callMethod(int dispId,
Object[] inparams,
int[] dispIds)
Performs a
method call for the method identified by the dispId parameter. |
void |
callMethod(String name)
Performs a
method call for the method identified by the name parameter. |
void |
callMethod(String name,
Object[] inparams)
Performs a
method call for the method identified by the name parameter. |
void |
callMethod(String name,
Object[] inparams,
int[] dispIds)
Performs a
method call for the method identified by the name parameter. |
void |
callMethod(String name,
Object[] inparams,
String[] paramNames)
Performs a
method call for the method identified by the name parameter. |
JIVariant |
callMethodA(int dispId)
Performs a
method call for the method identified by the dispId parameter. |
JIVariant[] |
callMethodA(int dispId,
Object[] inparams)
Performs a
method call for the method identified by the dispId parameter. |
JIVariant[] |
callMethodA(int dispId,
Object[] inparams,
int[] dispIds)
Performs a
method call for the method identified by the dispId parameter. |
JIVariant |
callMethodA(String name)
Performs a
method call for the method identified by the name parameter. |
JIVariant[] |
callMethodA(String name,
Object[] inparams)
Performs a
method call for the method identified by the name parameter. |
JIVariant[] |
callMethodA(String name,
Object[] inparams,
int[] dispIds)
Performs a
method call for the method identified by the name parameter. |
JIVariant[] |
callMethodA(String name,
Object[] inparams,
String[] paramNames)
Performs a
method call for the method identified by the name parameter. |
JIVariant |
get(int dispId)
Performs a
propget for the method identified by the dispId. |
JIVariant[] |
get(int dispId,
Object[] inparams)
Performs a
propget for the method identified by the dispId parameter. |
JIVariant |
get(String name)
Performs a
propget for the method identified by the name parameter. |
JIVariant[] |
get(String name,
Object[] inparams)
Performs a
propget for the method identified by the name parameter. |
int |
getIDsOfNames(String apiName)
Maps a method name to its corresponding
DISPID.The result of this call is cached
for further usage and no network call is performed again for the same method name. |
int[] |
getIDsOfNames(String[] apiName)
Maps a single method name and an optional set of it's argument names to a corresponding set of
DISPIDs. |
JIExcepInfo |
getLastExcepInfo()
Returns the COM
EXCEPINFO structure wrapped as a data object for the
last operation. |
IJITypeInfo |
getTypeInfo(int typeInfo)
Returns an implementation of COM
ITypeInfo interface based on the typeInfo. |
int |
getTypeInfoCount()
Definition from MSDN:
Determines whether there is type information available for the dual interface.
|
void |
put(int dispId,
JIVariant inparam)
Performs a
propput for the method identified by the dispId. |
void |
put(int dispId,
Object[] params)
Performs a
propput for the method identified by the dispId |
void |
put(String name,
JIVariant inparam)
Performs a
propput for the method identified by the name parameter. |
void |
put(String name,
Object[] params)
Performs a
propput for the method identified by the name parameter. |
void |
putRef(int dispId,
JIVariant inparam)
Performs a
propputref for the method identified by the dispId. |
void |
putRef(int dispId,
Object[] params)
Performs a
propputref for the method identified by the dispId. |
void |
putRef(String name,
JIVariant inparam)
Performs a
propput for the method identified by the name parameter. |
void |
putRef(String name,
Object[] params)
Performs a
propput for the method identified by the name parameter. |
addRef, call, call, getAssociatedSession, getInstanceLevelSocketTimeout, getInterfaceIdentifier, getIpid, getUnreferencedHandler, internal_getConnectionInfo, internal_getInterfacePointer, internal_removeConnectionInfo, internal_setConnectionInfo, internal_setDeffered, isDispatchSupported, isLocalReference, queryInterface, registerUnreferencedHandler, release, setInstanceLevelSocketTimeout, unregisterUnreferencedHandlerstatic final int DISPATCH_METHOD
method.static final int DISPATCH_PROPERTYGET
propget.static final int DISPATCH_PROPERTYPUT
propput.static final int DISPATCH_DISPID_PUTPUTREF
DISPID for property "put" or "putRef".static final int DISPATCH_PROPERTYPUTREF
propputref.static final String IID
IDispatch.int getTypeInfoCount()
throws JIException
JIExceptionint getIDsOfNames(String apiName) throws JIException
DISPID.The result of this call is cached
for further usage and no network call is performed again for the same method name. apiName - Method name.DISPID of the method.JIExceptionIllegalArgumentException - if the apiName is null or empty.int[] getIDsOfNames(String[] apiName) throws JIException
DISPIDs.
The result of this call is cached for further usage and no network call is performed again for the same method[argument] set.apiName - String[] with first index depicting method name and the rest depicting parameters.DISPIDs in the same order as the method[argument] set.JIExceptionIllegalArgumentException - if the apiName is null or empty.IJITypeInfo getTypeInfo(int typeInfo) throws JIException
ITypeInfo interface based on the typeInfo.
typeInfo - the type information to return. Pass 0 to retrieve type information for the IDispatch implementation.JIExceptionvoid put(int dispId,
JIVariant inparam)
throws JIException
propput for the method identified by the dispId. dispId - DISPID of the method to invoke.inparam - parameter for that method.JIExceptionvoid put(String name, JIVariant inparam) throws JIException
propput for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to put(int, JIVariant).name - name of the method to invoke.inparam - parameter for that method.JIExceptionIllegalArgumentException - if the name is null or empty.void putRef(int dispId,
JIVariant inparam)
throws JIException
propputref for the method identified by the dispId. dispId - DISPID of the method to invoke.inparam - parameter for that method.JIExceptionvoid putRef(String name, JIVariant inparam) throws JIException
propput for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to putRef(int, JIVariant).name - name of the method to invoke.inparam - parameter for that method.JIExceptionIllegalArgumentException - if the name is null or empty.JIVariant get(int dispId) throws JIException
propget for the method identified by the dispId. dispId - DISPID of the method to invoke.JIExceptionJIVariant[] get(int dispId, Object[] inparams) throws JIException
propget for the method identified by the dispId parameter.
inparams defines the parameters for the get operation.dispId - DISPID of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.JIExceptionJIVariant[] get(String name, Object[] inparams) throws JIException
propget for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to get(int, Object[]).name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants
before performing the actual call to the COM server, via the IJIDispatch interface.JIExceptionIllegalArgumentException - if the name is null or empty.JIVariant get(String name) throws JIException
propget for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to get(int)name - name of the method to invoke.JIExceptionIllegalArgumentException - if the name is null or empty.void callMethod(String name) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to callMethod(int).
name - name of the method to invoke.JIExceptionIllegalArgumentException - if the name is null or empty.void callMethod(int dispId)
throws JIException
method call for the method identified by the dispId parameter. dispId - DISPID of the method to invoke.JIExceptionJIVariant callMethodA(String name) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to callMethodA(int).
name - name of the method to invoke.JIExceptionIllegalArgumentException - if the name is null or empty.JIVariant callMethodA(int dispId) throws JIException
method call for the method identified by the dispId parameter. dispId - DISPID of the method to invoke.JIExceptionvoid callMethod(String name, Object[] inparams) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to
callMethod(int, Object[]). For the inparams array, sequential DISPIDs
(zero based index) will be used. For inparam[0] , DISPID will be 0,
for inparam[1] it will be 1 and so on. name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.JIExceptionIllegalArgumentException - if the name is null or empty.void callMethod(int dispId,
Object[] inparams)
throws JIException
method call for the method identified by the dispId parameter.
For the inparams array, sequential DISPIDs (zero based index) will be used.
For inparam[0] , DISPID will be 0, for inparam[1]
it will be 1 and so on. dispId - DISPID of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.JIExceptionJIVariant[] callMethodA(String name, Object[] inparams) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to
callMethodA(int, Object[]). For the inparams array, sequential DISPIDs
(zero based index) will be used. For inparam[0] , DISPID will be 0,
for inparam[1] it will be 1 and so on. name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.JIExceptionIllegalArgumentException - if the name is null or empty.JIVariant[] callMethodA(int dispId, Object[] inparams) throws JIException
method call for the method identified by the dispId parameter.
For the inparams array, sequential DISPIDs (zero based index) will be used.
For inparam[0] , DISPID will be 0, for inparam[1]
it will be 1 and so on.dispId - DISPID of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.JIExceptionvoid callMethod(String name, Object[] inparams, int[] dispIds) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to
callMethod(int, Object[], int[]). For the inparams array, the corresponding
DISPIDs are present in the dispIds array. The size of both arrays should match.
name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.dispIds - array of DISPIDs , matching by index to those in inparams array.JIExceptionIllegalArgumentException - if the name is null or empty.void callMethod(int dispId,
Object[] inparams,
int[] dispIds)
throws JIException
method call for the method identified by the dispId parameter.
For the inparams array, the corresponding DISPIDs are present in
the dispIds array. The size of both arrays should match.
dispId - DISPID of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.dispIds - array of DISPIDs , matching by index to those in inparams array.JIExceptionJIVariant[] callMethodA(String name, Object[] inparams, int[] dispIds) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to
callMethodA(int, Object[], int[]).For the inparams array, the corresponding
DISPIDs are present in the dispId array. The size of both arrays should match.
name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.dispIds - array of DISPIDs , matching by index to those in inparams array.JIExceptionIllegalArgumentException - if the name is null or empty.JIVariant[] callMethodA(int dispId, Object[] inparams, int[] dispIds) throws JIException
method call for the method identified by the dispId parameter.
For the inparams array, the corresponding DISPIDs are present in the
dispIds array. The size of both arrays should match.dispId - DISPID of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.dispIds - array of DISPIDs , matching by index to those in inparams array.JIExceptionvoid callMethod(String name, Object[] inparams, String[] paramNames) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String[]) by forming name + paramNames [],
and then delegates the call to callMethod(int, Object[], int[]). For the inparams array,
the corresponding parameter names are present in the paramNames array. The size of both
arrays should match.name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.paramNames - Array of parameter names, matching by index to those in inparams array.JIExceptionIllegalArgumentException - if the name is null or empty.JIVariant[] callMethodA(String name, Object[] inparams, String[] paramNames) throws JIException
method call for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String[]) by forming name + paramNames [],
and then delegates the call to callMethodA(int, Object[], int[]). For the inparams array,
the corresponding parameter names are present in the paramNames array. The size of both
arrays should match.name - name of the method to invoke.inparams - members of this array are implicitly converted to JIVariants before performing the
actual call to the COM server, via the IJIDispatch interface.paramNames - Array of parameter names, matching by index to those in inparams array.JIExceptionIllegalArgumentException - if the name is null or empty.void put(int dispId,
Object[] params)
throws JIException
propput for the method identified by the dispId dispId - DISPID of the method to invoke.params - parameters for that method.JIExceptionvoid put(String name, Object[] params) throws JIException
propput for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to put(int, Object[]).name - name of the method to invoke.params - parameters for that method.JIExceptionIllegalArgumentException - if the name is null or empty.void putRef(int dispId,
Object[] params)
throws JIException
propputref for the method identified by the dispId. dispId - DISPID of the method to invoke.params - parameters for that method.JIExceptionvoid putRef(String name, Object[] params) throws JIException
propput for the method identified by the name parameter.
Internally it will first do a getIDsOfNames(String) and then delegates the call to putRef(int, Object[]).name - name of the method to invoke.params - parameters for that method.JIExceptionIllegalArgumentException - if the name is null or empty.JIExcepInfo getLastExcepInfo()
EXCEPINFO structure wrapped as a data object for the
last operation. Note this will only be valid if a JIException has been raised
in the last call.Copyright © 2017 LSST. All rights reserved.