public abstract class Action
extends java.lang.Object
call()
method.
The set
method returns the Action
instance to allow
the fields of the action to be set in fluent style.
VirtualDevice.createAction(String)
Modifier and Type | Method and Description |
---|---|
abstract void |
call()
Send the action.
|
abstract <T> Action |
set(java.lang.String argName,
T value)
Set the value of an argument in the
Action . |
public abstract <T> Action set(java.lang.String argName, T value)
Action
. The arguments are
determined by the action in the device model. The arguments can be set
in any order.
The value is validated according to the constraints in the device model.
If the value is not valid, or the named arguement does not exist in the
device model, an IllegalArgumentException is raised.
If the action has an arguments
array in the device model, the
argName
must match one of the argument names in the array.
To support device models which have only a single, un-named argument,
argName
may be passed as ""
(an empty String) or null
.
For an action that takes no arguments, the set
, the code only needs to
invoke the call()
method. An attempt to set an argument value for an
action that does not take arguments will result in an IllegalArgumentException.
All arguments defined in the action that do not have default values
must be set before calling call()
.
T
- the type of the value.argName
- the name of an argument from the actionvalue
- the value to setjava.lang.IllegalArgumentException
- if the value is not valid,
or field
is null
VirtualDevice.createAction(String)
public abstract void call()
The onError handler of the parent virtual device will be called if there is error sending the action.
All fields defined in the action that do not have default values
must be set before invoking call()
; otherwise, an (unchecked)
IllegalStateException is thrown.
java.lang.IllegalStateException
- if call()
is invoked
before setting all arguments that do not have default values