Class ProtoUtils


  • public class ProtoUtils
    extends Object

    Provides protobuf utility functions.

    This class has code derived from method in the com.google.api.graphql.grpc library

    • Method Detail

      • mapGrpcError

        public static RuntimeException mapGrpcError​(io.grpc.StatusRuntimeException sre)
        Map the gRPC error to representative Java exception.
        Parameters:
        sre - the GRPC error (required)
        Returns:
        a representative Java exception
      • toMap

        public static Map<String,​Object> toMap​(com.google.protobuf.Struct struct)
        Return a new Map built from the given struct.
        Parameters:
        struct - the protobuf Struct object
        Returns:
        a Map object.
      • toStruct

        public static com.google.protobuf.Struct toStruct​(Map<String,​Object> map)
        Return a new Struct built from the given Map.
        Parameters:
        map - the map object (required)
        Returns:
        a new protobuf Struct object