Package org.ovirt.vdsm.jsonrpc.client
Class ResponseDecomposer
- java.lang.Object
-
- org.ovirt.vdsm.jsonrpc.client.ResponseDecomposer
-
public class ResponseDecomposer extends java.lang.ObjectDecomposes of the response as objects which type is provided.
-
-
Constructor Summary
Constructors Constructor Description ResponseDecomposer(JsonRpcResponse response)Creates decomposer for a response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>decomposeError()Decomposes response error asMap.<T> TdecomposeResponse(java.lang.Class<T> clazz)Decomposes response to provided type.<T> T[]decomposeTypedArray(java.lang.Object[] array, java.lang.Class<T> clazz, java.lang.String subtypeKey)Decomposes response to provided typed array.booleanisError()
-
-
-
Constructor Detail
-
ResponseDecomposer
public ResponseDecomposer(JsonRpcResponse response)
Creates decomposer for a response.- Parameters:
response- - Used for decomposition.
-
-
Method Detail
-
isError
public boolean isError()
- Returns:
truewhen response containsJsonRpcErrorobject otherwisefalse
-
decomposeResponse
public <T> T decomposeResponse(java.lang.Class<T> clazz)
Decomposes response to provided type.- Type Parameters:
T- -Type of the object to which response will be decomposed.- Parameters:
clazz- - Class to which response will be decomposed.- Returns:
- Decomposed response of provided type.
-
decomposeTypedArray
public <T> T[] decomposeTypedArray(java.lang.Object[] array, java.lang.Class<T> clazz, java.lang.String subtypeKey)Decomposes response to provided typed array.- Type Parameters:
T- -Type of the object to which response will be decomposed.- Parameters:
array- - An array of objects to be decomposed.clazz- - Class to which response will be decomposed.subtypeKey- - The key which is used to store objects in decomposed map.- Returns:
- Decomposed response of provided type.
-
decomposeError
public java.util.Map<java.lang.String,java.lang.Object> decomposeError()
Decomposes response error asMap.- Returns:
- Decomposed response error.
-
-