|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IJIDispatch
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.
| Field Summary | |
|---|---|
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 java.lang.String |
IID
IID representing the COM IDispatch. |
| Method Summary | |
|---|---|
void |
callMethod(int dispId)
Performs a method call for the method identified by the dispId parameter. |
void |
callMethod(int dispId,
java.lang.Object[] inparams)
Performs a method call for the method identified by the dispId parameter. |
void |
callMethod(int dispId,
java.lang.Object[] inparams,
int[] dispIds)
Performs a method call for the method identified by the dispId parameter. |
void |
callMethod(java.lang.String name)
Performs a method call for the method identified by the name parameter. |
void |
callMethod(java.lang.String name,
java.lang.Object[] inparams)
Performs a method call for the method identified by the name parameter. |
void |
callMethod(java.lang.String name,
java.lang.Object[] inparams,
int[] dispIds)
Performs a method call for the method identified by the name parameter. |
void |
callMethod(java.lang.String name,
java.lang.Object[] inparams,
java.lang.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,
java.lang.Object[] inparams)
Performs a method call for the method identified by the dispId parameter. |
JIVariant[] |
callMethodA(int dispId,
java.lang.Object[] inparams,
int[] dispIds)
Performs a method call for the method identified by the dispId parameter. |
JIVariant |
callMethodA(java.lang.String name)
Performs a method call for the method identified by the name parameter. |
JIVariant[] |
callMethodA(java.lang.String name,
java.lang.Object[] inparams)
Performs a method call for the method identified by the name parameter. |
JIVariant[] |
callMethodA(java.lang.String name,
java.lang.Object[] inparams,
int[] dispIds)
Performs a method call for the method identified by the name parameter. |
JIVariant[] |
callMethodA(java.lang.String name,
java.lang.Object[] inparams,
java.lang.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,
java.lang.Object[] inparams)
Performs a propget for the method identified by the dispId parameter. |
JIVariant |
get(java.lang.String name)
Performs a propget for the method identified by the name parameter. |
JIVariant[] |
get(java.lang.String name,
java.lang.Object[] inparams)
Performs a propget for the method identified by the name parameter. |
int |
getIDsOfNames(java.lang.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(java.lang.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,
java.lang.Object[] params)
Performs a propput for the method identified by the dispId |
void |
put(java.lang.String name,
JIVariant inparam)
Performs a propput for the method identified by the name parameter. |
void |
put(java.lang.String name,
java.lang.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,
java.lang.Object[] params)
Performs a propputref for the method identified by the dispId. |
void |
putRef(java.lang.String name,
JIVariant inparam)
Performs a propput for the method identified by the name parameter. |
void |
putRef(java.lang.String name,
java.lang.Object[] params)
Performs a propput for the method identified by the name parameter. |
| Field Detail |
|---|
static 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 java.lang.String IID
IDispatch.
| Method Detail |
|---|
int getTypeInfoCount()
throws JIException
JIException
int getIDsOfNames(java.lang.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.
JIException
java.lang.IllegalArgumentException - if the apiName is null or empty.
int[] getIDsOfNames(java.lang.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.
JIException
java.lang.IllegalArgumentException - 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.
JIException
void 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.
JIException
void put(java.lang.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.
JIException
java.lang.IllegalArgumentException - 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.
JIException
void putRef(java.lang.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.
JIException
java.lang.IllegalArgumentException - 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.
JIException
JIVariant[] get(int dispId,
java.lang.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.
JIException
JIVariant[] get(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
JIVariant get(java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
void callMethod(java.lang.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.
JIException
java.lang.IllegalArgumentException - 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.
JIException
JIVariant callMethodA(java.lang.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.
JIException
java.lang.IllegalArgumentException - 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.
JIException
void callMethod(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
void callMethod(int dispId,
java.lang.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.
JIException
JIVariant[] callMethodA(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
JIVariant[] callMethodA(int dispId,
java.lang.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.
JIException
void callMethod(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
void callMethod(int dispId,
java.lang.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.
JIException
JIVariant[] callMethodA(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
JIVariant[] callMethodA(int dispId,
java.lang.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.
JIException
void callMethod(java.lang.String name,
java.lang.Object[] inparams,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
JIVariant[] callMethodA(java.lang.String name,
java.lang.Object[] inparams,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
void put(int dispId,
java.lang.Object[] params)
throws JIException
propput for the method identified by the dispId
dispId - DISPID of the method to invoke.params - parameters for that method.
JIException
void put(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - if the name is null or empty.
void putRef(int dispId,
java.lang.Object[] params)
throws JIException
propputref for the method identified by the dispId.
dispId - DISPID of the method to invoke.params - parameters for that method.
JIException
void putRef(java.lang.String name,
java.lang.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.
JIException
java.lang.IllegalArgumentException - 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||