Package org.apache.calcite.avatica.remote

# Class ProtobufTranslationImpl

java.lang.Object
org.apache.calcite.avatica.remote.ProtobufTranslationImpl

All Implemented Interfaces:
  `ProtobufTranslation`

public class ProtobufTranslationImpl extends Object implements ProtobufTranslation
Implementation of `ProtobufTranslationImpl` that translates protobuf requests to POJO requests.

## Constructor Summary

Constructors
Constructor
Description
`ProtobufTranslationImpl()`

## Method Summary

Modifier and Type
Method
Description
`static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.RequestTranslator`
`getParserForRequest(String className)`
Fetches the concrete message's Parser implementation.
`static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.ResponseTranslator`
`getParserForResponse(String className)`
Fetches the concrete message's Parser implementation.
`Service.Request`
`parseRequest(byte[] bytes)`
Parses a serialized protocol buffer request into a `Service.Request`.
`Service.Response`
`parseResponse(byte[] bytes)`
Parses a serialized protocol buffer response into a `Service.Response`.
`byte[]`
`serializeRequest(Service.Request request)`
Serializes a `Service.Request` as a protocol buffer.
`byte[]`
`serializeResponse(Service.Response response)`
Serializes a `Service.Response` as a protocol buffer.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ProtobufTranslationImpl

public ProtobufTranslationImpl()

## Method Details

### getParserForRequest

public static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.RequestTranslator getParserForRequest(String className)
Fetches the concrete message's Parser implementation.

Parameters:
  `className` - The protocol buffer class name
Returns:
  The Parser for the class
Throws:
  `IllegalArgumentException` - If the argument is null or if a Parser for the given class name is not found.

### getParserForResponse

public static org.apache.calcite.avatica.remote.ProtobufTranslationImpl.ResponseTranslator getParserForResponse(String className)
Fetches the concrete message's Parser implementation.

Parameters:
  `className` - The protocol buffer class name
Returns:
  The Parser for the class
Throws:
  `IllegalArgumentException` - If the argument is null or if a Parser for the given class name is not found.

### serializeResponse

public byte[] serializeResponse(Service.Response response) throws IOException
Description copied from interface: `ProtobufTranslation`
Serializes a `Service.Response` as a protocol buffer.

Specified by:
  `serializeResponse` in interface `ProtobufTranslation`
Parameters:
  `response` - The response to serialize
Throws:
  `IOException` - If there are errors during serialization

### serializeRequest

public byte[] serializeRequest(Service.Request request) throws IOException
Description copied from interface: `ProtobufTranslation`
Serializes a `Service.Request` as a protocol buffer.

Specified by:
  `serializeRequest` in interface `ProtobufTranslation`
Parameters:
  `request` - The request to serialize
Throws:
  `IOException` - If there are errors during serialization

### parseRequest

public Service.Request parseRequest(byte[] bytes) throws IOException
Description copied from interface: `ProtobufTranslation`
Parses a serialized protocol buffer request into a `Service.Request`.

Specified by:
  `parseRequest` in interface `ProtobufTranslation`
Parameters:
  `bytes` - Serialized protocol buffer request from client
Returns:
  A Request object for the given bytes
Throws:
  `IOException` - If the protocol buffer cannot be deserialized

### parseResponse

public Service.Response parseResponse(byte[] bytes) throws IOException
Description copied from interface: `ProtobufTranslation`
Parses a serialized protocol buffer response into a `Service.Response`.

Specified by:
  `parseResponse` in interface `ProtobufTranslation`
Parameters:
  `bytes` - Serialized protocol buffer request from server
Returns:
  The Response object for the given bytes
Throws:
  `IOException` - If the protocol buffer cannot be deserialized