org.ros.internal.node.response
Class Response<T>
java.lang.Object
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)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Response
public Response(int statusCode,
java.lang.String statusMessage,
T value)
Response
public Response(StatusCode statusCode,
java.lang.String statusMessage,
T value)
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 Object
s
returned from an XML-RPC call. Throws RemoteException
if the
StatusCode
is StatusCode.FAILURE.
- Type Parameters:
T
- - Parameters:
response
- the List
of Object
s returned from the XML-RPC callresultFactory
- 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 Object
s
returned from an XML-RPC call. Throws RemoteException
if the
StatusCode
is not a success.
- Type Parameters:
T
- - Parameters:
response
- the List
of Object
s returned from the XML-RPC callresultFactory
- 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()