当前位置: 首页 > article >正文

protobuf使用说明

目录

  • 0.注
  • 1. .proto文件
    • 编写要求
      • 首行:
      • package声明(可选)
      • message消息
  • 2. 编译
  • 3.使用

0.注

请在安装protobuf的系统上进行操作,安装详见地址

1. .proto文件

.proto文件在整个protobuf中处于核心地位
通常而言,一个项目有着单独的 .proto文件

在任意目录下创建xxx.proto文件,并对其进行编辑

编写要求

首行:

指定文件语法为 proto3,如果没有则默认为proto2

syntax = "proto3";

package声明(可选)

指定消息的所属包名,避免命名冲突

package org.wunaiieq.util;  

message消息

语法定义说明如下,注意每个消息字段需要有单独的字段编号,此编号不可修改

message Phone {
    int32 length = 1;  
    string dnum = 2;  
    int32 type = 3;  
    string date = 4;  
}

数据类型如下
在这里插入图片描述

2. 编译

调用Protocol Buffers 的编译器,并将 .proto 文件编译成指定编程语言的源代码
JAVA:

protoc myPhone.proto --java_out ./

Python

protoc myPhone.proto --python_out ./

JavaScript/TypeScript (用于Node.js或浏览器)

protoc myPhone.proto --ts_out ./

不演示了,自行搜索(以JAVA为例)

编译完成后直接显示出对应的包和java文件
/opt/wunaiieq/util为编写的package
前面的目录不重要,和.proto文件处于同一目录
在这里插入图片描述

3.使用

将此java文件下载到你的项目中
注意包名(不重要)

下载依赖
在pom.xml文件中增加如下

        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>3.19.1</version>
        </dependency>

代码
生成的代码如下

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: myPhone.proto

package org.wunaiieq.util;

public final class MyPhone {
  private MyPhone() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  public interface PhoneOrBuilder extends
      // @@protoc_insertion_point(interface_extends:org.wunaiieq.util.Phone)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>int32 length = 1;</code>
     * @return The length.
     */
    int getLength();

    /**
     * <code>string dnum = 2;</code>
     * @return The dnum.
     */
    String getDnum();
    /**
     * <code>string dnum = 2;</code>
     * @return The bytes for dnum.
     */
    com.google.protobuf.ByteString
        getDnumBytes();

    /**
     * <code>int32 type = 3;</code>
     * @return The type.
     */
    int getType();

    /**
     * <code>string date = 4;</code>
     * @return The date.
     */
    String getDate();
    /**
     * <code>string date = 4;</code>
     * @return The bytes for date.
     */
    com.google.protobuf.ByteString
        getDateBytes();
  }
  /**
   * Protobuf type {@code org.wunaiieq.util.Phone}
   */
  public static final class Phone extends
      com.google.protobuf.GeneratedMessageV3 implements
      // @@protoc_insertion_point(message_implements:org.wunaiieq.util.Phone)
      PhoneOrBuilder {
  private static final long serialVersionUID = 0L;
    // Use Phone.newBuilder() to construct.
    private Phone(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }
    private Phone() {
      dnum_ = "";
      date_ = "";
    }

    @Override
    @SuppressWarnings({"unused"})
    protected Object newInstance(
        UnusedPrivateParameter unused) {
      return new Phone();
    }

    @Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
      return this.unknownFields;
    }
    private Phone(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new NullPointerException();
      }
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 8: {

              length_ = input.readInt32();
              break;
            }
            case 18: {
              String s = input.readStringRequireUtf8();

              dnum_ = s;
              break;
            }
            case 24: {

              type_ = input.readInt32();
              break;
            }
            case 34: {
              String s = input.readStringRequireUtf8();

              date_ = s;
              break;
            }
            default: {
              if (!parseUnknownField(
                  input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return internal_static_org_wunaiieq_util_Phone_descriptor;
    }

    @Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return internal_static_org_wunaiieq_util_Phone_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              org.wunaiieq.util.MyPhone.Phone.class, org.wunaiieq.util.MyPhone.Phone.Builder.class);
    }

    public static final int LENGTH_FIELD_NUMBER = 1;
    private int length_;
    /**
     * <code>int32 length = 1;</code>
     * @return The length.
     */
    @Override
    public int getLength() {
      return length_;
    }

    public static final int DNUM_FIELD_NUMBER = 2;
    private volatile Object dnum_;
    /**
     * <code>string dnum = 2;</code>
     * @return The dnum.
     */
    @Override
    public String getDnum() {
      Object ref = dnum_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        dnum_ = s;
        return s;
      }
    }
    /**
     * <code>string dnum = 2;</code>
     * @return The bytes for dnum.
     */
    @Override
    public com.google.protobuf.ByteString
        getDnumBytes() {
      Object ref = dnum_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        dnum_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    public static final int TYPE_FIELD_NUMBER = 3;
    private int type_;
    /**
     * <code>int32 type = 3;</code>
     * @return The type.
     */
    @Override
    public int getType() {
      return type_;
    }

    public static final int DATE_FIELD_NUMBER = 4;
    private volatile Object date_;
    /**
     * <code>string date = 4;</code>
     * @return The date.
     */
    @Override
    public String getDate() {
      Object ref = date_;
      if (ref instanceof String) {
        return (String) ref;
      } else {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        String s = bs.toStringUtf8();
        date_ = s;
        return s;
      }
    }
    /**
     * <code>string date = 4;</code>
     * @return The bytes for date.
     */
    @Override
    public com.google.protobuf.ByteString
        getDateBytes() {
      Object ref = date_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8(
                (String) ref);
        date_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private byte memoizedIsInitialized = -1;
    @Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @Override
    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      if (length_ != 0) {
        output.writeInt32(1, length_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(dnum_)) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, dnum_);
      }
      if (type_ != 0) {
        output.writeInt32(3, type_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(date_)) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 4, date_);
      }
      unknownFields.writeTo(output);
    }

    @Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (length_ != 0) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(1, length_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(dnum_)) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, dnum_);
      }
      if (type_ != 0) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(3, type_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(date_)) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, date_);
      }
      size += unknownFields.getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @Override
    public boolean equals(final Object obj) {
      if (obj == this) {
       return true;
      }
      if (!(obj instanceof org.wunaiieq.util.MyPhone.Phone)) {
        return super.equals(obj);
      }
      org.wunaiieq.util.MyPhone.Phone other = (org.wunaiieq.util.MyPhone.Phone) obj;

      if (getLength()
          != other.getLength()) return false;
      if (!getDnum()
          .equals(other.getDnum())) return false;
      if (getType()
          != other.getType()) return false;
      if (!getDate()
          .equals(other.getDate())) return false;
      if (!unknownFields.equals(other.unknownFields)) return false;
      return true;
    }

    @Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + LENGTH_FIELD_NUMBER;
      hash = (53 * hash) + getLength();
      hash = (37 * hash) + DNUM_FIELD_NUMBER;
      hash = (53 * hash) + getDnum().hashCode();
      hash = (37 * hash) + TYPE_FIELD_NUMBER;
      hash = (53 * hash) + getType();
      hash = (37 * hash) + DATE_FIELD_NUMBER;
      hash = (53 * hash) + getDate().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        java.nio.ByteBuffer data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input, extensionRegistry);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static org.wunaiieq.util.MyPhone.Phone parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input, extensionRegistry);
    }

    @Override
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }
    public static Builder newBuilder(org.wunaiieq.util.MyPhone.Phone prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    @Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE
          ? new Builder() : new Builder().mergeFrom(this);
    }

    @Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code org.wunaiieq.util.Phone}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:org.wunaiieq.util.Phone)
        org.wunaiieq.util.MyPhone.PhoneOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return internal_static_org_wunaiieq_util_Phone_descriptor;
      }

      @Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return internal_static_org_wunaiieq_util_Phone_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                org.wunaiieq.util.MyPhone.Phone.class, org.wunaiieq.util.MyPhone.Phone.Builder.class);
      }

      // Construct using org.wunaiieq.util.MyPhone.Phone.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3
                .alwaysUseFieldBuilders) {
        }
      }
      @Override
      public Builder clear() {
        super.clear();
        length_ = 0;

        dnum_ = "";

        type_ = 0;

        date_ = "";

        return this;
      }

      @Override
      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return internal_static_org_wunaiieq_util_Phone_descriptor;
      }

      @Override
      public org.wunaiieq.util.MyPhone.Phone getDefaultInstanceForType() {
        return getDefaultInstance();
      }

      @Override
      public org.wunaiieq.util.MyPhone.Phone build() {
        org.wunaiieq.util.MyPhone.Phone result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @Override
      public org.wunaiieq.util.MyPhone.Phone buildPartial() {
        org.wunaiieq.util.MyPhone.Phone result = new org.wunaiieq.util.MyPhone.Phone(this);
        result.length_ = length_;
        result.dnum_ = dnum_;
        result.type_ = type_;
        result.date_ = date_;
        onBuilt();
        return result;
      }

      @Override
      public Builder clone() {
        return super.clone();
      }
      @Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          Object value) {
        return super.setField(field, value);
      }
      @Override
      public Builder clearField(
          com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }
      @Override
      public Builder clearOneof(
          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }
      @Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index, Object value) {
        return super.setRepeatedField(field, index, value);
      }
      @Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          Object value) {
        return super.addRepeatedField(field, value);
      }
      @Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof org.wunaiieq.util.MyPhone.Phone) {
          return mergeFrom((org.wunaiieq.util.MyPhone.Phone)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(org.wunaiieq.util.MyPhone.Phone other) {
        if (other == getDefaultInstance()) return this;
        if (other.getLength() != 0) {
          setLength(other.getLength());
        }
        if (!other.getDnum().isEmpty()) {
          dnum_ = other.dnum_;
          onChanged();
        }
        if (other.getType() != 0) {
          setType(other.getType());
        }
        if (!other.getDate().isEmpty()) {
          date_ = other.date_;
          onChanged();
        }
        this.mergeUnknownFields(other.unknownFields);
        onChanged();
        return this;
      }

      @Override
      public final boolean isInitialized() {
        return true;
      }

      @Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        org.wunaiieq.util.MyPhone.Phone parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (org.wunaiieq.util.MyPhone.Phone) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }

      private int length_ ;
      /**
       * <code>int32 length = 1;</code>
       * @return The length.
       */
      @Override
      public int getLength() {
        return length_;
      }
      /**
       * <code>int32 length = 1;</code>
       * @param value The length to set.
       * @return This builder for chaining.
       */
      public Builder setLength(int value) {

        length_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>int32 length = 1;</code>
       * @return This builder for chaining.
       */
      public Builder clearLength() {

        length_ = 0;
        onChanged();
        return this;
      }

      private Object dnum_ = "";
      /**
       * <code>string dnum = 2;</code>
       * @return The dnum.
       */
      public String getDnum() {
        Object ref = dnum_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          dnum_ = s;
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>string dnum = 2;</code>
       * @return The bytes for dnum.
       */
      public com.google.protobuf.ByteString
          getDnumBytes() {
        Object ref = dnum_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          dnum_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>string dnum = 2;</code>
       * @param value The dnum to set.
       * @return This builder for chaining.
       */
      public Builder setDnum(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }

        dnum_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>string dnum = 2;</code>
       * @return This builder for chaining.
       */
      public Builder clearDnum() {

        dnum_ = getDefaultInstance().getDnum();
        onChanged();
        return this;
      }
      /**
       * <code>string dnum = 2;</code>
       * @param value The bytes for dnum to set.
       * @return This builder for chaining.
       */
      public Builder setDnumBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);

        dnum_ = value;
        onChanged();
        return this;
      }

      private int type_ ;
      /**
       * <code>int32 type = 3;</code>
       * @return The type.
       */
      @Override
      public int getType() {
        return type_;
      }
      /**
       * <code>int32 type = 3;</code>
       * @param value The type to set.
       * @return This builder for chaining.
       */
      public Builder setType(int value) {

        type_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>int32 type = 3;</code>
       * @return This builder for chaining.
       */
      public Builder clearType() {

        type_ = 0;
        onChanged();
        return this;
      }

      private Object date_ = "";
      /**
       * <code>string date = 4;</code>
       * @return The date.
       */
      public String getDate() {
        Object ref = date_;
        if (!(ref instanceof String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          String s = bs.toStringUtf8();
          date_ = s;
          return s;
        } else {
          return (String) ref;
        }
      }
      /**
       * <code>string date = 4;</code>
       * @return The bytes for date.
       */
      public com.google.protobuf.ByteString
          getDateBytes() {
        Object ref = date_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b =
              com.google.protobuf.ByteString.copyFromUtf8(
                  (String) ref);
          date_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>string date = 4;</code>
       * @param value The date to set.
       * @return This builder for chaining.
       */
      public Builder setDate(
          String value) {
        if (value == null) {
    throw new NullPointerException();
  }

        date_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>string date = 4;</code>
       * @return This builder for chaining.
       */
      public Builder clearDate() {

        date_ = getDefaultInstance().getDate();
        onChanged();
        return this;
      }
      /**
       * <code>string date = 4;</code>
       * @param value The bytes for date to set.
       * @return This builder for chaining.
       */
      public Builder setDateBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);

        date_ = value;
        onChanged();
        return this;
      }
      @Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.setUnknownFields(unknownFields);
      }

      @Override
      public final Builder mergeUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.mergeUnknownFields(unknownFields);
      }


      // @@protoc_insertion_point(builder_scope:org.wunaiieq.util.Phone)
    }

    // @@protoc_insertion_point(class_scope:org.wunaiieq.util.Phone)
    private static final org.wunaiieq.util.MyPhone.Phone DEFAULT_INSTANCE;
    static {
      DEFAULT_INSTANCE = new org.wunaiieq.util.MyPhone.Phone();
    }

    public static org.wunaiieq.util.MyPhone.Phone getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<Phone>
        PARSER = new com.google.protobuf.AbstractParser<Phone>() {
      @Override
      public Phone parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new Phone(input, extensionRegistry);
      }
    };

    public static com.google.protobuf.Parser<Phone> parser() {
      return PARSER;
    }

    @Override
    public com.google.protobuf.Parser<Phone> getParserForType() {
      return PARSER;
    }

    @Override
    public org.wunaiieq.util.MyPhone.Phone getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }

  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_org_wunaiieq_util_Phone_descriptor;
  private static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_org_wunaiieq_util_Phone_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static  com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    String[] descriptorData = {
      "\n\rmyPhone.proto\022\021org.wunaiieq.util\"A\n\005Ph" +
      "one\022\016\n\006length\030\001 \001(\005\022\014\n\004dnum\030\002 \001(\t\022\014\n\004typ" +
      "e\030\003 \001(\005\022\014\n\004date\030\004 \001(\tb\006proto3"
    };
    descriptor = com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        });
    internal_static_org_wunaiieq_util_Phone_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_org_wunaiieq_util_Phone_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_org_wunaiieq_util_Phone_descriptor,
        new String[] { "Length", "Dnum", "Type", "Date", });
  }
  // @@protoc_insertion_point(outer_class_scope)
}


http://www.kler.cn/a/422199.html

相关文章:

  • 相交的链表
  • Unity AssetBundles(AB包)
  • 家政小程序开发,打造便捷家政生活小程序
  • Kafka配置SASL/PLAINTEXT安全认证
  • 《山海经》:北山
  • 第七课 Unity编辑器创建的资源优化_UI篇(UGUI)
  • html+css网页设计马林旅行社移动端4个页面
  • Python Web 开发 FastAPI 入门:从基础架构到框架比较
  • Go 语言函数编程指南:定义、调用技巧与返回值机制
  • 40分钟学 Go 语言高并发:基准测试编写
  • 项目开发规范
  • 论文:IoU Loss for 2D/3D Object Detection
  • 明明的随机数
  • FPGA实战篇(触摸按键控制LED灯)
  • Mock.js的学习使用
  • 5G学习笔记之随机接入
  • 基于Java Springboot校园导航微信小程序
  • 658.找到K个最接近的元素(双指针)
  • 【深度学习】—CNN卷积神经网络 从原理到实现
  • 社区团购中 2+1 链动模式商城小程序的创新融合与发展策略研究
  • Linux 网卡收包流程如下
  • 手机ip地址取决于什么?可以随便改吗
  • 20240921解决使用PotPlayer在WIN10电脑播放4K分辨率10bit的视频出现偏色的问题
  • stable diffusion实践操作-大模型介绍:SD的发展历史,SD1.5和SDXL之间的差别
  • DVWA靶场——XSS(Stored)
  • 数据库python连接测试