Package org.ovirt.vdsm.jsonrpc.client
Class RequestBuilder
- java.lang.Object
-
- org.ovirt.vdsm.jsonrpc.client.RequestBuilder
-
public class RequestBuilder extends java.lang.Object
Utility class which helps to buildJsonRpcRequest
by providing information like method name and parameters.
-
-
Constructor Summary
Constructors Constructor Description RequestBuilder(java.lang.String methodName)
Creates builder with required methodName.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonRpcRequest
build()
BuildsJsonRpcRequest
based on provided method name, parameter and generates id usingUUID
.RequestBuilder
withOptionalParameter(java.lang.String name, java.lang.Object value)
Adds parameter which is optional by method runtime and if not provided default value will be used during method execution.RequestBuilder
withOptionalParameter(java.lang.String name, java.lang.String value)
Adds parameter which is optional by method runtime and if not provided default value will be used during method execution.RequestBuilder
withOptionalParameterAsList(java.lang.String name, java.util.List value)
AddsList
of values which is optional by method runtime and if not provided default value will be used during method execution.RequestBuilder
withOptionalParameterAsMap(java.lang.String name, java.util.Map value)
AddsMap
of values which is optional by method runtime and if not provided default value will be used during method execution.RequestBuilder
withParameter(java.lang.String name, java.lang.Object value)
Adds parameter which is required by method runtime.RequestBuilder
withParameter(java.lang.String name, java.lang.String value)
Adds parameter which is required by method runtime.
-
-
-
Method Detail
-
withParameter
public RequestBuilder withParameter(java.lang.String name, java.lang.String value)
Adds parameter which is required by method runtime.- Parameters:
name
- - Name of the parameter.value
- - Value of the parameter.- Returns:
RequestBuilder
to let add more parameters.
-
withOptionalParameter
public RequestBuilder withOptionalParameter(java.lang.String name, java.lang.String value)
Adds parameter which is optional by method runtime and if not provided default value will be used during method execution.- Parameters:
name
- - Name of the parameter.value
- - Value of the parameter ornull
.- Returns:
RequestBuilder
to let add more parameters.
-
withOptionalParameter
public RequestBuilder withOptionalParameter(java.lang.String name, java.lang.Object value)
Adds parameter which is optional by method runtime and if not provided default value will be used during method execution.- Parameters:
name
- - Name of the parameter.value
- - Value of the parameter ornull
.- Returns:
RequestBuilder
to let add more parameters.
-
withOptionalParameterAsList
public RequestBuilder withOptionalParameterAsList(java.lang.String name, java.util.List value)
AddsList
of values which is optional by method runtime and if not provided default value will be used during method execution.- Parameters:
name
- - Name of the parameter.value
- -List
of values which may benull
or emptyList
.- Returns:
RequestBuilder
to let add more parameters.
-
withOptionalParameterAsMap
public RequestBuilder withOptionalParameterAsMap(java.lang.String name, java.util.Map value)
AddsMap
of values which is optional by method runtime and if not provided default value will be used during method execution.- Parameters:
name
- - Name of the parameter.value
- -Map
of values which may benull
or emptyMap
.- Returns:
RequestBuilder
to let add more parameters.
-
withParameter
public RequestBuilder withParameter(java.lang.String name, java.lang.Object value)
Adds parameter which is required by method runtime.- Parameters:
name
- - Name of the parameter.value
- - Value of the parameter which is different thanString
.- Returns:
RequestBuilder
to let add more parameters.
-
build
public JsonRpcRequest build()
BuildsJsonRpcRequest
based on provided method name, parameter and generates id usingUUID
.- Returns:
- Request object.
-
-