org.ros.internal.node.response
Class Response<T>

java.lang.Object
  extended by org.ros.internal.node.response.Response<T>
Type Parameters:
T -

public class Response<T>
extends java.lang.Object

The response from an XML-RPC call.


Constructor Summary
Response(int statusCode, java.lang.String statusMessage, T value)
           
Response(StatusCode statusCode, java.lang.String statusMessage, T value)
           
 
Method Summary
static
<T> Response<T>
fromListChecked(java.util.List<java.lang.Object> response, ResultFactory<T> resultFactory)
          Creates a Response from the List of Objects returned from an XML-RPC call.
static
<T> Response<T>
fromListCheckedFailure(java.util.List<java.lang.Object> response, ResultFactory<T> resultFactory)
          Creates a Response from the List of Objects returned from an XML-RPC call.
 T getResult()
           
 StatusCode getStatusCode()
           
 java.lang.String getStatusMessage()
           
 boolean isSuccess()
           
static
<T> Response<T>
newError(java.lang.String message, T value)
           
static
<T> Response<T>
newFailure(java.lang.String message, T value)
           
static
<T> Response<T>
newSuccess(java.lang.String message, T value)
           
 java.util.List<java.lang.Object> toList()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Response

public Response(int statusCode,
                java.lang.String statusMessage,
                T value)

Response

public Response(StatusCode statusCode,
                java.lang.String statusMessage,
                T value)
Method Detail

newError

public static <T> Response<T> newError(java.lang.String message,
                                       T value)

newFailure

public static <T> Response<T> newFailure(java.lang.String message,
                                         T value)

newSuccess

public static <T> Response<T> newSuccess(java.lang.String message,
                                         T value)

fromListCheckedFailure

public static <T> Response<T> fromListCheckedFailure(java.util.List<java.lang.Object> response,
                                                     ResultFactory<T> resultFactory)
                                          throws RemoteException
Creates a Response from the List of Objects returned from an XML-RPC call. Throws RemoteException if the StatusCode is StatusCode.FAILURE.

Type Parameters:
T -
Parameters:
response - the List of Objects returned from the XML-RPC call
resultFactory - a ResultFactory that creates a result from the third Object in the Response
Returns:
a Response using the specified ResultFactory to generate the result
Throws:
RemoteException - if the Response's StatusCode indicates StatusCode.FAILURE.

fromListChecked

public static <T> Response<T> fromListChecked(java.util.List<java.lang.Object> response,
                                              ResultFactory<T> resultFactory)
                                   throws RemoteException
Creates a Response from the List of Objects returned from an XML-RPC call. Throws RemoteException if the StatusCode is not a success.

Type Parameters:
T -
Parameters:
response - the List of Objects returned from the XML-RPC call
resultFactory - a ResultFactory that creates a result from the third Object in the Response
Returns:
a Response using the specified ResultFactory to generate the result
Throws:
RemoteException - if the Response's StatusCode does not indicate success

toList

public java.util.List<java.lang.Object> toList()

getStatusCode

public StatusCode getStatusCode()

getStatusMessage

public java.lang.String getStatusMessage()

getResult

public T getResult()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isSuccess

public boolean isSuccess()