Class ProtobufTranslationImpl

    • Constructor Detail

      • ProtobufTranslationImpl

        public ProtobufTranslationImpl()
    • Method Detail

      • getAllMessageClasses

        private static java.util.List<java.lang.Class<?>> getAllMessageClasses()
      • wrapClassName

        private static com.google.protobuf.ByteString wrapClassName​(java.lang.Class<?> clz)
      • getParserForRequest

        public static ProtobufTranslationImpl.RequestTranslator getParserForRequest​(java.lang.String className)
        Fetches the concrete message's Parser implementation.
        Parameters:
        className - The protocol buffer class name
        Returns:
        The Parser for the class
        Throws:
        java.lang.IllegalArgumentException - If the argument is null or if a Parser for the given class name is not found.
      • getParserForResponse

        public static ProtobufTranslationImpl.ResponseTranslator getParserForResponse​(java.lang.String className)
        Fetches the concrete message's Parser implementation.
        Parameters:
        className - The protocol buffer class name
        Returns:
        The Parser for the class
        Throws:
        java.lang.IllegalArgumentException - If the argument is null or if a Parser for the given class name is not found.
      • serializeMessage

        void serializeMessage​(java.io.OutputStream out,
                              com.google.protobuf.Message msg)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getClassNameBytes

        com.google.protobuf.ByteString getClassNameBytes​(java.lang.Class<?> clz)
      • parseRequest

        public Service.Request parseRequest​(byte[] bytes)
                                     throws java.io.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:
        java.io.IOException - If the protocol buffer cannot be deserialized
      • parseResponse

        public Service.Response parseResponse​(byte[] bytes)
                                       throws java.io.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:
        java.io.IOException - If the protocol buffer cannot be deserialized