public abstract class Alert
extends java.lang.Object
raise()
method. The time of the alert is set when raise()
is called, allowing raise()
to be called more than once.
The set
method returns the Alert
instance to allow
the fields of the alert to be set in fluent style.
VirtualDevice.createAlert(String)
Modifier and Type | Method and Description |
---|---|
abstract void |
raise()
Send the alert.
|
abstract <T> Alert |
set(java.lang.String field,
T value)
Set the value of a field in the
Alert . |
abstract void |
setOnError(AbstractVirtualDevice.ErrorCallback<VirtualDevice> callback)
Set a callback that is invoked if an error occurs when raising the
Alert . |
public abstract <T> Alert set(java.lang.String field, T value)
Alert
. The fields are
determined by the format given when the Alert is created.
The value is validated according to the constraints in the format.
If the value is not valid, an IllegalArgumentException is raised.
All fields defined in the format that are "optional" : true
must be set before calling raise()
.
T
- the type of the value.field
- the name of a field from the alert formatvalue
- the value to setjava.lang.IllegalArgumentException
- if the value is not valid,
or field
is null
VirtualDevice.createAlert(String)
public abstract void raise()
onError handler
will be called if there is error sending the alert.
All fields defined in the format that are "optional" : true
must be set before calling raise()
. If raise()
is called
before setting all "optional" : true
fields, an (unchecked)
IllegalStateException is thrown.
java.lang.IllegalStateException
- if raise()
is called
before setting all "optional" : true
fieldspublic abstract void setOnError(AbstractVirtualDevice.ErrorCallback<VirtualDevice> callback)
Alert
. The callback may be null
, which will un-set
the callback.callback
- a callback to invoke, or null