我看了很多教程,但我不明白如何使用协议缓冲区
为什么是“消息用户”?为什么不“类用户”?以及 Eclipse 是如何创建这样的消息的?为什么 name = 2 ?不是名称=“最大”
ption java_outer_classname="ProtoUser";
message User {
required int32 id = 1; // DB record ID
required string name = 2;
required string firstname = 3;
required string lastname = 4;
required string ssn= 5;
// Embedded Address message spec
message Address {
required int32 id = 1;
required string country = 2 [default = "US"];;
optional string state = 3;
optional string city = 4;
optional string street = 5;
optional string zip = 6;
enum Type {
HOME = 0;
WORK = 1;
}
optional Type addrType = 7 [default = HOME];
}
repeated Address addr = 16;
}