|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jniwrapper.win32.automation.Automation
Provides functions to invoke property setters, getters or interface methods
using features of standard IDispatch
interface. By default it uses
the OleMessageLoop
thread to perform automation in it. If you need to
perform automation in the current thread, use an appropriate constructor.
Note: Invoke the release
method after using the
Automation
object.
Nested Class Summary | |
class |
Automation.InvocationHelper
|
Field Summary | |
static LocaleID |
DEFAULT_LOCALE_ID
Defines default locale ID for all automation function calls. |
Constructor Summary | |
Automation(IDispatch dispatch)
Creates an Automation instance for a given IDispatch interface. |
|
Automation(IDispatch dispatch,
boolean useCurrentThread)
Creates an Automation instance for a given IDispatch interface. |
|
Automation(IUnknown unknown)
Creates an Automation instance for a given IUnknown interface. |
|
Automation(IUnknown unknown,
boolean useCurrentThread)
Creates an Automation instance for a given IUnknown interface. |
Method Summary | |
static Variant |
asVariant(java.lang.Object value)
Converts a java/JNIWrapper object to the Variant parameter. |
static java.lang.Object |
getDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Class returnValueClass)
Returns dispatch property. |
static java.lang.Object |
getDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
int index,
java.lang.Class implClass)
Returns indexed dispatch property. |
static java.lang.Object |
getDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object[] indexes,
java.lang.Class returnValueClass)
Returns indexed dispatch property. |
static java.lang.Object |
getDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object index,
java.lang.Class returnValueClass)
Returns indexed dispatch property. |
static java.lang.Object |
getDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object index1,
java.lang.Object index2,
java.lang.Class returnValueClass)
Returns indexed dispatch property. |
static java.lang.Object |
getDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object index1,
java.lang.Object index2,
java.lang.Object index3,
java.lang.Class returnValueClass)
Returns indexed dispatch property. |
DispID |
getDispID(java.lang.String propertyName)
Returns DispID of property or method |
LocaleID |
getLocaleID()
Returns locale ID. |
Variant |
getProperty(DispID dispid)
Returns property value of a referenced interface. |
Variant |
getProperty(DispID dispID,
int index)
Returns the value of the specified collection property by the index. |
Variant |
getProperty(DispID dispID,
java.lang.Object index)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(DispID dispID,
java.lang.Object[] indexes)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(DispID dispID,
Variant index)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(DispID dispID,
Variant[] indexes)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(java.lang.String propertyName)
Returns property value of a referenced interface. |
Variant |
getProperty(java.lang.String propertyName,
int index)
Returns the value of the specified collection property by the index. |
Variant |
getProperty(java.lang.String propertyName,
java.lang.Object index)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(java.lang.String propertyName,
java.lang.Object[] indexes)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(java.lang.String propertyName,
Variant index)
Returns the value of the specified collection property by the name. |
Variant |
getProperty(java.lang.String propertyName,
Variant[] indexes)
Returns the value of the specified collection property by the name. |
Variant |
invoke(DispID dispID)
Invokes the method of a referenced interface. |
Variant |
invoke(DispID dispID,
java.lang.Object parameter)
Helper method that invokes the method of a referenced interface with one parameter. |
Variant |
invoke(DispID dispID,
java.lang.Object parameter1,
java.lang.Object parameter2)
Helper method that invokes the method of a referenced interface with two parameters. |
Variant |
invoke(DispID dispID,
java.lang.Object parameter1,
java.lang.Object parameter2,
java.lang.Object parameter3)
Helper method that invokes the method of a referenced interface with three parameters. |
Variant |
invoke(DispID dispID,
Variant parameter)
Helper method that invokes the method of a referenced interface with one Variant parameter. |
Variant |
invoke(DispID dispID,
Variant[] parameters)
Invokes the method of a referenced interface. |
Variant |
invoke(DispID dispID,
Variant parameter1,
Variant parameter2)
Helper method that invokes the method of a referenced interface with two Variant parameters. |
Variant |
invoke(DispID dispID,
Variant parameter1,
Variant parameter2,
Variant parameter3)
Helper method that invokes the method of a referenced interface with three Variant parameters. |
Variant |
invoke(java.lang.String methodName)
Invokes the method of a referenced interface. |
Variant |
invoke(java.lang.String methodName,
java.lang.Object parameter)
Helper method that invokes the method of a referenced interface with one parameter. |
Variant |
invoke(java.lang.String methodName,
java.lang.Object[] parameters)
Invokes the method of a referenced interface. |
Variant |
invoke(java.lang.String methodName,
java.lang.Object parameter1,
java.lang.Object parameter2)
Helper method that invokes the method of a referenced interface with two parameters. |
Variant |
invoke(java.lang.String methodName,
java.lang.Object parameter1,
java.lang.Object parameter2,
java.lang.Object parameter3)
Helper method that invokes the method of a referenced interface with three parameters. |
Variant |
invoke(java.lang.String methodName,
Variant parameter)
Helper method that invokes the method of a referenced interface with one Variant parameter. |
Variant |
invoke(java.lang.String methodName,
Variant[] parameters)
Invokes the method of a referenced interface. |
Variant |
invoke(java.lang.String methodName,
Variant parameter1,
Variant parameter2)
Helper method that invokes the method of a referenced interface with two Variant parameters. |
Variant |
invoke(java.lang.String methodName,
Variant parameter1,
Variant parameter2,
Variant parameter3)
Helper method that invokes the method of a referenced interface with three Variant parameters. |
static Variant |
invokeDispatch(IDispatch dispatch,
DispID dispID,
DispParams dispParams)
Deprecated. use invokeDispatch(IDispatch dispatch, DispID dispID, Parameter[] args) instead |
static java.lang.Object |
invokeDispatch(IDispatch dispatch,
DispID dispID,
DispParams dispParams,
java.lang.Class returnValueClass)
Deprecated. use invokeDispatch(IDispatch dispatch, DispID dispID, Parameter[] args, Class returnValueClass) instead |
static java.lang.Object |
invokeDispatch(IDispatch dispatch,
java.lang.String methodName,
Parameter[] args,
java.lang.Class returnValueClass)
Invokes the method through dispatch interface reference. |
boolean |
isDispInterface()
Returns the value of DispInterface property. |
boolean |
isUseCurrentThread()
Returns true if the automation is performed in the current thread; false - if in the OleMessageLoop thread. |
void |
release()
Releases dispatch encapsulated in this object. |
static void |
setDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object value)
Sets dispatch property. |
static void |
setDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object[] values)
Sets dispatch property. |
static void |
setDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object value1,
java.lang.Object value2)
Sets dispatch property. |
static void |
setDispatchProperty(IDispatch dispatch,
java.lang.String propertyName,
java.lang.Object value1,
java.lang.Object value2,
java.lang.Object value3)
Sets dispatch property. |
void |
setDispInterface(boolean dispInterface)
Specifies the value of DispInterface property. |
void |
setLocaleID(LocaleID localeID)
Set locale ID. |
void |
setProperty(DispID dispID,
java.lang.Object value)
Sets property value of a referenced interface. |
void |
setProperty(DispID dispID,
java.lang.Object[] values)
Sets property value of a referenced interface. |
void |
setProperty(DispID dispID,
Variant value)
Sets property value of a referenced interface. |
void |
setProperty(java.lang.String propertyName,
java.lang.Object value)
Sets property value of a referenced interface. |
void |
setProperty(java.lang.String propertyName,
java.lang.Object[] values)
Sets property value of a referenced interface. |
void |
setProperty(java.lang.String propertyName,
Variant value)
Sets property value of a referenced interface. |
void |
setProperty(java.lang.String propertyName,
Variant[] args)
Sets property value of a referenced interface. |
void |
setUseCurrentThread(boolean useCurrentThread)
Specifies where to perform automation. |
static Variant[] |
toVariantArray(java.lang.Object[] parameters)
Converts an array of java/JNIWrapper objects to the array of Variants. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static LocaleID DEFAULT_LOCALE_ID
-Dteamdev.comfyj.automation.localeID={value}
VM parameter to modify locale ID at startup.
Constructor Detail |
public Automation(IUnknown unknown, boolean useCurrentThread)
unknown
- object to automate.useCurrentThread
- specifies where to perform automation. If true,
the automation will be performed in the current thread, if false -in the
OleMessageLoop
thread.public Automation(IUnknown unknown)
OleMessageLoop
thread. In order to
perform automation in the current thread, use the Automation(com.jniwrapper.win32.com.IUnknown, boolean)
constructor.
unknown
- object to automate.public Automation(IDispatch dispatch, boolean useCurrentThread)
dispatch
- object to automate.useCurrentThread
- specifies where to perform automation. If true,
the automation will be performed in the current thread, if false -in the
OleMessageLoop
thread.public Automation(IDispatch dispatch)
OleMessageLoop
thread by default.Automation(com.jniwrapper.win32.com.IUnknown, boolean)
constructor.
dispatch
- object to automate.Method Detail |
public boolean isDispInterface()
public void setDispInterface(boolean dispInterface)
dispInterface
- DispInterface flagpublic boolean isUseCurrentThread()
OleMessageLoop
thread.
OleMessageLoop
thread.public void setUseCurrentThread(boolean useCurrentThread)
useCurrentThread
- if true, the current thread will be used; if
false OleMessageLoop
thread.public DispID getDispID(java.lang.String propertyName)
propertyName
- name of the property
public Variant getProperty(DispID dispid) throws ComException
dispid
- object's property ID.
ComException
- when the property getting is failedpublic Variant getProperty(java.lang.String propertyName) throws ComException
propertyName
- object's property name.
ComException
- when the property getting is failedpublic static java.lang.Object getDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Class returnValueClass)
dispatch
- dispatch interface referencepropertyName
- property namereturnValueClass
- expected type of return value
returnValueClass
typepublic static java.lang.Object getDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object index, java.lang.Class returnValueClass)
dispatch
- dispatch interface referencepropertyName
- property nameindex
- index of propertyreturnValueClass
- expected type of return value
returnValueClass
typepublic static java.lang.Object getDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object index1, java.lang.Object index2, java.lang.Class returnValueClass)
dispatch
- dispatch interface referencepropertyName
- property nameindex1
- index of propertyindex2
- index of propertyreturnValueClass
- expected type of return value
returnValueClass
typepublic static java.lang.Object getDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object index1, java.lang.Object index2, java.lang.Object index3, java.lang.Class returnValueClass)
dispatch
- dispatch interface referencepropertyName
- property nameindex1
- index of propertyindex2
- index of propertyindex3
- index of propertyreturnValueClass
- expected type of return value
returnValueClass
typepublic static java.lang.Object getDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object[] indexes, java.lang.Class returnValueClass)
dispatch
- dispatch interface referencepropertyName
- property nameindexes
- index of propertyreturnValueClass
- expected type of return value
returnValueClass
typepublic static java.lang.Object getDispatchProperty(IDispatch dispatch, java.lang.String propertyName, int index, java.lang.Class implClass)
dispatch
- dispatch interface referencepropertyName
- property nameindex
- index of propertyimplClass
- expected type of return value
implClass
typepublic Variant getProperty(java.lang.String propertyName, int index) throws ComException
propertyName
- collection property name.index
- index of the collection item.
ComException
- when the property setting is failedpublic Variant getProperty(DispID dispID, int index) throws ComException
dispID
- collection property id.index
- index of the collection item.
ComException
- when the property setting is failedpublic Variant getProperty(java.lang.String propertyName, java.lang.Object index) throws ComException
propertyName
- collection property name.index
- name of the collection item.
ComException
- when the property getting is failedpublic Variant getProperty(DispID dispID, java.lang.Object index) throws ComException
dispID
- collection property id.index
- name of the collection item.
ComException
- when the property getting is failedpublic Variant getProperty(java.lang.String propertyName, Variant index) throws ComException
propertyName
- collection property name.index
- name of the collection item.
ComException
- when the property getting is failedpublic Variant getProperty(DispID dispID, Variant index) throws ComException
dispID
- collection property id.index
- name of the collection item.
ComException
- when the property getting is failedpublic Variant getProperty(java.lang.String propertyName, java.lang.Object[] indexes) throws ComException
propertyName
- collection property name.indexes
- array of indices
ComException
- when the property getting is failedpublic Variant getProperty(DispID dispID, java.lang.Object[] indexes) throws ComException
dispID
- collection property id.indexes
- array of indices
ComException
- when the property getting is failedpublic Variant getProperty(java.lang.String propertyName, Variant[] indexes) throws ComException
propertyName
- collection property name.indexes
- array of indices
ComException
- when the property getting is failedpublic Variant getProperty(DispID dispID, Variant[] indexes) throws ComException
dispID
- collection property id.indexes
- array of indices
ComException
- when the property getting is failedpublic void setProperty(java.lang.String propertyName, Variant value) throws ComException
propertyName
- object's property name.value
- a new property value.
ComException
- when the property setting is failedpublic void setProperty(DispID dispID, Variant value) throws ComException
dispID
- object's property id.value
- a new property value.
ComException
- when the property setting is failedpublic void setProperty(java.lang.String propertyName, Variant[] args) throws ComException
propertyName
- object's property name.args
- property args
ComException
- when the property setting is failedpublic void setProperty(java.lang.String propertyName, java.lang.Object value) throws ComException
propertyName
- object's property name.value
- property value
ComException
- when the property setting is failedpublic void setProperty(DispID dispID, java.lang.Object value) throws ComException
dispID
- object's property ID.value
- property value
ComException
- when the property setting is failedpublic void setProperty(java.lang.String propertyName, java.lang.Object[] values) throws ComException
propertyName
- object's property name.values
- property values
ComException
- when the property setting is failedpublic void setProperty(DispID dispID, java.lang.Object[] values) throws ComException
dispID
- object's property ID.values
- property values
ComException
- when the property setting is failedpublic static void setDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object value)
dispatch
- dispatch instancepropertyName
- property namevalue
- property valuepublic static void setDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object value1, java.lang.Object value2)
dispatch
- dispatch instancepropertyName
- property namevalue1
- property valuevalue2
- property valuepublic static void setDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object value1, java.lang.Object value2, java.lang.Object value3)
dispatch
- dispatch instancepropertyName
- property namevalue1
- property valuevalue2
- property valuevalue3
- property valuepublic static void setDispatchProperty(IDispatch dispatch, java.lang.String propertyName, java.lang.Object[] values)
dispatch
- dispatch instancepropertyName
- property namevalues
- property valuepublic Variant invoke(java.lang.String methodName) throws ComException
methodName
- object's method name.
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID) throws ComException
dispID
- object's method name.
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, java.lang.Object parameter) throws ComException
methodName
- object's method name.parameter
- method parameter
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, java.lang.Object parameter) throws ComException
dispID
- object's method name.parameter
- method parameter
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, Variant parameter) throws ComException
methodName
- object's method name.parameter
- method parameter
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, Variant parameter) throws ComException
dispID
- object's method name.parameter
- method parameter
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, java.lang.Object parameter1, java.lang.Object parameter2) throws ComException
methodName
- object's method name.parameter1
- first parameterparameter2
- second parameter
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, java.lang.Object parameter1, java.lang.Object parameter2) throws ComException
dispID
- object's method ID.parameter1
- first parameterparameter2
- second parameter
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, Variant parameter1, Variant parameter2) throws ComException
methodName
- object's method name.parameter1
- first parameterparameter2
- second parameter
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, Variant parameter1, Variant parameter2) throws ComException
dispID
- object's method ID.parameter1
- first parameterparameter2
- second parameter
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, java.lang.Object parameter1, java.lang.Object parameter2, java.lang.Object parameter3) throws ComException
methodName
- object's method name.parameter1
- first parameterparameter2
- second parameterparameter3
- third parameter
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, java.lang.Object parameter1, java.lang.Object parameter2, java.lang.Object parameter3) throws ComException
dispID
- object's method name.parameter1
- first parameterparameter2
- second parameterparameter3
- third parameter
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, Variant parameter1, Variant parameter2, Variant parameter3) throws ComException
methodName
- object's method name.parameter1
- first parameterparameter2
- second parameterparameter3
- third parameter
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, Variant parameter1, Variant parameter2, Variant parameter3) throws ComException
dispID
- object's method ID.parameter1
- first parameterparameter2
- second parameterparameter3
- third parameter
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, Variant[] parameters) throws ComException
methodName
- object's method name.parameters
- an array of parameter; each element of the array should
be a variant.
ComException
- when the method invocation is failedpublic Variant invoke(DispID dispID, Variant[] parameters) throws ComException
dispID
- object's method ID.parameters
- an array of parameter; each element of the array should
be a variant.
ComException
- when the method invocation is failedpublic Variant invoke(java.lang.String methodName, java.lang.Object[] parameters) throws ComException
methodName
- method nameparameters
- each element of parameters array can be one of java or
JNIWrapper type.
ComException
- when the method invocation is failedpublic static Variant[] toVariantArray(java.lang.Object[] parameters)
parameters
- an array of java/JNIWrapper objects.
public static Variant asVariant(java.lang.Object value)
value
- an object for conversion.
public static java.lang.Object invokeDispatch(IDispatch dispatch, java.lang.String methodName, Parameter[] args, java.lang.Class returnValueClass)
dispatch
- dispatch interface referencemethodName
- dispid of the invoked methodargs
- array of argumentsreturnValueClass
- return value type
ComException
- when the method invocation is failedpublic static Variant invokeDispatch(IDispatch dispatch, DispID dispID, DispParams dispParams)
invokeDispatch(IDispatch dispatch, DispID dispID, Parameter[] args)
instead
dispatch
- dispatch interface referencedispID
- dispid of the invoked methoddispParams
- an array of parameter for Dispatch.invoke()
call
ComException
- when the method invocation is failedpublic static java.lang.Object invokeDispatch(IDispatch dispatch, DispID dispID, DispParams dispParams, java.lang.Class returnValueClass)
invokeDispatch(IDispatch dispatch, DispID dispID, Parameter[] args, Class returnValueClass)
instead
dispatch
- dispatch interface referencedispID
- dispid of the invoked methoddispParams
- an array of parameter for Dispatch.invoke()
callreturnValueClass
- expected type for return value
returnValueClass
type
ComException
- when the method invocation is failedpublic void release()
public LocaleID getLocaleID()
public void setLocaleID(LocaleID localeID)
localeID
- locale ID
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |