Class JsonResponseUtil
- java.lang.Object
-
- org.ovirt.vdsm.jsonrpc.client.utils.JsonResponseUtil
-
public class JsonResponseUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>clazzprivate static java.lang.StringDEFAULT_KEYprivate booleanignoreResponseKeyprivate java.lang.StringresponseKeyprivate java.util.Map<java.lang.String,java.lang.Object>responseMapprivate static java.lang.StringSTATUSprivate static java.util.Map<java.lang.String,java.lang.Object>STATUS_DONEprivate java.lang.Class<?>subTypeClazzprivate java.lang.StringsubtypeKeyprivate static java.util.Map<java.lang.String,java.lang.Object>TIMEOUT_STATUS
-
Constructor Summary
Constructors Constructor Description JsonResponseUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckAndUpdateStatus()java.util.Map<java.lang.String,java.lang.Object>populate(JsonRpcResponse response)private voidupdateResponse(java.lang.Object object)JsonResponseUtilwithIgnoreResponseKey()During response decomposition we will ignore default key and use raw response structure as resultMap.JsonResponseUtilwithResponseKey(java.lang.String responseKey)JsonResponseUtilwithResponseType(java.lang.Class<?> clazz)JsonResponseUtilwithSubTypeClazz(java.lang.Class<?> clazz)JsonResponseUtilwithSubtypeKey(java.lang.String subTypeKey)
-
-
-
Field Detail
-
STATUS
private static final java.lang.String STATUS
- See Also:
- Constant Field Values
-
DEFAULT_KEY
private static final java.lang.String DEFAULT_KEY
- See Also:
- Constant Field Values
-
STATUS_DONE
private static final java.util.Map<java.lang.String,java.lang.Object> STATUS_DONE
-
TIMEOUT_STATUS
private static final java.util.Map<java.lang.String,java.lang.Object> TIMEOUT_STATUS
-
responseMap
private java.util.Map<java.lang.String,java.lang.Object> responseMap
-
responseKey
private java.lang.String responseKey
-
subtypeKey
private java.lang.String subtypeKey
-
clazz
private java.lang.Class<?> clazz
-
subTypeClazz
private java.lang.Class<?> subTypeClazz
-
ignoreResponseKey
private boolean ignoreResponseKey
-
-
Method Detail
-
populate
public java.util.Map<java.lang.String,java.lang.Object> populate(JsonRpcResponse response)
-
updateResponse
private void updateResponse(java.lang.Object object)
-
checkAndUpdateStatus
private void checkAndUpdateStatus()
-
withResponseKey
public JsonResponseUtil withResponseKey(java.lang.String responseKey)
- Parameters:
responseKey- - Key used to store response value in resultMap.- Returns:
- this
JsonResponseUtil.
-
withResponseType
public JsonResponseUtil withResponseType(java.lang.Class<?> clazz)
- Parameters:
clazz- - A type of response which will be use instead of defaultMap.- Returns:
- this
JsonResponseUtil.
-
withIgnoreResponseKey
public JsonResponseUtil withIgnoreResponseKey()
During response decomposition we will ignore default key and use raw response structure as resultMap.- Returns:
- this
JsonResponseUtil.
-
withSubtypeKey
public JsonResponseUtil withSubtypeKey(java.lang.String subTypeKey)
- Parameters:
subTypeKey- - Key which is used to put subtype to result map.- Returns:
- this
JsonResponseUtil.
-
withSubTypeClazz
public JsonResponseUtil withSubTypeClazz(java.lang.Class<?> clazz)
- Parameters:
clazz- - type of the subtype.- Returns:
- this
JsonResponseUtil.
-
-