public class Session extends Object
To use,
Session session = startSession()
;
,session.commit()
;
to execute all calls in one AppleScript
In order to "rollback" any uncommitted AppleScript fragments, call reset()
.
Modifier and Type | Field | Description |
---|---|---|
static int |
DEFAULT_TIMEOUT |
Constructor | Description |
---|---|
Session() |
Session.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(CharSequence applescriptFragment) |
Adds an AppleScript fragment to the session.
|
void |
addAspect(Aspect aspect) |
|
void |
commit() |
Executes the current script (collection of fragments)
and removes the registered session.
|
static Session |
get() |
If there is a session associated with the current thread,
return that session.
|
List<Aspect> |
getAspects() |
|
String |
getScript() |
Return the current script or script fragments.
|
static Session |
getSession() |
Deprecated, for removal: This API element is subject to removal in a future version.
|
int |
getTimeout() |
|
boolean |
isCompile() |
|
boolean |
isDefaultTimeout() |
|
boolean |
isIgnoreReturnValues() |
|
static boolean |
isStarted() |
Indicates whether there is already a started session belonging to the current thread.
|
boolean |
removeAspect(Aspect aspect) |
|
void |
reset() |
Resets the session.
|
void |
setCompile(boolean compile) |
|
void |
setIgnoreReturnValues(boolean ignoreReturnValues) |
|
void |
setTimeout(int timeout) |
|
static Session |
startSession() |
public static final int DEFAULT_TIMEOUT
public static Session startSession()
public void addAspect(Aspect aspect)
public boolean removeAspect(Aspect aspect)
public int getTimeout()
public void setTimeout(int timeout)
timeout
- in secondspublic boolean isDefaultTimeout()
public boolean isIgnoreReturnValues()
public void setIgnoreReturnValues(boolean ignoreReturnValues)
public boolean isCompile()
public void setCompile(boolean compile)
public void add(CharSequence applescriptFragment)
applescriptFragment
- AppleScript fragmentpublic void reset()
public static boolean isStarted()
startSession()
.public String getScript()
public void commit()
@Deprecated(forRemoval=true, since="3.4.12") public static Session getSession()
get()
instead.null
, if there is nonepublic static Session get()
null
.null
, if there is none