ProtobufWrapperLegacy (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.ipc, class: ProtobufWrapperLegacy

Package org.apache.hadoop.ipc

# Class ProtobufWrapperLegacy

java.lang.Object
org.apache.hadoop.ipc.RpcWritable
org.apache.hadoop.ipc.ProtobufWrapperLegacy

All Implemented Interfaces:
  `Writable`

@Private public class ProtobufWrapperLegacy extends RpcWritable
A RpcWritable wrapper for unshaded protobuf messages. This class isolates unshaded protobuf classes from the rest of the RPC codebase, so it can operate without needing that on the classpath at runtime. The classes are needed at compile time; and if unshaded protobuf messages are to be marshalled, they will need to be on the classpath then. That is implicit: it is impossible to pass in a class which is a protobuf message unless that condition is met.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.hadoop.ipc.RpcWritable

  `RpcWritable.Buffer`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProtobufWrapperLegacy(Object message)`
  Construct.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.google.protobuf.Message`
  `getMessage()`
  `static boolean`
  `isUnshadedProtobufMessage(Object payload)`
  Is a message an unshaded protobuf message?
  `protected <T> T`
  `readFrom(ByteBuffer bb)`
  `void`
  `writeTo(ResponseBuffer out)`

  ### Methods inherited from class org.apache.hadoop.ipc.RpcWritable

  `readFields, write`

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

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

- ## Constructor Details

  - ### ProtobufWrapperLegacy

    public ProtobufWrapperLegacy(Object message)
    Construct. The type of the parameter is Object so as to keep the casting internal to this class.
    Parameters:
      `message` - message to wrap.
    Throws:
      `IllegalArgumentException` - if the class is not a protobuf message.

- ## Method Details

  - ### getMessage

    public com.google.protobuf.Message getMessage()

  - ### writeTo

    public void writeTo(ResponseBuffer out) throws IOException
    Throws:
      `IOException`

  - ### readFrom

    protected <T> T readFrom(ByteBuffer bb) throws IOException
    Throws:
      `IOException`

  - ### isUnshadedProtobufMessage

    public static boolean isUnshadedProtobufMessage(Object payload)
    Is a message an unshaded protobuf message?
    Parameters:
      `payload` - payload
    Returns:
      true if protobuf.jar is on the classpath and the payload is a Message