ProtoTranslatorFactory (Apache Hadoop YARN CSI 3.5.0 API)
Description: declaration: package: org.apache.hadoop.yarn.csi.translator, class: ProtoTranslatorFactory

Package org.apache.hadoop.yarn.csi.translator

# Class ProtoTranslatorFactory

java.lang.Object
org.apache.hadoop.yarn.csi.translator.ProtoTranslatorFactory

public final class ProtoTranslatorFactory extends Object
Factory class to get desired proto transformer instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <A, B> ProtoTranslator<A,B>`
  `getTranslator(Class<A> yarnProto, Class<B> csiProto)`
  Get a `ProtoTranslator` based on the given input message types.

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

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

- ## Method Details

  - ### getTranslator

    public static <A, B> ProtoTranslator<A,B> getTranslator(Class<A> yarnProto, Class<B> csiProto)
    Get a `ProtoTranslator` based on the given input message types. If the type is not supported, a IllegalArgumentException will be thrown. When adding more transformers to this factory class, note each transformer works exactly for one message to another (and vice versa). For each type of the message, make sure there is a corresponding unit test added, such as TestValidateVolumeCapabilitiesRequest.
    Type Parameters:
      `A` - yarn proto message
      `B` - CSI proto message
    Parameters:
      `yarnProto` - yarn proto message
      `csiProto` - CSI proto message
    Returns:
      a proto message transformer that transforms YARN internal proto message to CSI
    Throws:
      `IllegalArgumentException` - when given types are not supported