Class JsonToProtoMessage


  • public class JsonToProtoMessage
    extends Object
    Converts Json data to protocol buffer messages given the protocol buffer descriptor. The protobuf descriptor must have all fields lowercased.
    • Constructor Detail

      • JsonToProtoMessage

        public JsonToProtoMessage()
    • Method Detail

      • convertJsonToProtoMessage

        public static com.google.protobuf.DynamicMessage convertJsonToProtoMessage​(com.google.protobuf.Descriptors.Descriptor protoSchema,
                                                                                   org.json.JSONObject json)
                                                                            throws IllegalArgumentException
        Converts Json data to protocol buffer messages given the protocol buffer descriptor.
        Parameters:
        protoSchema -
        json -
        Throws:
        IllegalArgumentException - when JSON data is not compatible with proto descriptor.
      • convertJsonToProtoMessage

        public static com.google.protobuf.DynamicMessage convertJsonToProtoMessage​(com.google.protobuf.Descriptors.Descriptor protoSchema,
                                                                                   TableSchema tableSchema,
                                                                                   org.json.JSONObject json)
                                                                            throws IllegalArgumentException
        Converts Json data to protocol buffer messages given the protocol buffer descriptor.
        Parameters:
        protoSchema -
        tableSchema - bigquery table schema is needed for type conversion of DATETIME, TIME, NUMERIC, BIGNUMERIC
        json -
        Throws:
        IllegalArgumentException - when JSON data is not compatible with proto descriptor.