public abstract class Data
extends java.lang.Object
submit()
method. The time of the data fields are set when
submit()
is called, allowing submit()
to be called more
than once.
The set
method returns the Data
instance to allow
fields of data to be set in fluent style.
VirtualDevice.createData(String)
Modifier and Type | Method and Description |
---|---|
abstract <T> Data |
set(java.lang.String field,
T value)
Set the value of a field in the
Data . |
abstract void |
setOnError(AbstractVirtualDevice.ErrorCallback<VirtualDevice> callback)
Set a callback that is invoked if an error occurs when submitting the
Data . |
abstract void |
submit()
Submit the data.
|
public abstract <T> Data set(java.lang.String field, T value)
Data
. The fields are
determined by the format given when the Data 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 submit()
.
T
- the type of the value.field
- the name of a field from the custom data formatvalue
- the value to setjava.lang.IllegalArgumentException
- if the value is not valid,
or field
is null
VirtualDevice.createData(String)
public abstract void submit()
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 submit()
. If submit()
is
called
before setting all "optional" : true
fields, an (unchecked)
IllegalStateException is thrown.
java.lang.IllegalStateException
- if submit()
is called
before setting all "optional" : true
fieldspublic abstract void setOnError(AbstractVirtualDevice.ErrorCallback<VirtualDevice> callback)
Data
. The callback may be null
, which will un-set
the callback.callback
- a callback to invoke, or null