public interface Action
Action instances can be controlled by invoking methods on their ActionQueue.
Action instances have the following properties:
name - a key to identify the Action
description - a textual description of the Action
options - a list of key/value pairs that the Action will use as options
Modifier and Type | Method and Description |
---|---|
void |
failed(Throwable error)
Invoked if this Action has failed.
|
String |
getDescription()
Returns this Action's description.
|
String |
getName()
Returns this Action's name.
|
Object |
getValue(String key)
Returns the value of an option.
|
void |
perform()
Performs this Action.
|
Object |
putValue(String key,
Object value)
Sets one of this object's options using the associated key.
|
void |
setDescription(String description)
Sets this Action's description.
|
void |
setName(String name)
Sets this Action's name.
|
void |
stop()
Stops this Action.
|
void perform() throws ActionFailedException
ActionFailedException
- if the action could not be performed.void stop()
perform
will return as soon as possible.
This method should do nothing if this Action has already been stopped.
This method will probably be invoked from within the Thread that created
the ActionQueue that this Action is being executed in, rather than from
within the Thread that is invoking the perform
method
(the ActionQueue's Action processing Thread).
Because of this, clients implementing this interface should
provide a way of canceling what is happening in the perform
method when this stop
method is invoked.
Note: this is especially important when the perform
method
executes a tight loop or creates new Threads.
void failed(Throwable error)
perform
method has executed.error
- the error that occurred.Object putValue(String key, Object value)
key
- the key by which to identify the option value.value
- the value, or null.Object getValue(String key)
key
- a String containing the key.String getName()
String getDescription()
void setName(String name)
name
- A String representing the Action's name.void setDescription(String description)
description
- A String representing the Action's description.Copyright © 2023. All rights reserved.