Package com.google.api.gax.httpjson
Class ProtoRestSerializer<RequestT extends com.google.protobuf.Message>
java.lang.Object
com.google.api.gax.httpjson.ProtoRestSerializer<RequestT>
This class serializes/deserializes protobuf
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.-
Method Summary
Modifier and TypeMethodDescriptionstatic <RequestT extends com.google.protobuf.Message>
ProtoRestSerializer<RequestT>create()Creates a new instance of ProtoRestSerializer.voidPuts a message field infieldsmap which will be used to populate URL path of a request.voidPuts a message field infieldsmap which will be used to populate query parameters of a request.Serializes a message to a request body in a form of JSON-encoded string.Serializes a message to a request body in a form of JSON-encoded string.
-
Method Details
-
create
Creates a new instance of ProtoRestSerializer. -
putPathParam
Puts a message field infieldsmap which will be used to populate URL path of a request.- Parameters:
fields- a map with serialized fieldsfieldName- a field namefieldValue- a field value
-
putQueryParam
Puts a message field infieldsmap which will be used to populate query parameters of a request.- Parameters:
fields- a map with serialized fieldsfieldName- a field namefieldValue- a field value
-
toBody
Serializes a message to a request body in a form of JSON-encoded string.- Parameters:
fieldName- a name of a request message field this message belongs tofieldValue- a field value to serialize
-
toBody
Serializes a message to a request body in a form of JSON-encoded string.- Parameters:
fieldName- a name of a request message field this message belongs tofieldValue- a field value to serializenumericEnum- a boolean flag that determine if enum values should be serialized to number
-