InvocationHandler
public class ObjectInvocationHandler extends Object implements InvocationHandler
ScriptExecutor
.Constructor | Description |
---|---|
ObjectInvocationHandler(Reference reference) |
Creates the
InvocationHandler for a given Reference . |
Modifier and Type | Method | Description |
---|---|---|
<T> T |
executeAppleScript(Reference reference,
String appleScript,
Class<T> returnType) |
|
TypeClass |
getTypeClass() |
Execute AppleScript to return the (AppleScript) class of the current reference.
|
Object |
invoke(Object proxy,
Method method,
Object[] args) |
|
boolean |
isReduceScriptExecutions() |
In some situations, Japlscript may simply construct a new
object specifier
rather than asking the runtime to return the object described by the
object specifier.
|
void |
setReduceScriptExecutions(boolean reduceScriptExecutions) |
Attempt to save some roundtrips.
|
public ObjectInvocationHandler(Reference reference)
InvocationHandler
for a given Reference
.reference
- reference that methods are called uponpublic boolean isReduceScriptExecutions()
For example, when asking for an element by index, one could
simply return a new (Java) Reference
that points to
item 5 of CoolElements of "FantasticApp"
(reduction on)
or actually execute the code
tell application "FantasticApp"
and then return a reference to the result (reduction off).
return item 5 of CoolElements of "FantasticApp"
end tell
By default, reduction is on.
Note that the result may be different, if the actual AppleScript call does not return an object specifier, but the actual object.
public void setReduceScriptExecutions(boolean reduceScriptExecutions)
reduceScriptExecutions
- true or falseisReduceScriptExecutions()
public TypeClass getTypeClass()
public Object invoke(Object proxy, Method method, Object[] args)
invoke
in interface InvocationHandler
public <T> T executeAppleScript(Reference reference, String appleScript, Class<T> returnType) throws IOException
IOException