Package com.mi.rs
Interface public interface IResponse
Implementors Response

Defines the interface of a command response object. This interface is used by RSService in calls to command response handlers. it gives access to all the data available in a response to a RealityServer command.

Batch commands has complex responses containing the responses of all the batch sub-commands. To make parsing eaiser there are several batch command specific methods added to this interface. The result object will contain all the information needed, but the subResponses array contains all the sub-responses as IResponse objects. Note that sub-responses can also be responses to nested batch commands.



Public Properties
  Property Defined By
    command : ICommand
[read-only] Returns the command this is the response to.
IResponse
    error : IResponseError
[read-only] Contains information about the error, or null if no error occured.
IResponse
    hasSubErrorResponse : Boolean
[read-only] Returns true if any of the sub-responses is an error response.
IResponse
    isBatchResponse : Boolean
[read-only] True if this is the response to a batch command.
IResponse
    isErrorResponse : Boolean
[read-only] Convenience property that is true if this is an error response.
IResponse
    result : *
[read-only] The result data structure that was returned by the RealityServer command.
IResponse
    subResponses : Array
[read-only] if isBatchResponse is true, then this array contains objects of type IResponse for all the sub-commands.
IResponse
Property Detail
command property
command:ICommand  [read-only]

Returns the command this is the response to.


Implementation
    public function get command():ICommand
error property  
error:IResponseError  [read-only]

Contains information about the error, or null if no error occured.


Implementation
    public function get error():IResponseError
hasSubErrorResponse property  
hasSubErrorResponse:Boolean  [read-only]

Returns true if any of the sub-responses is an error response. This function also takes sub-responses of nested batch commands into account. Note that the IResponse.error property only say if the batch command itself succedded or not, it does not say anything about the individual sub-commands. Each sub-command needs to be inspected, and this is a convenience method to determine if error handling is needed or not for the sub-responses.


Implementation
    public function get hasSubErrorResponse():Boolean
isBatchResponse property  
isBatchResponse:Boolean  [read-only]

True if this is the response to a batch command. If true then the batch specific methods can be used to easier parse the sub-responses of the batch command.


Implementation
    public function get isBatchResponse():Boolean
isErrorResponse property  
isErrorResponse:Boolean  [read-only]

Convenience property that is true if this is an error response. In this case IResponse.result will be null and IResponse.error be set to an IResponseError object containing more information about the error.


Implementation
    public function get isErrorResponse():Boolean
result property  
result:*  [read-only]

The result data structure that was returned by the RealityServer command. The result will be null if the command experienced an error. Commands not returning a value will have an empty object as result.


Implementation
    public function get result():*
subResponses property  
subResponses:Array  [read-only]

if isBatchResponse is true, then this array contains objects of type IResponse for all the sub-commands. sub-responses are in the same order as the sub-commands were added to the original batch request.


Implementation
    public function get subResponses():Array