@BetaApi public class ProtoRestSerializer<RequestT extends com.google.protobuf.Message> extends Object
Message for REST interactions. It serializes
requests protobuf messages into REST messages, splitting the message into the JSON request body,
URL path parameters, and query parameters. It deserializes JSON responses into response protobuf
message.| Modifier and Type | Method and Description |
|---|---|
static <RequestT extends com.google.protobuf.Message> |
create()
Creates a new instance of ProtoRestSerializer.
|
void |
putPathParam(Map<String,String> fields,
String fieldName,
Object fieldValue)
Puts a message field in
fields map which will be used to populate URL path of a
request. |
void |
putQueryParam(Map<String,List<String>> fields,
String fieldName,
Object fieldValue)
Puts a message field in
fields map which will be used to populate query parameters of a
request. |
String |
toBody(String fieldName,
RequestT fieldValue)
Serializes a message to a request body in a form of JSON-encoded string.
|
public static <RequestT extends com.google.protobuf.Message> ProtoRestSerializer<RequestT> create()
public void putPathParam(Map<String,String> fields, String fieldName, Object fieldValue)
fields map which will be used to populate URL path of a
request.fields - a map with serialized fieldsfieldName - a field namefieldValue - a field valuepublic void putQueryParam(Map<String,List<String>> fields, String fieldName, Object fieldValue)
fields map which will be used to populate query parameters of a
request.fields - a map with serialized fieldsfieldName - a field namefieldValue - a field value