Descriptors.java 文件源码

java
阅读 66 收藏 0 点赞 0 评论 0

项目:Beam 作者:
/**
 * Replace our {@link FileDescriptorProto} with the given one, which is
 * identical except that it might contain extensions that weren't
 * present in the original. This method is needed for bootstrapping when
 * a file defines custom options. The options may be defined in the file
 * itself, so we can't actually parse them until we've constructed the
 * descriptors, but to construct the descriptors we have to have parsed
 * the descriptor protos. So, we have to parse the descriptor protos a
 * second time after constructing the descriptors.
 */
private void setProto (final FileDescriptorProto proto) {
    this.proto = proto;

    for (int i = 0; i < messageTypes.length; i++) {
        messageTypes[i].setProto (proto.getMessageType (i));
    }

    for (int i = 0; i < enumTypes.length; i++) {
        enumTypes[i].setProto (proto.getEnumType (i));
    }

    for (int i = 0; i < services.length; i++) {
        services[i].setProto (proto.getService (i));
    }

    for (int i = 0; i < extensions.length; i++) {
        extensions[i].setProto (proto.getExtension (i));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号