使用与Thrift类似——
下载EXE
https://developers.google.com/protocol-buffers/docs/downloads
Demo地址
https://developers.google.com/protocol-buffers/docs/javatutorial#compiling-your-protocol-buffers
中有addressbook.proto内容
举例子:放在
D:\Users\gg\Desktop\protoc-2.6.1-win32
address.proto如下:
package tutorial;
option java_package = "com.example.tutorial";
option java_outer_classname = "AddressBookProtos";
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
message AddressBook {
repeated Person person = 1;
}
在DOS该目录下运行
protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/addressbook.proto
如
protoc -I=D:\Users\gg\Desktop\protoc-2.6.1-win32 --java_out=D:\Users\gg\Desktop\protoc-2.6.1-win32 D:\Users\gg\Desktop\protoc-2.6.1-win32/addressbook.proto
后生成Java文件
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: addressbook.proto
package com.example.tutorial;
public final class AddressBookProtos {
private AddressBookProtos() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface PersonOrBuilder extends
// @@protoc_insertion_point(interface_extends:tutorial.Person)
com.google.protobuf.MessageOrBuilder {
/**
* required string name = 1;
*/
boolean hasName();
/**
* required string name = 1;
*/
java.lang.String getName();
/**
* required string name = 1;
*/
com.google.protobuf.ByteString
getNameBytes();
/**
* required int32 id = 2;
*/
boolean hasId();
/**
* required int32 id = 2;
*/
int getId();
/**
* optional string email = 3;
*/
boolean hasEmail();
/**
* optional string email = 3;
*/
java.lang.String getEmail();
/**
* optional string email = 3;
*/
com.google.protobuf.ByteString
getEmailBytes();
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
java.util.List
getPhoneList();
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
com.example.tutorial.AddressBookProtos.Person.PhoneNumber getPhone(int index);
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
int getPhoneCount();
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
java.util.List extends com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder>
getPhoneOrBuilderList();
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
int index);
}
/**
* Protobuf type {@code tutorial.Person}
*/
public static final class Person extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:tutorial.Person)
PersonOrBuilder {
// Use Person.newBuilder() to construct.
private Person(com.google.protobuf.GeneratedMessage.Builder> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Person(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Person defaultInstance;
public static Person getDefaultInstance() {
return defaultInstance;
}
public Person getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Person(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
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;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
name_ = bs;
break;
}
case 16: {
bitField0_ |= 0x00000002;
id_ = input.readInt32();
break;
}
case 26: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000004;
email_ = bs;
break;
}
case 34: {
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
phone_ = new java.util.ArrayList
mutable_bitField0_ |= 0x00000008;
}
phone_.add(input.readMessage(com.example.tutorial.AddressBookProtos.Person.PhoneNumber.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
phone_ = java.util.Collections.unmodifiableList(phone_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.example.tutorial.AddressBookProtos.Person.class, com.example.tutorial.AddressBookProtos.Person.Builder.class);
}
public static com.google.protobuf.Parser
new com.google.protobuf.AbstractParser
public Person parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Person(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser
return PARSER;
}
/**
* Protobuf enum {@code tutorial.Person.PhoneType}
*/
public enum PhoneType
implements com.google.protobuf.ProtocolMessageEnum {
/**
* MOBILE = 0;
*/
MOBILE(0, 0),
/**
* HOME = 1;
*/
HOME(1, 1),
/**
* WORK = 2;
*/
WORK(2, 2),
;
/**
* MOBILE = 0;
*/
public static final int MOBILE_VALUE = 0;
/**
* HOME = 1;
*/
public static final int HOME_VALUE = 1;
/**
* WORK = 2;
*/
public static final int WORK_VALUE = 2;
public final int getNumber() { return value; }
public static PhoneType valueOf(int value) {
switch (value) {
case 0: return MOBILE;
case 1: return HOME;
case 2: return WORK;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap
internalGetValueMap() {
return internalValueMap;
}
private static com.google.protobuf.Internal.EnumLiteMap
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap
public PhoneType findValueByNumber(int number) {
return PhoneType.valueOf(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
return getDescriptor().getValues().get(index);
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.Person.getDescriptor().getEnumTypes().get(0);
}
private static final PhoneType[] VALUES = values();
public static PhoneType valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
return VALUES[desc.getIndex()];
}
private final int index;
private final int value;
private PhoneType(int index, int value) {
this.index = index;
this.value = value;
}
// @@protoc_insertion_point(enum_scope:tutorial.Person.PhoneType)
}
public interface PhoneNumberOrBuilder extends
// @@protoc_insertion_point(interface_extends:tutorial.Person.PhoneNumber)
com.google.protobuf.MessageOrBuilder {
/**
* required string number = 1;
*/
boolean hasNumber();
/**
* required string number = 1;
*/
java.lang.String getNumber();
/**
* required string number = 1;
*/
com.google.protobuf.ByteString
getNumberBytes();
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
boolean hasType();
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
com.example.tutorial.AddressBookProtos.Person.PhoneType getType();
}
/**
* Protobuf type {@code tutorial.Person.PhoneNumber}
*/
public static final class PhoneNumber extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:tutorial.Person.PhoneNumber)
PhoneNumberOrBuilder {
// Use PhoneNumber.newBuilder() to construct.
private PhoneNumber(com.google.protobuf.GeneratedMessage.Builder> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private PhoneNumber(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final PhoneNumber defaultInstance;
public static PhoneNumber getDefaultInstance() {
return defaultInstance;
}
public PhoneNumber getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private PhoneNumber(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
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;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
com.google.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001;
number_ = bs;
break;
}
case 16: {
int rawValue = input.readEnum();
com.example.tutorial.AddressBookProtos.Person.PhoneType value = com.example.tutorial.AddressBookProtos.Person.PhoneType.valueOf(rawValue);
if (value == null) {
unknownFields.mergeVarintField(2, rawValue);
} else {
bitField0_ |= 0x00000002;
type_ = value;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.example.tutorial.AddressBookProtos.Person.PhoneNumber.class, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder.class);
}
public static com.google.protobuf.Parser
new com.google.protobuf.AbstractParser
public PhoneNumber parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new PhoneNumber(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser
return PARSER;
}
private int bitField0_;
public static final int NUMBER_FIELD_NUMBER = 1;
private java.lang.Object number_;
/**
* required string number = 1;
*/
public boolean hasNumber() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* required string number = 1;
*/
public java.lang.String getNumber() {
java.lang.Object ref = number_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
number_ = s;
}
return s;
}
}
/**
* required string number = 1;
*/
public com.google.protobuf.ByteString
getNumberBytes() {
java.lang.Object ref = number_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
number_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int TYPE_FIELD_NUMBER = 2;
private com.example.tutorial.AddressBookProtos.Person.PhoneType type_;
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
public boolean hasType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneType getType() {
return type_;
}
private void initFields() {
number_ = "";
type_ = com.example.tutorial.AddressBookProtos.Person.PhoneType.HOME;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasNumber()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getNumberBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeEnum(2, type_.getNumber());
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getNumberBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(2, type_.getNumber());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.example.tutorial.AddressBookProtos.Person.PhoneNumber parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.example.tutorial.AddressBookProtos.Person.PhoneNumber prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code tutorial.Person.PhoneNumber}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder
// @@protoc_insertion_point(builder_implements:tutorial.Person.PhoneNumber)
com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.example.tutorial.AddressBookProtos.Person.PhoneNumber.class, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder.class);
}
// Construct using com.example.tutorial.AddressBookProtos.Person.PhoneNumber.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
number_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
type_ = com.example.tutorial.AddressBookProtos.Person.PhoneType.HOME;
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_PhoneNumber_descriptor;
}
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber getDefaultInstanceForType() {
return com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDefaultInstance();
}
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber build() {
com.example.tutorial.AddressBookProtos.Person.PhoneNumber result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber buildPartial() {
com.example.tutorial.AddressBookProtos.Person.PhoneNumber result = new com.example.tutorial.AddressBookProtos.Person.PhoneNumber(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.number_ = number_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.type_ = type_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.example.tutorial.AddressBookProtos.Person.PhoneNumber) {
return mergeFrom((com.example.tutorial.AddressBookProtos.Person.PhoneNumber)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.example.tutorial.AddressBookProtos.Person.PhoneNumber other) {
if (other == com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDefaultInstance()) return this;
if (other.hasNumber()) {
bitField0_ |= 0x00000001;
number_ = other.number_;
onChanged();
}
if (other.hasType()) {
setType(other.getType());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasNumber()) {
return false;
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.example.tutorial.AddressBookProtos.Person.PhoneNumber parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.example.tutorial.AddressBookProtos.Person.PhoneNumber) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object number_ = "";
/**
* required string number = 1;
*/
public boolean hasNumber() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* required string number = 1;
*/
public java.lang.String getNumber() {
java.lang.Object ref = number_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
number_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* required string number = 1;
*/
public com.google.protobuf.ByteString
getNumberBytes() {
java.lang.Object ref = number_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
number_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* required string number = 1;
*/
public Builder setNumber(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
number_ = value;
onChanged();
return this;
}
/**
* required string number = 1;
*/
public Builder clearNumber() {
bitField0_ = (bitField0_ & ~0x00000001);
number_ = getDefaultInstance().getNumber();
onChanged();
return this;
}
/**
* required string number = 1;
*/
public Builder setNumberBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
number_ = value;
onChanged();
return this;
}
private com.example.tutorial.AddressBookProtos.Person.PhoneType type_ = com.example.tutorial.AddressBookProtos.Person.PhoneType.HOME;
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
public boolean hasType() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneType getType() {
return type_;
}
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
public Builder setType(com.example.tutorial.AddressBookProtos.Person.PhoneType value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000002;
type_ = value;
onChanged();
return this;
}
/**
* optional .tutorial.Person.PhoneType type = 2 [default = HOME];
*/
public Builder clearType() {
bitField0_ = (bitField0_ & ~0x00000002);
type_ = com.example.tutorial.AddressBookProtos.Person.PhoneType.HOME;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:tutorial.Person.PhoneNumber)
}
static {
defaultInstance = new PhoneNumber(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:tutorial.Person.PhoneNumber)
}
private int bitField0_;
public static final int NAME_FIELD_NUMBER = 1;
private java.lang.Object name_;
/**
* required string name = 1;
*/
public boolean hasName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* required string name = 1;
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
}
}
/**
* required string name = 1;
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int ID_FIELD_NUMBER = 2;
private int id_;
/**
* required int32 id = 2;
*/
public boolean hasId() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* required int32 id = 2;
*/
public int getId() {
return id_;
}
public static final int EMAIL_FIELD_NUMBER = 3;
private java.lang.Object email_;
/**
* optional string email = 3;
*/
public boolean hasEmail() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* optional string email = 3;
*/
public java.lang.String getEmail() {
java.lang.Object ref = email_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
email_ = s;
}
return s;
}
}
/**
* optional string email = 3;
*/
public com.google.protobuf.ByteString
getEmailBytes() {
java.lang.Object ref = email_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
email_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PHONE_FIELD_NUMBER = 4;
private java.util.List
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public java.util.List
return phone_;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public java.util.List extends com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder>
getPhoneOrBuilderList() {
return phone_;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public int getPhoneCount() {
return phone_.size();
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber getPhone(int index) {
return phone_.get(index);
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
int index) {
return phone_.get(index);
}
private void initFields() {
name_ = "";
id_ = 0;
email_ = "";
phone_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
if (!hasName()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasId()) {
memoizedIsInitialized = 0;
return false;
}
for (int i = 0; i < getPhoneCount(); i++) {
if (!getPhone(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getNameBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, id_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, getEmailBytes());
}
for (int i = 0; i < phone_.size(); i++) {
output.writeMessage(4, phone_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getNameBytes());
}
if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream
.computeInt32Size(2, id_);
}
if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getEmailBytes());
}
for (int i = 0; i < phone_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, phone_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.example.tutorial.AddressBookProtos.Person parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.example.tutorial.AddressBookProtos.Person parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.example.tutorial.AddressBookProtos.Person prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code tutorial.Person}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder
// @@protoc_insertion_point(builder_implements:tutorial.Person)
com.example.tutorial.AddressBookProtos.PersonOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.example.tutorial.AddressBookProtos.Person.class, com.example.tutorial.AddressBookProtos.Person.Builder.class);
}
// Construct using com.example.tutorial.AddressBookProtos.Person.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getPhoneFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
name_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
id_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
email_ = "";
bitField0_ = (bitField0_ & ~0x00000004);
if (phoneBuilder_ == null) {
phone_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
} else {
phoneBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_Person_descriptor;
}
public com.example.tutorial.AddressBookProtos.Person getDefaultInstanceForType() {
return com.example.tutorial.AddressBookProtos.Person.getDefaultInstance();
}
public com.example.tutorial.AddressBookProtos.Person build() {
com.example.tutorial.AddressBookProtos.Person result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.example.tutorial.AddressBookProtos.Person buildPartial() {
com.example.tutorial.AddressBookProtos.Person result = new com.example.tutorial.AddressBookProtos.Person(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001;
}
result.name_ = name_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002;
}
result.id_ = id_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004;
}
result.email_ = email_;
if (phoneBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008)) {
phone_ = java.util.Collections.unmodifiableList(phone_);
bitField0_ = (bitField0_ & ~0x00000008);
}
result.phone_ = phone_;
} else {
result.phone_ = phoneBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.example.tutorial.AddressBookProtos.Person) {
return mergeFrom((com.example.tutorial.AddressBookProtos.Person)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.example.tutorial.AddressBookProtos.Person other) {
if (other == com.example.tutorial.AddressBookProtos.Person.getDefaultInstance()) return this;
if (other.hasName()) {
bitField0_ |= 0x00000001;
name_ = other.name_;
onChanged();
}
if (other.hasId()) {
setId(other.getId());
}
if (other.hasEmail()) {
bitField0_ |= 0x00000004;
email_ = other.email_;
onChanged();
}
if (phoneBuilder_ == null) {
if (!other.phone_.isEmpty()) {
if (phone_.isEmpty()) {
phone_ = other.phone_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensurePhoneIsMutable();
phone_.addAll(other.phone_);
}
onChanged();
}
} else {
if (!other.phone_.isEmpty()) {
if (phoneBuilder_.isEmpty()) {
phoneBuilder_.dispose();
phoneBuilder_ = null;
phone_ = other.phone_;
bitField0_ = (bitField0_ & ~0x00000008);
phoneBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getPhoneFieldBuilder() : null;
} else {
phoneBuilder_.addAllMessages(other.phone_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
if (!hasName()) {
return false;
}
if (!hasId()) {
return false;
}
for (int i = 0; i < getPhoneCount(); i++) {
if (!getPhone(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.example.tutorial.AddressBookProtos.Person parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.example.tutorial.AddressBookProtos.Person) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.lang.Object name_ = "";
/**
* required string name = 1;
*/
public boolean hasName() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
/**
* required string name = 1;
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
name_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* required string name = 1;
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* required string name = 1;
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
name_ = value;
onChanged();
return this;
}
/**
* required string name = 1;
*/
public Builder clearName() {
bitField0_ = (bitField0_ & ~0x00000001);
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* required string name = 1;
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
name_ = value;
onChanged();
return this;
}
private int id_ ;
/**
* required int32 id = 2;
*/
public boolean hasId() {
return ((bitField0_ & 0x00000002) == 0x00000002);
}
/**
* required int32 id = 2;
*/
public int getId() {
return id_;
}
/**
* required int32 id = 2;
*/
public Builder setId(int value) {
bitField0_ |= 0x00000002;
id_ = value;
onChanged();
return this;
}
/**
* required int32 id = 2;
*/
public Builder clearId() {
bitField0_ = (bitField0_ & ~0x00000002);
id_ = 0;
onChanged();
return this;
}
private java.lang.Object email_ = "";
/**
* optional string email = 3;
*/
public boolean hasEmail() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
/**
* optional string email = 3;
*/
public java.lang.String getEmail() {
java.lang.Object ref = email_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
email_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* optional string email = 3;
*/
public com.google.protobuf.ByteString
getEmailBytes() {
java.lang.Object ref = email_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
email_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* optional string email = 3;
*/
public Builder setEmail(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
email_ = value;
onChanged();
return this;
}
/**
* optional string email = 3;
*/
public Builder clearEmail() {
bitField0_ = (bitField0_ & ~0x00000004);
email_ = getDefaultInstance().getEmail();
onChanged();
return this;
}
/**
* optional string email = 3;
*/
public Builder setEmailBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
email_ = value;
onChanged();
return this;
}
private java.util.List
java.util.Collections.emptyList();
private void ensurePhoneIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
phone_ = new java.util.ArrayList
bitField0_ |= 0x00000008;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.example.tutorial.AddressBookProtos.Person.PhoneNumber, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder, com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder> phoneBuilder_;
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public java.util.List
if (phoneBuilder_ == null) {
return java.util.Collections.unmodifiableList(phone_);
} else {
return phoneBuilder_.getMessageList();
}
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public int getPhoneCount() {
if (phoneBuilder_ == null) {
return phone_.size();
} else {
return phoneBuilder_.getCount();
}
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber getPhone(int index) {
if (phoneBuilder_ == null) {
return phone_.get(index);
} else {
return phoneBuilder_.getMessage(index);
}
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder setPhone(
int index, com.example.tutorial.AddressBookProtos.Person.PhoneNumber value) {
if (phoneBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePhoneIsMutable();
phone_.set(index, value);
onChanged();
} else {
phoneBuilder_.setMessage(index, value);
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder setPhone(
int index, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
if (phoneBuilder_ == null) {
ensurePhoneIsMutable();
phone_.set(index, builderForValue.build());
onChanged();
} else {
phoneBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder addPhone(com.example.tutorial.AddressBookProtos.Person.PhoneNumber value) {
if (phoneBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePhoneIsMutable();
phone_.add(value);
onChanged();
} else {
phoneBuilder_.addMessage(value);
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder addPhone(
int index, com.example.tutorial.AddressBookProtos.Person.PhoneNumber value) {
if (phoneBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePhoneIsMutable();
phone_.add(index, value);
onChanged();
} else {
phoneBuilder_.addMessage(index, value);
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder addPhone(
com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
if (phoneBuilder_ == null) {
ensurePhoneIsMutable();
phone_.add(builderForValue.build());
onChanged();
} else {
phoneBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder addPhone(
int index, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder builderForValue) {
if (phoneBuilder_ == null) {
ensurePhoneIsMutable();
phone_.add(index, builderForValue.build());
onChanged();
} else {
phoneBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder addAllPhone(
java.lang.Iterable extends com.example.tutorial.AddressBookProtos.Person.PhoneNumber> values) {
if (phoneBuilder_ == null) {
ensurePhoneIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, phone_);
onChanged();
} else {
phoneBuilder_.addAllMessages(values);
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder clearPhone() {
if (phoneBuilder_ == null) {
phone_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
} else {
phoneBuilder_.clear();
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public Builder removePhone(int index) {
if (phoneBuilder_ == null) {
ensurePhoneIsMutable();
phone_.remove(index);
onChanged();
} else {
phoneBuilder_.remove(index);
}
return this;
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder getPhoneBuilder(
int index) {
return getPhoneFieldBuilder().getBuilder(index);
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder getPhoneOrBuilder(
int index) {
if (phoneBuilder_ == null) {
return phone_.get(index); } else {
return phoneBuilder_.getMessageOrBuilder(index);
}
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public java.util.List extends com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder>
getPhoneOrBuilderList() {
if (phoneBuilder_ != null) {
return phoneBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(phone_);
}
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder addPhoneBuilder() {
return getPhoneFieldBuilder().addBuilder(
com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDefaultInstance());
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder addPhoneBuilder(
int index) {
return getPhoneFieldBuilder().addBuilder(
index, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.getDefaultInstance());
}
/**
* repeated .tutorial.Person.PhoneNumber phone = 4;
*/
public java.util.List
getPhoneBuilderList() {
return getPhoneFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.example.tutorial.AddressBookProtos.Person.PhoneNumber, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder, com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder>
getPhoneFieldBuilder() {
if (phoneBuilder_ == null) {
phoneBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.example.tutorial.AddressBookProtos.Person.PhoneNumber, com.example.tutorial.AddressBookProtos.Person.PhoneNumber.Builder, com.example.tutorial.AddressBookProtos.Person.PhoneNumberOrBuilder>(
phone_,
((bitField0_ & 0x00000008) == 0x00000008),
getParentForChildren(),
isClean());
phone_ = null;
}
return phoneBuilder_;
}
// @@protoc_insertion_point(builder_scope:tutorial.Person)
}
static {
defaultInstance = new Person(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:tutorial.Person)
}
public interface AddressBookOrBuilder extends
// @@protoc_insertion_point(interface_extends:tutorial.AddressBook)
com.google.protobuf.MessageOrBuilder {
/**
* repeated .tutorial.Person person = 1;
*/
java.util.List
getPersonList();
/**
* repeated .tutorial.Person person = 1;
*/
com.example.tutorial.AddressBookProtos.Person getPerson(int index);
/**
* repeated .tutorial.Person person = 1;
*/
int getPersonCount();
/**
* repeated .tutorial.Person person = 1;
*/
java.util.List extends com.example.tutorial.AddressBookProtos.PersonOrBuilder>
getPersonOrBuilderList();
/**
* repeated .tutorial.Person person = 1;
*/
com.example.tutorial.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
int index);
}
/**
* Protobuf type {@code tutorial.AddressBook}
*/
public static final class AddressBook extends
com.google.protobuf.GeneratedMessage implements
// @@protoc_insertion_point(message_implements:tutorial.AddressBook)
AddressBookOrBuilder {
// Use AddressBook.newBuilder() to construct.
private AddressBook(com.google.protobuf.GeneratedMessage.Builder> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private AddressBook(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final AddressBook defaultInstance;
public static AddressBook getDefaultInstance() {
return defaultInstance;
}
public AddressBook getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private AddressBook(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
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;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 10: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
person_ = new java.util.ArrayList
mutable_bitField0_ |= 0x00000001;
}
person_.add(input.readMessage(com.example.tutorial.AddressBookProtos.Person.PARSER, extensionRegistry));
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
person_ = java.util.Collections.unmodifiableList(person_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.example.tutorial.AddressBookProtos.AddressBook.class, com.example.tutorial.AddressBookProtos.AddressBook.Builder.class);
}
public static com.google.protobuf.Parser
new com.google.protobuf.AbstractParser
public AddressBook parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new AddressBook(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser
return PARSER;
}
public static final int PERSON_FIELD_NUMBER = 1;
private java.util.List
/**
* repeated .tutorial.Person person = 1;
*/
public java.util.List
return person_;
}
/**
* repeated .tutorial.Person person = 1;
*/
public java.util.List extends com.example.tutorial.AddressBookProtos.PersonOrBuilder>
getPersonOrBuilderList() {
return person_;
}
/**
* repeated .tutorial.Person person = 1;
*/
public int getPersonCount() {
return person_.size();
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.Person getPerson(int index) {
return person_.get(index);
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
int index) {
return person_.get(index);
}
private void initFields() {
person_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
for (int i = 0; i < getPersonCount(); i++) {
if (!getPerson(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < person_.size(); i++) {
output.writeMessage(1, person_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < person_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, person_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static com.example.tutorial.AddressBookProtos.AddressBook parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(com.example.tutorial.AddressBookProtos.AddressBook prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code tutorial.AddressBook}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder
// @@protoc_insertion_point(builder_implements:tutorial.AddressBook)
com.example.tutorial.AddressBookProtos.AddressBookOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.example.tutorial.AddressBookProtos.AddressBook.class, com.example.tutorial.AddressBookProtos.AddressBook.Builder.class);
}
// Construct using com.example.tutorial.AddressBookProtos.AddressBook.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
getPersonFieldBuilder();
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
if (personBuilder_ == null) {
person_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
personBuilder_.clear();
}
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.example.tutorial.AddressBookProtos.internal_static_tutorial_AddressBook_descriptor;
}
public com.example.tutorial.AddressBookProtos.AddressBook getDefaultInstanceForType() {
return com.example.tutorial.AddressBookProtos.AddressBook.getDefaultInstance();
}
public com.example.tutorial.AddressBookProtos.AddressBook build() {
com.example.tutorial.AddressBookProtos.AddressBook result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public com.example.tutorial.AddressBookProtos.AddressBook buildPartial() {
com.example.tutorial.AddressBookProtos.AddressBook result = new com.example.tutorial.AddressBookProtos.AddressBook(this);
int from_bitField0_ = bitField0_;
if (personBuilder_ == null) {
if (((bitField0_ & 0x00000001) == 0x00000001)) {
person_ = java.util.Collections.unmodifiableList(person_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.person_ = person_;
} else {
result.person_ = personBuilder_.build();
}
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.example.tutorial.AddressBookProtos.AddressBook) {
return mergeFrom((com.example.tutorial.AddressBookProtos.AddressBook)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.example.tutorial.AddressBookProtos.AddressBook other) {
if (other == com.example.tutorial.AddressBookProtos.AddressBook.getDefaultInstance()) return this;
if (personBuilder_ == null) {
if (!other.person_.isEmpty()) {
if (person_.isEmpty()) {
person_ = other.person_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensurePersonIsMutable();
person_.addAll(other.person_);
}
onChanged();
}
} else {
if (!other.person_.isEmpty()) {
if (personBuilder_.isEmpty()) {
personBuilder_.dispose();
personBuilder_ = null;
person_ = other.person_;
bitField0_ = (bitField0_ & ~0x00000001);
personBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getPersonFieldBuilder() : null;
} else {
personBuilder_.addAllMessages(other.person_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
for (int i = 0; i < getPersonCount(); i++) {
if (!getPerson(i).isInitialized()) {
return false;
}
}
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.example.tutorial.AddressBookProtos.AddressBook parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.example.tutorial.AddressBookProtos.AddressBook) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List
java.util.Collections.emptyList();
private void ensurePersonIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
person_ = new java.util.ArrayList
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilder<
com.example.tutorial.AddressBookProtos.Person, com.example.tutorial.AddressBookProtos.Person.Builder, com.example.tutorial.AddressBookProtos.PersonOrBuilder> personBuilder_;
/**
* repeated .tutorial.Person person = 1;
*/
public java.util.List
if (personBuilder_ == null) {
return java.util.Collections.unmodifiableList(person_);
} else {
return personBuilder_.getMessageList();
}
}
/**
* repeated .tutorial.Person person = 1;
*/
public int getPersonCount() {
if (personBuilder_ == null) {
return person_.size();
} else {
return personBuilder_.getCount();
}
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.Person getPerson(int index) {
if (personBuilder_ == null) {
return person_.get(index);
} else {
return personBuilder_.getMessage(index);
}
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder setPerson(
int index, com.example.tutorial.AddressBookProtos.Person value) {
if (personBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePersonIsMutable();
person_.set(index, value);
onChanged();
} else {
personBuilder_.setMessage(index, value);
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder setPerson(
int index, com.example.tutorial.AddressBookProtos.Person.Builder builderForValue) {
if (personBuilder_ == null) {
ensurePersonIsMutable();
person_.set(index, builderForValue.build());
onChanged();
} else {
personBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder addPerson(com.example.tutorial.AddressBookProtos.Person value) {
if (personBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePersonIsMutable();
person_.add(value);
onChanged();
} else {
personBuilder_.addMessage(value);
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder addPerson(
int index, com.example.tutorial.AddressBookProtos.Person value) {
if (personBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensurePersonIsMutable();
person_.add(index, value);
onChanged();
} else {
personBuilder_.addMessage(index, value);
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder addPerson(
com.example.tutorial.AddressBookProtos.Person.Builder builderForValue) {
if (personBuilder_ == null) {
ensurePersonIsMutable();
person_.add(builderForValue.build());
onChanged();
} else {
personBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder addPerson(
int index, com.example.tutorial.AddressBookProtos.Person.Builder builderForValue) {
if (personBuilder_ == null) {
ensurePersonIsMutable();
person_.add(index, builderForValue.build());
onChanged();
} else {
personBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder addAllPerson(
java.lang.Iterable extends com.example.tutorial.AddressBookProtos.Person> values) {
if (personBuilder_ == null) {
ensurePersonIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, person_);
onChanged();
} else {
personBuilder_.addAllMessages(values);
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder clearPerson() {
if (personBuilder_ == null) {
person_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
personBuilder_.clear();
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public Builder removePerson(int index) {
if (personBuilder_ == null) {
ensurePersonIsMutable();
person_.remove(index);
onChanged();
} else {
personBuilder_.remove(index);
}
return this;
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.Person.Builder getPersonBuilder(
int index) {
return getPersonFieldBuilder().getBuilder(index);
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.PersonOrBuilder getPersonOrBuilder(
int index) {
if (personBuilder_ == null) {
return person_.get(index); } else {
return personBuilder_.getMessageOrBuilder(index);
}
}
/**
* repeated .tutorial.Person person = 1;
*/
public java.util.List extends com.example.tutorial.AddressBookProtos.PersonOrBuilder>
getPersonOrBuilderList() {
if (personBuilder_ != null) {
return personBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(person_);
}
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.Person.Builder addPersonBuilder() {
return getPersonFieldBuilder().addBuilder(
com.example.tutorial.AddressBookProtos.Person.getDefaultInstance());
}
/**
* repeated .tutorial.Person person = 1;
*/
public com.example.tutorial.AddressBookProtos.Person.Builder addPersonBuilder(
int index) {
return getPersonFieldBuilder().addBuilder(
index, com.example.tutorial.AddressBookProtos.Person.getDefaultInstance());
}
/**
* repeated .tutorial.Person person = 1;
*/
public java.util.List
getPersonBuilderList() {
return getPersonFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
com.example.tutorial.AddressBookProtos.Person, com.example.tutorial.AddressBookProtos.Person.Builder, com.example.tutorial.AddressBookProtos.PersonOrBuilder>
getPersonFieldBuilder() {
if (personBuilder_ == null) {
personBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
com.example.tutorial.AddressBookProtos.Person, com.example.tutorial.AddressBookProtos.Person.Builder, com.example.tutorial.AddressBookProtos.PersonOrBuilder>(
person_,
((bitField0_ & 0x00000001) == 0x00000001),
getParentForChildren(),
isClean());
person_ = null;
}
return personBuilder_;
}
// @@protoc_insertion_point(builder_scope:tutorial.AddressBook)
}
static {
defaultInstance = new AddressBook(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:tutorial.AddressBook)
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_tutorial_Person_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_tutorial_Person_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_tutorial_Person_PhoneNumber_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_tutorial_AddressBook_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_tutorial_AddressBook_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\021addressbook.proto\022\010tutorial\"\332\001\n\006Person" +
"\022\014\n\004name\030\001 \002(\t\022\n\n\002id\030\002 \002(\005\022\r\n\005email\030\003 \001(" +
"\t\022+\n\005phone\030\004 \003(\0132\034.tutorial.Person.Phone" +
"Number\032M\n\013PhoneNumber\022\016\n\006number\030\001 \002(\t\022.\n" +
"\004type\030\002 \001(\0162\032.tutorial.Person.PhoneType:" +
"\004HOME\"+\n\tPhoneType\022\n\n\006MOBILE\020\000\022\010\n\004HOME\020\001" +
"\022\010\n\004WORK\020\002\"/\n\013AddressBook\022 \n\006person\030\001 \003(" +
"\0132\020.tutorial.PersonB)\n\024com.example.tutor" +
"ialB\021AddressBookProtos"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
internal_static_tutorial_Person_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_tutorial_Person_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_tutorial_Person_descriptor,
new java.lang.String[] { "Name", "Id", "Email", "Phone", });
internal_static_tutorial_Person_PhoneNumber_descriptor =
internal_static_tutorial_Person_descriptor.getNestedTypes().get(0);
internal_static_tutorial_Person_PhoneNumber_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_tutorial_Person_PhoneNumber_descriptor,
new java.lang.String[] { "Number", "Type", });
internal_static_tutorial_AddressBook_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_tutorial_AddressBook_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_tutorial_AddressBook_descriptor,
new java.lang.String[] { "Person", });
}
// @@protoc_insertion_point(outer_class_scope)
}