aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffersLite.Test
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-09-09 21:05:29 -0500
committerrogerk <devnull@localhost>2011-09-09 21:05:29 -0500
commit1a0764ab27ae7189ae4b2b8a1d9f7a0599568282 (patch)
tree413ef5d6826ce9ba6568a1696a9ada8aaad1f17f /src/ProtocolBuffersLite.Test
parent8f0dcf3df1548a1eff0bed54a9b992f55b8f72d5 (diff)
downloadprotobuf-1a0764ab27ae7189ae4b2b8a1d9f7a0599568282.tar.gz
protobuf-1a0764ab27ae7189ae4b2b8a1d9f7a0599568282.tar.bz2
protobuf-1a0764ab27ae7189ae4b2b8a1d9f7a0599568282.zip
First pass at implementation and testing of reusable builders.
Diffstat (limited to 'src/ProtocolBuffersLite.Test')
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs462
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs298
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs52
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs52
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs54
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs1130
-rw-r--r--src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs2780
7 files changed, 3918 insertions, 910 deletions
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs
index a9ee7772..563cea5e 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs
@@ -241,7 +241,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(PhoneNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -251,21 +251,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new PhoneNumber();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(PhoneNumber cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ PhoneNumber result;
- PhoneNumber result = new PhoneNumber();
+ private PhoneNumber PrepareBuilder() {
+ if (builderIsReadOnly) {
+ PhoneNumber original = result;
+ result = new PhoneNumber();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override PhoneNumber MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new PhoneNumber();
+ result = DefaultInstance ?? new PhoneNumber();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -277,12 +304,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override PhoneNumber BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- PhoneNumber returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -295,11 +321,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetNumber(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasNumber = true;
result.number_ = value;
return this;
}
public Builder ClearNumber() {
+ PrepareBuilder();
result.hasNumber = false;
result.number_ = "";
return this;
@@ -313,11 +341,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetType(value); }
}
public Builder SetType(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType value) {
+ PrepareBuilder();
result.hasType = true;
result.type_ = value;
return this;
}
public Builder ClearType() {
+ PrepareBuilder();
result.hasType = false;
result.type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType.HOME;
return this;
@@ -438,7 +468,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(Addresses prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -448,21 +478,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new Addresses();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(Addresses cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ Addresses result;
+
+ private Addresses PrepareBuilder() {
+ if (builderIsReadOnly) {
+ Addresses original = result;
+ result = new Addresses();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- Addresses result = new Addresses();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override Addresses MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new Addresses();
+ result = DefaultInstance ?? new Addresses();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -474,12 +531,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Addresses BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- Addresses returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -492,11 +548,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetAddress(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasAddress = true;
result.address_ = value;
return this;
}
public Builder ClearAddress() {
+ PrepareBuilder();
result.hasAddress = false;
result.address_ = "";
return this;
@@ -511,11 +569,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetAddress2(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasAddress2 = true;
result.address2_ = value;
return this;
}
public Builder ClearAddress2() {
+ PrepareBuilder();
result.hasAddress2 = false;
result.address2_ = "";
return this;
@@ -530,11 +590,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetCity(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasCity = true;
result.city_ = value;
return this;
}
public Builder ClearCity() {
+ PrepareBuilder();
result.hasCity = false;
result.city_ = "";
return this;
@@ -549,11 +611,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetState(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasState = true;
result.state_ = value;
return this;
}
public Builder ClearState() {
+ PrepareBuilder();
result.hasState = false;
result.state_ = "";
return this;
@@ -569,11 +633,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetZip(uint value) {
+ PrepareBuilder();
result.hasZip = true;
result.zip_ = value;
return this;
}
public Builder ClearZip() {
+ PrepareBuilder();
result.hasZip = false;
result.zip_ = 0;
return this;
@@ -687,7 +753,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestInteropPerson prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -697,21 +763,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestInteropPerson();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestInteropPerson cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestInteropPerson result = new TestInteropPerson();
+ bool builderIsReadOnly;
+ TestInteropPerson result;
+
+ private TestInteropPerson PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestInteropPerson original = result;
+ result = new TestInteropPerson();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestInteropPerson MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestInteropPerson();
+ result = DefaultInstance ?? new TestInteropPerson();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -723,15 +816,14 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestInteropPerson BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.codes_.MakeReadOnly();
result.phone_.MakeReadOnly();
result.addresses_.MakeReadOnly();
- TestInteropPerson returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -744,11 +836,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetName(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasName = true;
result.name_ = value;
return this;
}
public Builder ClearName() {
+ PrepareBuilder();
result.hasName = false;
result.name_ = "";
return this;
@@ -762,11 +856,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetId(value); }
}
public Builder SetId(int value) {
+ PrepareBuilder();
result.hasId = true;
result.id_ = value;
return this;
}
public Builder ClearId() {
+ PrepareBuilder();
result.hasId = false;
result.id_ = 0;
return this;
@@ -781,18 +877,20 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetEmail(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasEmail = true;
result.email_ = value;
return this;
}
public Builder ClearEmail() {
+ PrepareBuilder();
result.hasEmail = false;
result.email_ = "";
return this;
}
public pbc::IPopsicleList<int> CodesList {
- get { return result.codes_; }
+ get { return PrepareBuilder().codes_; }
}
public int CodesCount {
get { return result.CodesCount; }
@@ -801,24 +899,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetCodes(index);
}
public Builder SetCodes(int index, int value) {
+ PrepareBuilder();
result.codes_[index] = value;
return this;
}
public Builder AddCodes(int value) {
+ PrepareBuilder();
result.codes_.Add(value);
return this;
}
public Builder AddRangeCodes(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.codes_);
return this;
}
public Builder ClearCodes() {
+ PrepareBuilder();
result.codes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber> PhoneList {
- get { return result.phone_; }
+ get { return PrepareBuilder().phone_; }
}
public int PhoneCount {
get { return result.PhoneCount; }
@@ -828,35 +930,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.phone_[index] = value;
return this;
}
public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.phone_[index] = builderForValue.Build();
return this;
}
public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.phone_.Add(value);
return this;
}
public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.phone_.Add(builderForValue.Build());
return this;
}
public Builder AddRangePhone(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber> values) {
+ PrepareBuilder();
base.AddRange(values, result.phone_);
return this;
}
public Builder ClearPhone() {
+ PrepareBuilder();
result.phone_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses> AddressesList {
- get { return result.addresses_; }
+ get { return PrepareBuilder().addresses_; }
}
public int AddressesCount {
get { return result.AddressesCount; }
@@ -866,29 +974,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.addresses_[index] = value;
return this;
}
public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.addresses_[index] = builderForValue.Build();
return this;
}
public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.addresses_.Add(value);
return this;
}
public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.addresses_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeAddresses(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses> values) {
+ PrepareBuilder();
base.AddRange(values, result.addresses_);
return this;
}
public Builder ClearAddresses() {
+ PrepareBuilder();
result.addresses_.Clear();
return this;
}
@@ -967,7 +1081,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestInteropEmployeeId prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -977,21 +1091,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestInteropEmployeeId();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestInteropEmployeeId cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestInteropEmployeeId result;
+
+ private TestInteropEmployeeId PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestInteropEmployeeId original = result;
+ result = new TestInteropEmployeeId();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestInteropEmployeeId result = new TestInteropEmployeeId();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestInteropEmployeeId MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestInteropEmployeeId();
+ result = DefaultInstance ?? new TestInteropEmployeeId();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1003,12 +1144,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestInteropEmployeeId BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestInteropEmployeeId returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -1021,11 +1161,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetNumber(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasNumber = true;
result.number_ = value;
return this;
}
public Builder ClearNumber() {
+ PrepareBuilder();
result.hasNumber = false;
result.number_ = "";
return this;
@@ -1147,7 +1289,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(SubA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1157,21 +1299,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new SubA();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(SubA cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ SubA result;
- SubA result = new SubA();
+ private SubA PrepareBuilder() {
+ if (builderIsReadOnly) {
+ SubA original = result;
+ result = new SubA();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override SubA MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new SubA();
+ result = DefaultInstance ?? new SubA();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1183,13 +1352,12 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override SubA BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.values_.MakeReadOnly();
- SubA returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -1201,18 +1369,20 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetCount(value); }
}
public Builder SetCount(int value) {
+ PrepareBuilder();
result.hasCount = true;
result.count_ = value;
return this;
}
public Builder ClearCount() {
+ PrepareBuilder();
result.hasCount = false;
result.count_ = 0;
return this;
}
public pbc::IPopsicleList<string> ValuesList {
- get { return result.values_; }
+ get { return PrepareBuilder().values_; }
}
public int ValuesCount {
get { return result.ValuesCount; }
@@ -1222,19 +1392,23 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetValues(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.values_[index] = value;
return this;
}
public Builder AddValues(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.values_.Add(value);
return this;
}
public Builder AddRangeValues(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.values_);
return this;
}
public Builder ClearValues() {
+ PrepareBuilder();
result.values_.Clear();
return this;
}
@@ -1321,7 +1495,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestMissingFieldsA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1331,21 +1505,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestMissingFieldsA();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestMissingFieldsA cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestMissingFieldsA result;
+
+ private TestMissingFieldsA PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestMissingFieldsA original = result;
+ result = new TestMissingFieldsA();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMissingFieldsA result = new TestMissingFieldsA();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestMissingFieldsA MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestMissingFieldsA();
+ result = DefaultInstance ?? new TestMissingFieldsA();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1357,12 +1558,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestMissingFieldsA BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestMissingFieldsA returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -1375,11 +1575,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetName(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasName = true;
result.name_ = value;
return this;
}
public Builder ClearName() {
+ PrepareBuilder();
result.hasName = false;
result.name_ = "";
return this;
@@ -1393,11 +1595,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetId(value); }
}
public Builder SetId(int value) {
+ PrepareBuilder();
result.hasId = true;
result.id_ = value;
return this;
}
public Builder ClearId() {
+ PrepareBuilder();
result.hasId = false;
result.id_ = 0;
return this;
@@ -1412,11 +1616,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetEmail(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasEmail = true;
result.email_ = value;
return this;
}
public Builder ClearEmail() {
+ PrepareBuilder();
result.hasEmail = false;
result.email_ = "";
return this;
@@ -1431,18 +1637,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasTestA = true;
result.testA_ = value;
return this;
}
public Builder SetTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasTestA = true;
result.testA_ = builderForValue.Build();
return this;
}
public Builder MergeTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasTestA &&
result.testA_ != global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance) {
result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.CreateBuilder(result.testA_).MergeFrom(value).BuildPartial();
@@ -1453,6 +1662,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearTestA() {
+ PrepareBuilder();
result.hasTestA = false;
result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance;
return this;
@@ -1564,7 +1774,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(SubB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1574,21 +1784,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new SubB();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(SubB cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ SubB result;
- SubB result = new SubB();
+ private SubB PrepareBuilder() {
+ if (builderIsReadOnly) {
+ SubB original = result;
+ result = new SubB();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override SubB MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new SubB();
+ result = DefaultInstance ?? new SubB();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1600,18 +1837,17 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override SubB BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.values_.MakeReadOnly();
- SubB returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public pbc::IPopsicleList<string> ValuesList {
- get { return result.values_; }
+ get { return PrepareBuilder().values_; }
}
public int ValuesCount {
get { return result.ValuesCount; }
@@ -1621,19 +1857,23 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetValues(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.values_[index] = value;
return this;
}
public Builder AddValues(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.values_.Add(value);
return this;
}
public Builder AddRangeValues(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.values_);
return this;
}
public Builder ClearValues() {
+ PrepareBuilder();
result.values_.Clear();
return this;
}
@@ -1720,7 +1960,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestMissingFieldsB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1730,21 +1970,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestMissingFieldsB();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestMissingFieldsB cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestMissingFieldsB result;
+
+ private TestMissingFieldsB PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestMissingFieldsB original = result;
+ result = new TestMissingFieldsB();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMissingFieldsB result = new TestMissingFieldsB();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestMissingFieldsB MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestMissingFieldsB();
+ result = DefaultInstance ?? new TestMissingFieldsB();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1756,12 +2023,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestMissingFieldsB BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestMissingFieldsB returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
@@ -1774,11 +2040,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetName(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasName = true;
result.name_ = value;
return this;
}
public Builder ClearName() {
+ PrepareBuilder();
result.hasName = false;
result.name_ = "";
return this;
@@ -1792,11 +2060,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetId(value); }
}
public Builder SetId(int value) {
+ PrepareBuilder();
result.hasId = true;
result.id_ = value;
return this;
}
public Builder ClearId() {
+ PrepareBuilder();
result.hasId = false;
result.id_ = 0;
return this;
@@ -1811,11 +2081,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetWebsite(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasWebsite = true;
result.website_ = value;
return this;
}
public Builder ClearWebsite() {
+ PrepareBuilder();
result.hasWebsite = false;
result.website_ = "";
return this;
@@ -1830,18 +2102,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasTestB = true;
result.testB_ = value;
return this;
}
public Builder SetTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasTestB = true;
result.testB_ = builderForValue.Build();
return this;
}
public Builder MergeTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasTestB &&
result.testB_ != global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance) {
result.testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.CreateBuilder(result.testB_).MergeFrom(value).BuildPartial();
@@ -1852,6 +2127,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearTestB() {
+ PrepareBuilder();
result.hasTestB = false;
result.testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance;
return this;
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
index bc214e25..cbbc50db 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
@@ -187,7 +187,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestRequiredLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -197,21 +197,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestRequiredLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestRequiredLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestRequiredLite result;
+
+ private TestRequiredLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestRequiredLite original = result;
+ result = new TestRequiredLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRequiredLite result = new TestRequiredLite();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestRequiredLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestRequiredLite();
+ result = DefaultInstance ?? new TestRequiredLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestRequiredLite DefaultInstanceForType {
@@ -219,12 +246,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestRequiredLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestRequiredLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -238,6 +264,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestRequiredLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasD) {
D = other.D;
}
@@ -252,6 +279,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -302,11 +330,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetD(value); }
}
public Builder SetD(int value) {
+ PrepareBuilder();
result.hasD = true;
result.d_ = value;
return this;
}
public Builder ClearD() {
+ PrepareBuilder();
result.hasD = false;
result.d_ = 0;
return this;
@@ -320,11 +350,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetEn(value); }
}
public Builder SetEn(global::Google.ProtocolBuffers.TestProtos.ExtraEnum value) {
+ PrepareBuilder();
result.hasEn = true;
result.en_ = value;
return this;
}
public Builder ClearEn() {
+ PrepareBuilder();
result.hasEn = false;
result.en_ = global::Google.ProtocolBuffers.TestProtos.ExtraEnum.DEFAULT;
return this;
@@ -498,7 +530,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(PhoneNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -508,21 +540,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new PhoneNumber();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(PhoneNumber cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- PhoneNumber result = new PhoneNumber();
+ bool builderIsReadOnly;
+ PhoneNumber result;
+
+ private PhoneNumber PrepareBuilder() {
+ if (builderIsReadOnly) {
+ PhoneNumber original = result;
+ result = new PhoneNumber();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override PhoneNumber MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new PhoneNumber();
+ result = DefaultInstance ?? new PhoneNumber();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override PhoneNumber DefaultInstanceForType {
@@ -530,12 +589,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override PhoneNumber BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- PhoneNumber returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -549,6 +607,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(PhoneNumber other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasNumber) {
Number = other.Number;
}
@@ -563,6 +622,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -614,11 +674,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetNumber(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasNumber = true;
result.number_ = value;
return this;
}
public Builder ClearNumber() {
+ PrepareBuilder();
result.hasNumber = false;
result.number_ = "";
return this;
@@ -632,11 +694,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetType(value); }
}
public Builder SetType(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType value) {
+ PrepareBuilder();
result.hasType = true;
result.type_ = value;
return this;
}
public Builder ClearType() {
+ PrepareBuilder();
result.hasType = false;
result.type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType.HOME;
return this;
@@ -839,7 +903,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(Addresses prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -849,21 +913,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new Addresses();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(Addresses cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ Addresses result;
- Addresses result = new Addresses();
+ private Addresses PrepareBuilder() {
+ if (builderIsReadOnly) {
+ Addresses original = result;
+ result = new Addresses();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override Addresses MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new Addresses();
+ result = DefaultInstance ?? new Addresses();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override Addresses DefaultInstanceForType {
@@ -871,12 +962,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Addresses BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- Addresses returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -890,6 +980,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(Addresses other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasAddress) {
Address = other.Address;
}
@@ -913,6 +1004,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -972,11 +1064,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetAddress(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasAddress = true;
result.address_ = value;
return this;
}
public Builder ClearAddress() {
+ PrepareBuilder();
result.hasAddress = false;
result.address_ = "";
return this;
@@ -991,11 +1085,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetAddress2(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasAddress2 = true;
result.address2_ = value;
return this;
}
public Builder ClearAddress2() {
+ PrepareBuilder();
result.hasAddress2 = false;
result.address2_ = "";
return this;
@@ -1010,11 +1106,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetCity(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasCity = true;
result.city_ = value;
return this;
}
public Builder ClearCity() {
+ PrepareBuilder();
result.hasCity = false;
result.city_ = "";
return this;
@@ -1029,11 +1127,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetState(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasState = true;
result.state_ = value;
return this;
}
public Builder ClearState() {
+ PrepareBuilder();
result.hasState = false;
result.state_ = "";
return this;
@@ -1049,11 +1149,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetZip(uint value) {
+ PrepareBuilder();
result.hasZip = true;
result.zip_ = value;
return this;
}
public Builder ClearZip() {
+ PrepareBuilder();
result.hasZip = false;
result.zip_ = 0;
return this;
@@ -1290,7 +1392,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestInteropPersonLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1300,21 +1402,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestInteropPersonLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestInteropPersonLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestInteropPersonLite result = new TestInteropPersonLite();
+ bool builderIsReadOnly;
+ TestInteropPersonLite result;
+
+ private TestInteropPersonLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestInteropPersonLite original = result;
+ result = new TestInteropPersonLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestInteropPersonLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestInteropPersonLite();
+ result = DefaultInstance ?? new TestInteropPersonLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestInteropPersonLite DefaultInstanceForType {
@@ -1322,15 +1451,14 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestInteropPersonLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.codes_.MakeReadOnly();
result.phone_.MakeReadOnly();
result.addresses_.MakeReadOnly();
- TestInteropPersonLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1344,6 +1472,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestInteropPersonLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasName) {
Name = other.Name;
}
@@ -1371,6 +1500,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -1435,11 +1565,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetName(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasName = true;
result.name_ = value;
return this;
}
public Builder ClearName() {
+ PrepareBuilder();
result.hasName = false;
result.name_ = "";
return this;
@@ -1453,11 +1585,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetId(value); }
}
public Builder SetId(int value) {
+ PrepareBuilder();
result.hasId = true;
result.id_ = value;
return this;
}
public Builder ClearId() {
+ PrepareBuilder();
result.hasId = false;
result.id_ = 0;
return this;
@@ -1472,18 +1606,20 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetEmail(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasEmail = true;
result.email_ = value;
return this;
}
public Builder ClearEmail() {
+ PrepareBuilder();
result.hasEmail = false;
result.email_ = "";
return this;
}
public pbc::IPopsicleList<int> CodesList {
- get { return result.codes_; }
+ get { return PrepareBuilder().codes_; }
}
public int CodesCount {
get { return result.CodesCount; }
@@ -1492,24 +1628,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetCodes(index);
}
public Builder SetCodes(int index, int value) {
+ PrepareBuilder();
result.codes_[index] = value;
return this;
}
public Builder AddCodes(int value) {
+ PrepareBuilder();
result.codes_.Add(value);
return this;
}
public Builder AddRangeCodes(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.codes_);
return this;
}
public Builder ClearCodes() {
+ PrepareBuilder();
result.codes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber> PhoneList {
- get { return result.phone_; }
+ get { return PrepareBuilder().phone_; }
}
public int PhoneCount {
get { return result.PhoneCount; }
@@ -1519,35 +1659,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.phone_[index] = value;
return this;
}
public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.phone_[index] = builderForValue.Build();
return this;
}
public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.phone_.Add(value);
return this;
}
public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.phone_.Add(builderForValue.Build());
return this;
}
public Builder AddRangePhone(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber> values) {
+ PrepareBuilder();
base.AddRange(values, result.phone_);
return this;
}
public Builder ClearPhone() {
+ PrepareBuilder();
result.phone_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses> AddressesList {
- get { return result.addresses_; }
+ get { return PrepareBuilder().addresses_; }
}
public int AddressesCount {
get { return result.AddressesCount; }
@@ -1557,29 +1703,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.addresses_[index] = value;
return this;
}
public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.addresses_[index] = builderForValue.Build();
return this;
}
public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.addresses_.Add(value);
return this;
}
public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.addresses_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeAddresses(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses> values) {
+ PrepareBuilder();
base.AddRange(values, result.addresses_);
return this;
}
public Builder ClearAddresses() {
+ PrepareBuilder();
result.addresses_.Clear();
return this;
}
@@ -1701,7 +1853,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestInteropEmployeeIdLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1711,21 +1863,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestInteropEmployeeIdLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestInteropEmployeeIdLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestInteropEmployeeIdLite result = new TestInteropEmployeeIdLite();
+ bool builderIsReadOnly;
+ TestInteropEmployeeIdLite result;
+
+ private TestInteropEmployeeIdLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestInteropEmployeeIdLite original = result;
+ result = new TestInteropEmployeeIdLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestInteropEmployeeIdLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestInteropEmployeeIdLite();
+ result = DefaultInstance ?? new TestInteropEmployeeIdLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestInteropEmployeeIdLite DefaultInstanceForType {
@@ -1733,12 +1912,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestInteropEmployeeIdLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestInteropEmployeeIdLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1752,6 +1930,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestInteropEmployeeIdLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeIdLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasNumber) {
Number = other.Number;
}
@@ -1763,6 +1942,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -1806,11 +1986,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetNumber(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasNumber = true;
result.number_ = value;
return this;
}
public Builder ClearNumber() {
+ PrepareBuilder();
result.hasNumber = false;
result.number_ = "";
return this;
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
index a96833be..0df40f42 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs
@@ -150,7 +150,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ImportMessageLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -160,21 +160,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new ImportMessageLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(ImportMessageLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ ImportMessageLite result;
- ImportMessageLite result = new ImportMessageLite();
+ private ImportMessageLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ ImportMessageLite original = result;
+ result = new ImportMessageLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override ImportMessageLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new ImportMessageLite();
+ result = DefaultInstance ?? new ImportMessageLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override ImportMessageLite DefaultInstanceForType {
@@ -182,12 +209,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override ImportMessageLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- ImportMessageLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -201,6 +227,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ImportMessageLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasD) {
D = other.D;
}
@@ -212,6 +239,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -254,11 +282,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetD(value); }
}
public Builder SetD(int value) {
+ PrepareBuilder();
result.hasD = true;
result.d_ = value;
return this;
}
public Builder ClearD() {
+ PrepareBuilder();
result.hasD = false;
result.d_ = 0;
return this;
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
index 5749c97f..75e746a8 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs
@@ -169,7 +169,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ImportMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -179,21 +179,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new ImportMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(ImportMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ ImportMessage result;
- ImportMessage result = new ImportMessage();
+ private ImportMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ ImportMessage original = result;
+ result = new ImportMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override ImportMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new ImportMessage();
+ result = DefaultInstance ?? new ImportMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -205,12 +232,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override ImportMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- ImportMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -224,6 +250,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ImportMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasD) {
D = other.D;
}
@@ -236,6 +263,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -291,11 +319,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetD(value); }
}
public Builder SetD(int value) {
+ PrepareBuilder();
result.hasD = true;
result.d_ = value;
return this;
}
public Builder ClearD() {
+ PrepareBuilder();
result.hasD = false;
result.d_ = 0;
return this;
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs
index 7c2836cd..5a6033a1 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs
@@ -139,7 +139,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestLiteImportsNonlite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -149,21 +149,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestLiteImportsNonlite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestLiteImportsNonlite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestLiteImportsNonlite result;
- TestLiteImportsNonlite result = new TestLiteImportsNonlite();
+ private TestLiteImportsNonlite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestLiteImportsNonlite original = result;
+ result = new TestLiteImportsNonlite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestLiteImportsNonlite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestLiteImportsNonlite();
+ result = DefaultInstance ?? new TestLiteImportsNonlite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestLiteImportsNonlite DefaultInstanceForType {
@@ -171,12 +198,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestLiteImportsNonlite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestLiteImportsNonlite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -190,6 +216,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestLiteImportsNonlite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestLiteImportsNonlite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasMessage) {
MergeMessage(other.Message);
}
@@ -201,6 +228,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -249,18 +277,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasMessage = true;
result.message_ = value;
return this;
}
public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasMessage = true;
result.message_ = builderForValue.Build();
return this;
}
public Builder MergeMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasMessage &&
result.message_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) {
result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.CreateBuilder(result.message_).MergeFrom(value).BuildPartial();
@@ -271,6 +302,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearMessage() {
+ PrepareBuilder();
result.hasMessage = false;
result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance;
return this;
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
index 78bed7e2..2592c833 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs
@@ -1367,7 +1367,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1377,21 +1377,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new NestedMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- NestedMessage result = new NestedMessage();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override NestedMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new NestedMessage();
+ result = DefaultInstance ?? new NestedMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override NestedMessage DefaultInstanceForType {
@@ -1399,12 +1426,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override NestedMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1418,6 +1444,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(NestedMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasBb) {
Bb = other.Bb;
}
@@ -1429,6 +1456,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -1471,11 +1499,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetBb(value); }
}
public Builder SetBb(int value) {
+ PrepareBuilder();
result.hasBb = true;
result.bb_ = value;
return this;
}
public Builder ClearBb() {
+ PrepareBuilder();
result.hasBb = false;
result.bb_ = 0;
return this;
@@ -1597,7 +1627,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OptionalGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1607,21 +1637,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new OptionalGroup();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(OptionalGroup cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ OptionalGroup result;
+
+ private OptionalGroup PrepareBuilder() {
+ if (builderIsReadOnly) {
+ OptionalGroup original = result;
+ result = new OptionalGroup();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- OptionalGroup result = new OptionalGroup();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override OptionalGroup MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new OptionalGroup();
+ result = DefaultInstance ?? new OptionalGroup();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override OptionalGroup DefaultInstanceForType {
@@ -1629,12 +1686,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OptionalGroup BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- OptionalGroup returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1648,6 +1704,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OptionalGroup other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -1659,6 +1716,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -1701,11 +1759,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -1827,7 +1887,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(RepeatedGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1837,21 +1897,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new RepeatedGroup();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(RepeatedGroup cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ RepeatedGroup result;
+
+ private RepeatedGroup PrepareBuilder() {
+ if (builderIsReadOnly) {
+ RepeatedGroup original = result;
+ result = new RepeatedGroup();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- RepeatedGroup result = new RepeatedGroup();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override RepeatedGroup MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new RepeatedGroup();
+ result = DefaultInstance ?? new RepeatedGroup();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override RepeatedGroup DefaultInstanceForType {
@@ -1859,12 +1946,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override RepeatedGroup BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- RepeatedGroup returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -1878,6 +1964,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(RepeatedGroup other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -1889,6 +1976,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -1931,11 +2019,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -3542,7 +3632,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestAllTypesLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3552,21 +3642,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestAllTypesLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestAllTypesLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestAllTypesLite result = new TestAllTypesLite();
+ bool builderIsReadOnly;
+ TestAllTypesLite result;
+
+ private TestAllTypesLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestAllTypesLite original = result;
+ result = new TestAllTypesLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestAllTypesLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestAllTypesLite();
+ result = DefaultInstance ?? new TestAllTypesLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestAllTypesLite DefaultInstanceForType {
@@ -3574,8 +3691,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestAllTypesLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.repeatedInt32_.MakeReadOnly();
result.repeatedInt64_.MakeReadOnly();
@@ -3601,9 +3718,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.repeatedImportEnum_.MakeReadOnly();
result.repeatedStringPiece_.MakeReadOnly();
result.repeatedCord_.MakeReadOnly();
- TestAllTypesLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -3617,6 +3733,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestAllTypesLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasOptionalInt32) {
OptionalInt32 = other.OptionalInt32;
}
@@ -3829,6 +3946,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -4202,11 +4320,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalInt32(value); }
}
public Builder SetOptionalInt32(int value) {
+ PrepareBuilder();
result.hasOptionalInt32 = true;
result.optionalInt32_ = value;
return this;
}
public Builder ClearOptionalInt32() {
+ PrepareBuilder();
result.hasOptionalInt32 = false;
result.optionalInt32_ = 0;
return this;
@@ -4220,11 +4340,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalInt64(value); }
}
public Builder SetOptionalInt64(long value) {
+ PrepareBuilder();
result.hasOptionalInt64 = true;
result.optionalInt64_ = value;
return this;
}
public Builder ClearOptionalInt64() {
+ PrepareBuilder();
result.hasOptionalInt64 = false;
result.optionalInt64_ = 0L;
return this;
@@ -4240,11 +4362,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalUint32(uint value) {
+ PrepareBuilder();
result.hasOptionalUint32 = true;
result.optionalUint32_ = value;
return this;
}
public Builder ClearOptionalUint32() {
+ PrepareBuilder();
result.hasOptionalUint32 = false;
result.optionalUint32_ = 0;
return this;
@@ -4260,11 +4384,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalUint64(ulong value) {
+ PrepareBuilder();
result.hasOptionalUint64 = true;
result.optionalUint64_ = value;
return this;
}
public Builder ClearOptionalUint64() {
+ PrepareBuilder();
result.hasOptionalUint64 = false;
result.optionalUint64_ = 0UL;
return this;
@@ -4278,11 +4404,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSint32(value); }
}
public Builder SetOptionalSint32(int value) {
+ PrepareBuilder();
result.hasOptionalSint32 = true;
result.optionalSint32_ = value;
return this;
}
public Builder ClearOptionalSint32() {
+ PrepareBuilder();
result.hasOptionalSint32 = false;
result.optionalSint32_ = 0;
return this;
@@ -4296,11 +4424,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSint64(value); }
}
public Builder SetOptionalSint64(long value) {
+ PrepareBuilder();
result.hasOptionalSint64 = true;
result.optionalSint64_ = value;
return this;
}
public Builder ClearOptionalSint64() {
+ PrepareBuilder();
result.hasOptionalSint64 = false;
result.optionalSint64_ = 0;
return this;
@@ -4316,11 +4446,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalFixed32(uint value) {
+ PrepareBuilder();
result.hasOptionalFixed32 = true;
result.optionalFixed32_ = value;
return this;
}
public Builder ClearOptionalFixed32() {
+ PrepareBuilder();
result.hasOptionalFixed32 = false;
result.optionalFixed32_ = 0;
return this;
@@ -4336,11 +4468,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalFixed64(ulong value) {
+ PrepareBuilder();
result.hasOptionalFixed64 = true;
result.optionalFixed64_ = value;
return this;
}
public Builder ClearOptionalFixed64() {
+ PrepareBuilder();
result.hasOptionalFixed64 = false;
result.optionalFixed64_ = 0;
return this;
@@ -4354,11 +4488,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSfixed32(value); }
}
public Builder SetOptionalSfixed32(int value) {
+ PrepareBuilder();
result.hasOptionalSfixed32 = true;
result.optionalSfixed32_ = value;
return this;
}
public Builder ClearOptionalSfixed32() {
+ PrepareBuilder();
result.hasOptionalSfixed32 = false;
result.optionalSfixed32_ = 0;
return this;
@@ -4372,11 +4508,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSfixed64(value); }
}
public Builder SetOptionalSfixed64(long value) {
+ PrepareBuilder();
result.hasOptionalSfixed64 = true;
result.optionalSfixed64_ = value;
return this;
}
public Builder ClearOptionalSfixed64() {
+ PrepareBuilder();
result.hasOptionalSfixed64 = false;
result.optionalSfixed64_ = 0;
return this;
@@ -4390,11 +4528,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalFloat(value); }
}
public Builder SetOptionalFloat(float value) {
+ PrepareBuilder();
result.hasOptionalFloat = true;
result.optionalFloat_ = value;
return this;
}
public Builder ClearOptionalFloat() {
+ PrepareBuilder();
result.hasOptionalFloat = false;
result.optionalFloat_ = 0F;
return this;
@@ -4408,11 +4548,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalDouble(value); }
}
public Builder SetOptionalDouble(double value) {
+ PrepareBuilder();
result.hasOptionalDouble = true;
result.optionalDouble_ = value;
return this;
}
public Builder ClearOptionalDouble() {
+ PrepareBuilder();
result.hasOptionalDouble = false;
result.optionalDouble_ = 0D;
return this;
@@ -4426,11 +4568,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalBool(value); }
}
public Builder SetOptionalBool(bool value) {
+ PrepareBuilder();
result.hasOptionalBool = true;
result.optionalBool_ = value;
return this;
}
public Builder ClearOptionalBool() {
+ PrepareBuilder();
result.hasOptionalBool = false;
result.optionalBool_ = false;
return this;
@@ -4445,11 +4589,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalString = true;
result.optionalString_ = value;
return this;
}
public Builder ClearOptionalString() {
+ PrepareBuilder();
result.hasOptionalString = false;
result.optionalString_ = "";
return this;
@@ -4464,11 +4610,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalBytes = true;
result.optionalBytes_ = value;
return this;
}
public Builder ClearOptionalBytes() {
+ PrepareBuilder();
result.hasOptionalBytes = false;
result.optionalBytes_ = pb::ByteString.Empty;
return this;
@@ -4483,18 +4631,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalGroup = true;
result.optionalGroup_ = value;
return this;
}
public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalGroup = true;
result.optionalGroup_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalGroup &&
result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance) {
result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial();
@@ -4505,6 +4656,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalGroup() {
+ PrepareBuilder();
result.hasOptionalGroup = false;
result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance;
return this;
@@ -4519,18 +4671,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalNestedMessage = true;
result.optionalNestedMessage_ = value;
return this;
}
public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalNestedMessage = true;
result.optionalNestedMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalNestedMessage &&
result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance) {
result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial();
@@ -4541,6 +4696,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance;
return this;
@@ -4555,18 +4711,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalForeignMessage = true;
result.optionalForeignMessage_ = value;
return this;
}
public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalForeignMessage = true;
result.optionalForeignMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalForeignMessage &&
result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance) {
result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial();
@@ -4577,6 +4736,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalForeignMessage() {
+ PrepareBuilder();
result.hasOptionalForeignMessage = false;
result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance;
return this;
@@ -4591,18 +4751,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalImportMessage = true;
result.optionalImportMessage_ = value;
return this;
}
public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalImportMessage = true;
result.optionalImportMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalImportMessage &&
result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) {
result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial();
@@ -4613,6 +4776,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalImportMessage() {
+ PrepareBuilder();
result.hasOptionalImportMessage = false;
result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance;
return this;
@@ -4626,11 +4790,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalNestedEnum(value); }
}
public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) {
+ PrepareBuilder();
result.hasOptionalNestedEnum = true;
result.optionalNestedEnum_ = value;
return this;
}
public Builder ClearOptionalNestedEnum() {
+ PrepareBuilder();
result.hasOptionalNestedEnum = false;
result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.FOO;
return this;
@@ -4644,11 +4810,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalForeignEnum(value); }
}
public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.hasOptionalForeignEnum = true;
result.optionalForeignEnum_ = value;
return this;
}
public Builder ClearOptionalForeignEnum() {
+ PrepareBuilder();
result.hasOptionalForeignEnum = false;
result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_FOO;
return this;
@@ -4662,11 +4830,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalImportEnum(value); }
}
public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) {
+ PrepareBuilder();
result.hasOptionalImportEnum = true;
result.optionalImportEnum_ = value;
return this;
}
public Builder ClearOptionalImportEnum() {
+ PrepareBuilder();
result.hasOptionalImportEnum = false;
result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_FOO;
return this;
@@ -4681,11 +4851,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalStringPiece(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalStringPiece = true;
result.optionalStringPiece_ = value;
return this;
}
public Builder ClearOptionalStringPiece() {
+ PrepareBuilder();
result.hasOptionalStringPiece = false;
result.optionalStringPiece_ = "";
return this;
@@ -4700,18 +4872,20 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalCord(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalCord = true;
result.optionalCord_ = value;
return this;
}
public Builder ClearOptionalCord() {
+ PrepareBuilder();
result.hasOptionalCord = false;
result.optionalCord_ = "";
return this;
}
public pbc::IPopsicleList<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -4720,24 +4894,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedInt32(index);
}
public Builder SetRepeatedInt32(int index, int value) {
+ PrepareBuilder();
result.repeatedInt32_[index] = value;
return this;
}
public Builder AddRepeatedInt32(int value) {
+ PrepareBuilder();
result.repeatedInt32_.Add(value);
return this;
}
public Builder AddRangeRepeatedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedInt32_);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -4746,25 +4924,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedInt64(index);
}
public Builder SetRepeatedInt64(int index, long value) {
+ PrepareBuilder();
result.repeatedInt64_[index] = value;
return this;
}
public Builder AddRepeatedInt64(long value) {
+ PrepareBuilder();
result.repeatedInt64_.Add(value);
return this;
}
public Builder AddRangeRepeatedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedInt64_);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedUint32List {
- get { return result.repeatedUint32_; }
+ get { return PrepareBuilder().repeatedUint32_; }
}
public int RepeatedUint32Count {
get { return result.RepeatedUint32Count; }
@@ -4775,27 +4957,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedUint32(int index, uint value) {
+ PrepareBuilder();
result.repeatedUint32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedUint32(uint value) {
+ PrepareBuilder();
result.repeatedUint32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedUint32_);
return this;
}
public Builder ClearRepeatedUint32() {
+ PrepareBuilder();
result.repeatedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -4806,26 +4992,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedUint64(int index, ulong value) {
+ PrepareBuilder();
result.repeatedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedUint64(ulong value) {
+ PrepareBuilder();
result.repeatedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedUint64_);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSint32List {
- get { return result.repeatedSint32_; }
+ get { return PrepareBuilder().repeatedSint32_; }
}
public int RepeatedSint32Count {
get { return result.RepeatedSint32Count; }
@@ -4834,24 +5024,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSint32(index);
}
public Builder SetRepeatedSint32(int index, int value) {
+ PrepareBuilder();
result.repeatedSint32_[index] = value;
return this;
}
public Builder AddRepeatedSint32(int value) {
+ PrepareBuilder();
result.repeatedSint32_.Add(value);
return this;
}
public Builder AddRangeRepeatedSint32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSint32_);
return this;
}
public Builder ClearRepeatedSint32() {
+ PrepareBuilder();
result.repeatedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSint64List {
- get { return result.repeatedSint64_; }
+ get { return PrepareBuilder().repeatedSint64_; }
}
public int RepeatedSint64Count {
get { return result.RepeatedSint64Count; }
@@ -4860,25 +5054,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSint64(index);
}
public Builder SetRepeatedSint64(int index, long value) {
+ PrepareBuilder();
result.repeatedSint64_[index] = value;
return this;
}
public Builder AddRepeatedSint64(long value) {
+ PrepareBuilder();
result.repeatedSint64_.Add(value);
return this;
}
public Builder AddRangeRepeatedSint64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSint64_);
return this;
}
public Builder ClearRepeatedSint64() {
+ PrepareBuilder();
result.repeatedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -4889,27 +5087,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed32(int index, uint value) {
+ PrepareBuilder();
result.repeatedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed32(uint value) {
+ PrepareBuilder();
result.repeatedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFixed32_);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -4920,26 +5122,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.repeatedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed64(ulong value) {
+ PrepareBuilder();
result.repeatedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFixed64_);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSfixed32List {
- get { return result.repeatedSfixed32_; }
+ get { return PrepareBuilder().repeatedSfixed32_; }
}
public int RepeatedSfixed32Count {
get { return result.RepeatedSfixed32Count; }
@@ -4948,24 +5154,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSfixed32(index);
}
public Builder SetRepeatedSfixed32(int index, int value) {
+ PrepareBuilder();
result.repeatedSfixed32_[index] = value;
return this;
}
public Builder AddRepeatedSfixed32(int value) {
+ PrepareBuilder();
result.repeatedSfixed32_.Add(value);
return this;
}
public Builder AddRangeRepeatedSfixed32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSfixed32_);
return this;
}
public Builder ClearRepeatedSfixed32() {
+ PrepareBuilder();
result.repeatedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSfixed64List {
- get { return result.repeatedSfixed64_; }
+ get { return PrepareBuilder().repeatedSfixed64_; }
}
public int RepeatedSfixed64Count {
get { return result.RepeatedSfixed64Count; }
@@ -4974,24 +5184,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSfixed64(index);
}
public Builder SetRepeatedSfixed64(int index, long value) {
+ PrepareBuilder();
result.repeatedSfixed64_[index] = value;
return this;
}
public Builder AddRepeatedSfixed64(long value) {
+ PrepareBuilder();
result.repeatedSfixed64_.Add(value);
return this;
}
public Builder AddRangeRepeatedSfixed64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSfixed64_);
return this;
}
public Builder ClearRepeatedSfixed64() {
+ PrepareBuilder();
result.repeatedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -5000,24 +5214,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedFloat(index);
}
public Builder SetRepeatedFloat(int index, float value) {
+ PrepareBuilder();
result.repeatedFloat_[index] = value;
return this;
}
public Builder AddRepeatedFloat(float value) {
+ PrepareBuilder();
result.repeatedFloat_.Add(value);
return this;
}
public Builder AddRangeRepeatedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFloat_);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> RepeatedDoubleList {
- get { return result.repeatedDouble_; }
+ get { return PrepareBuilder().repeatedDouble_; }
}
public int RepeatedDoubleCount {
get { return result.RepeatedDoubleCount; }
@@ -5026,24 +5244,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedDouble(index);
}
public Builder SetRepeatedDouble(int index, double value) {
+ PrepareBuilder();
result.repeatedDouble_[index] = value;
return this;
}
public Builder AddRepeatedDouble(double value) {
+ PrepareBuilder();
result.repeatedDouble_.Add(value);
return this;
}
public Builder AddRangeRepeatedDouble(scg::IEnumerable<double> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedDouble_);
return this;
}
public Builder ClearRepeatedDouble() {
+ PrepareBuilder();
result.repeatedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> RepeatedBoolList {
- get { return result.repeatedBool_; }
+ get { return PrepareBuilder().repeatedBool_; }
}
public int RepeatedBoolCount {
get { return result.RepeatedBoolCount; }
@@ -5052,24 +5274,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedBool(index);
}
public Builder SetRepeatedBool(int index, bool value) {
+ PrepareBuilder();
result.repeatedBool_[index] = value;
return this;
}
public Builder AddRepeatedBool(bool value) {
+ PrepareBuilder();
result.repeatedBool_.Add(value);
return this;
}
public Builder AddRangeRepeatedBool(scg::IEnumerable<bool> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedBool_);
return this;
}
public Builder ClearRepeatedBool() {
+ PrepareBuilder();
result.repeatedBool_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringList {
- get { return result.repeatedString_; }
+ get { return PrepareBuilder().repeatedString_; }
}
public int RepeatedStringCount {
get { return result.RepeatedStringCount; }
@@ -5079,25 +5305,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedString(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedString_[index] = value;
return this;
}
public Builder AddRepeatedString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedString_.Add(value);
return this;
}
public Builder AddRangeRepeatedString(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedString_);
return this;
}
public Builder ClearRepeatedString() {
+ PrepareBuilder();
result.repeatedString_.Clear();
return this;
}
public pbc::IPopsicleList<pb::ByteString> RepeatedBytesList {
- get { return result.repeatedBytes_; }
+ get { return PrepareBuilder().repeatedBytes_; }
}
public int RepeatedBytesCount {
get { return result.RepeatedBytesCount; }
@@ -5107,25 +5337,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedBytes(int index, pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedBytes_[index] = value;
return this;
}
public Builder AddRepeatedBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedBytes_.Add(value);
return this;
}
public Builder AddRangeRepeatedBytes(scg::IEnumerable<pb::ByteString> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedBytes_);
return this;
}
public Builder ClearRepeatedBytes() {
+ PrepareBuilder();
result.repeatedBytes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup> RepeatedGroupList {
- get { return result.repeatedGroup_; }
+ get { return PrepareBuilder().repeatedGroup_; }
}
public int RepeatedGroupCount {
get { return result.RepeatedGroupCount; }
@@ -5135,35 +5369,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedGroup_[index] = value;
return this;
}
public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedGroup_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedGroup_.Add(value);
return this;
}
public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedGroup_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedGroup(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedGroup_);
return this;
}
public Builder ClearRepeatedGroup() {
+ PrepareBuilder();
result.repeatedGroup_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage> RepeatedNestedMessageList {
- get { return result.repeatedNestedMessage_; }
+ get { return PrepareBuilder().repeatedNestedMessage_; }
}
public int RepeatedNestedMessageCount {
get { return result.RepeatedNestedMessageCount; }
@@ -5173,35 +5413,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedNestedMessage_[index] = value;
return this;
}
public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedNestedMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedNestedMessage_.Add(value);
return this;
}
public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedNestedMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedNestedMessage_);
return this;
}
public Builder ClearRepeatedNestedMessage() {
+ PrepareBuilder();
result.repeatedNestedMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite> RepeatedForeignMessageList {
- get { return result.repeatedForeignMessage_; }
+ get { return PrepareBuilder().repeatedForeignMessage_; }
}
public int RepeatedForeignMessageCount {
get { return result.RepeatedForeignMessageCount; }
@@ -5211,35 +5457,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedForeignMessage_[index] = value;
return this;
}
public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedForeignMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedForeignMessage_.Add(value);
return this;
}
public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedForeignMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedForeignMessage_);
return this;
}
public Builder ClearRepeatedForeignMessage() {
+ PrepareBuilder();
result.repeatedForeignMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportMessageLite> RepeatedImportMessageList {
- get { return result.repeatedImportMessage_; }
+ get { return PrepareBuilder().repeatedImportMessage_; }
}
public int RepeatedImportMessageCount {
get { return result.RepeatedImportMessageCount; }
@@ -5249,35 +5501,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedImportMessage_[index] = value;
return this;
}
public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedImportMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedImportMessage_.Add(value);
return this;
}
public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedImportMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedImportMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ImportMessageLite> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedImportMessage_);
return this;
}
public Builder ClearRepeatedImportMessage() {
+ PrepareBuilder();
result.repeatedImportMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum> RepeatedNestedEnumList {
- get { return result.repeatedNestedEnum_; }
+ get { return PrepareBuilder().repeatedNestedEnum_; }
}
public int RepeatedNestedEnumCount {
get { return result.RepeatedNestedEnumCount; }
@@ -5286,24 +5544,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedNestedEnum(index);
}
public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) {
+ PrepareBuilder();
result.repeatedNestedEnum_[index] = value;
return this;
}
public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) {
+ PrepareBuilder();
result.repeatedNestedEnum_.Add(value);
return this;
}
public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedNestedEnum_);
return this;
}
public Builder ClearRepeatedNestedEnum() {
+ PrepareBuilder();
result.repeatedNestedEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> RepeatedForeignEnumList {
- get { return result.repeatedForeignEnum_; }
+ get { return PrepareBuilder().repeatedForeignEnum_; }
}
public int RepeatedForeignEnumCount {
get { return result.RepeatedForeignEnumCount; }
@@ -5312,24 +5574,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedForeignEnum(index);
}
public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.repeatedForeignEnum_[index] = value;
return this;
}
public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.repeatedForeignEnum_.Add(value);
return this;
}
public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedForeignEnum_);
return this;
}
public Builder ClearRepeatedForeignEnum() {
+ PrepareBuilder();
result.repeatedForeignEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite> RepeatedImportEnumList {
- get { return result.repeatedImportEnum_; }
+ get { return PrepareBuilder().repeatedImportEnum_; }
}
public int RepeatedImportEnumCount {
get { return result.RepeatedImportEnumCount; }
@@ -5338,24 +5604,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedImportEnum(index);
}
public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) {
+ PrepareBuilder();
result.repeatedImportEnum_[index] = value;
return this;
}
public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) {
+ PrepareBuilder();
result.repeatedImportEnum_.Add(value);
return this;
}
public Builder AddRangeRepeatedImportEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ImportEnumLite> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedImportEnum_);
return this;
}
public Builder ClearRepeatedImportEnum() {
+ PrepareBuilder();
result.repeatedImportEnum_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceList {
- get { return result.repeatedStringPiece_; }
+ get { return PrepareBuilder().repeatedStringPiece_; }
}
public int RepeatedStringPieceCount {
get { return result.RepeatedStringPieceCount; }
@@ -5365,25 +5635,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedStringPiece(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringPiece_[index] = value;
return this;
}
public Builder AddRepeatedStringPiece(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringPiece_.Add(value);
return this;
}
public Builder AddRangeRepeatedStringPiece(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedStringPiece_);
return this;
}
public Builder ClearRepeatedStringPiece() {
+ PrepareBuilder();
result.repeatedStringPiece_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordList {
- get { return result.repeatedCord_; }
+ get { return PrepareBuilder().repeatedCord_; }
}
public int RepeatedCordCount {
get { return result.RepeatedCordCount; }
@@ -5393,19 +5667,23 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedCord(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedCord_[index] = value;
return this;
}
public Builder AddRepeatedCord(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedCord_.Add(value);
return this;
}
public Builder AddRangeRepeatedCord(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedCord_);
return this;
}
public Builder ClearRepeatedCord() {
+ PrepareBuilder();
result.repeatedCord_.Clear();
return this;
}
@@ -5418,11 +5696,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultInt32(value); }
}
public Builder SetDefaultInt32(int value) {
+ PrepareBuilder();
result.hasDefaultInt32 = true;
result.defaultInt32_ = value;
return this;
}
public Builder ClearDefaultInt32() {
+ PrepareBuilder();
result.hasDefaultInt32 = false;
result.defaultInt32_ = 41;
return this;
@@ -5436,11 +5716,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultInt64(value); }
}
public Builder SetDefaultInt64(long value) {
+ PrepareBuilder();
result.hasDefaultInt64 = true;
result.defaultInt64_ = value;
return this;
}
public Builder ClearDefaultInt64() {
+ PrepareBuilder();
result.hasDefaultInt64 = false;
result.defaultInt64_ = 42L;
return this;
@@ -5456,11 +5738,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultUint32(uint value) {
+ PrepareBuilder();
result.hasDefaultUint32 = true;
result.defaultUint32_ = value;
return this;
}
public Builder ClearDefaultUint32() {
+ PrepareBuilder();
result.hasDefaultUint32 = false;
result.defaultUint32_ = 43;
return this;
@@ -5476,11 +5760,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultUint64(ulong value) {
+ PrepareBuilder();
result.hasDefaultUint64 = true;
result.defaultUint64_ = value;
return this;
}
public Builder ClearDefaultUint64() {
+ PrepareBuilder();
result.hasDefaultUint64 = false;
result.defaultUint64_ = 44UL;
return this;
@@ -5494,11 +5780,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSint32(value); }
}
public Builder SetDefaultSint32(int value) {
+ PrepareBuilder();
result.hasDefaultSint32 = true;
result.defaultSint32_ = value;
return this;
}
public Builder ClearDefaultSint32() {
+ PrepareBuilder();
result.hasDefaultSint32 = false;
result.defaultSint32_ = -45;
return this;
@@ -5512,11 +5800,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSint64(value); }
}
public Builder SetDefaultSint64(long value) {
+ PrepareBuilder();
result.hasDefaultSint64 = true;
result.defaultSint64_ = value;
return this;
}
public Builder ClearDefaultSint64() {
+ PrepareBuilder();
result.hasDefaultSint64 = false;
result.defaultSint64_ = 46;
return this;
@@ -5532,11 +5822,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultFixed32(uint value) {
+ PrepareBuilder();
result.hasDefaultFixed32 = true;
result.defaultFixed32_ = value;
return this;
}
public Builder ClearDefaultFixed32() {
+ PrepareBuilder();
result.hasDefaultFixed32 = false;
result.defaultFixed32_ = 47;
return this;
@@ -5552,11 +5844,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultFixed64(ulong value) {
+ PrepareBuilder();
result.hasDefaultFixed64 = true;
result.defaultFixed64_ = value;
return this;
}
public Builder ClearDefaultFixed64() {
+ PrepareBuilder();
result.hasDefaultFixed64 = false;
result.defaultFixed64_ = 48;
return this;
@@ -5570,11 +5864,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSfixed32(value); }
}
public Builder SetDefaultSfixed32(int value) {
+ PrepareBuilder();
result.hasDefaultSfixed32 = true;
result.defaultSfixed32_ = value;
return this;
}
public Builder ClearDefaultSfixed32() {
+ PrepareBuilder();
result.hasDefaultSfixed32 = false;
result.defaultSfixed32_ = 49;
return this;
@@ -5588,11 +5884,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSfixed64(value); }
}
public Builder SetDefaultSfixed64(long value) {
+ PrepareBuilder();
result.hasDefaultSfixed64 = true;
result.defaultSfixed64_ = value;
return this;
}
public Builder ClearDefaultSfixed64() {
+ PrepareBuilder();
result.hasDefaultSfixed64 = false;
result.defaultSfixed64_ = -50;
return this;
@@ -5606,11 +5904,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultFloat(value); }
}
public Builder SetDefaultFloat(float value) {
+ PrepareBuilder();
result.hasDefaultFloat = true;
result.defaultFloat_ = value;
return this;
}
public Builder ClearDefaultFloat() {
+ PrepareBuilder();
result.hasDefaultFloat = false;
result.defaultFloat_ = 51.5F;
return this;
@@ -5624,11 +5924,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultDouble(value); }
}
public Builder SetDefaultDouble(double value) {
+ PrepareBuilder();
result.hasDefaultDouble = true;
result.defaultDouble_ = value;
return this;
}
public Builder ClearDefaultDouble() {
+ PrepareBuilder();
result.hasDefaultDouble = false;
result.defaultDouble_ = 52000D;
return this;
@@ -5642,11 +5944,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultBool(value); }
}
public Builder SetDefaultBool(bool value) {
+ PrepareBuilder();
result.hasDefaultBool = true;
result.defaultBool_ = value;
return this;
}
public Builder ClearDefaultBool() {
+ PrepareBuilder();
result.hasDefaultBool = false;
result.defaultBool_ = true;
return this;
@@ -5661,11 +5965,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultString = true;
result.defaultString_ = value;
return this;
}
public Builder ClearDefaultString() {
+ PrepareBuilder();
result.hasDefaultString = false;
result.defaultString_ = "hello";
return this;
@@ -5680,11 +5986,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultBytes = true;
result.defaultBytes_ = value;
return this;
}
public Builder ClearDefaultBytes() {
+ PrepareBuilder();
result.hasDefaultBytes = false;
result.defaultBytes_ = pb::ByteString.FromBase64("d29ybGQ=");
return this;
@@ -5698,11 +6006,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultNestedEnum(value); }
}
public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) {
+ PrepareBuilder();
result.hasDefaultNestedEnum = true;
result.defaultNestedEnum_ = value;
return this;
}
public Builder ClearDefaultNestedEnum() {
+ PrepareBuilder();
result.hasDefaultNestedEnum = false;
result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.BAR;
return this;
@@ -5716,11 +6026,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultForeignEnum(value); }
}
public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.hasDefaultForeignEnum = true;
result.defaultForeignEnum_ = value;
return this;
}
public Builder ClearDefaultForeignEnum() {
+ PrepareBuilder();
result.hasDefaultForeignEnum = false;
result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_BAR;
return this;
@@ -5734,11 +6046,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultImportEnum(value); }
}
public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) {
+ PrepareBuilder();
result.hasDefaultImportEnum = true;
result.defaultImportEnum_ = value;
return this;
}
public Builder ClearDefaultImportEnum() {
+ PrepareBuilder();
result.hasDefaultImportEnum = false;
result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_BAR;
return this;
@@ -5753,11 +6067,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultStringPiece(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultStringPiece = true;
result.defaultStringPiece_ = value;
return this;
}
public Builder ClearDefaultStringPiece() {
+ PrepareBuilder();
result.hasDefaultStringPiece = false;
result.defaultStringPiece_ = "abc";
return this;
@@ -5772,11 +6088,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultCord(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultCord = true;
result.defaultCord_ = value;
return this;
}
public Builder ClearDefaultCord() {
+ PrepareBuilder();
result.hasDefaultCord = false;
result.defaultCord_ = "123";
return this;
@@ -5898,7 +6216,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ForeignMessageLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5908,21 +6226,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new ForeignMessageLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(ForeignMessageLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ ForeignMessageLite result;
+
+ private ForeignMessageLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ ForeignMessageLite original = result;
+ result = new ForeignMessageLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- ForeignMessageLite result = new ForeignMessageLite();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override ForeignMessageLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new ForeignMessageLite();
+ result = DefaultInstance ?? new ForeignMessageLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override ForeignMessageLite DefaultInstanceForType {
@@ -5930,12 +6275,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override ForeignMessageLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- ForeignMessageLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -5949,6 +6293,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ForeignMessageLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasC) {
C = other.C;
}
@@ -5960,6 +6305,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -6002,11 +6348,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetC(value); }
}
public Builder SetC(int value) {
+ PrepareBuilder();
result.hasC = true;
result.c_ = value;
return this;
}
public Builder ClearC() {
+ PrepareBuilder();
result.hasC = false;
result.c_ = 0;
return this;
@@ -6566,7 +6914,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestPackedTypesLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6576,21 +6924,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestPackedTypesLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestPackedTypesLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestPackedTypesLite result;
- TestPackedTypesLite result = new TestPackedTypesLite();
+ private TestPackedTypesLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestPackedTypesLite original = result;
+ result = new TestPackedTypesLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestPackedTypesLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestPackedTypesLite();
+ result = DefaultInstance ?? new TestPackedTypesLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestPackedTypesLite DefaultInstanceForType {
@@ -6598,8 +6973,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestPackedTypesLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.packedInt32_.MakeReadOnly();
result.packedInt64_.MakeReadOnly();
@@ -6615,9 +6990,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.packedDouble_.MakeReadOnly();
result.packedBool_.MakeReadOnly();
result.packedEnum_.MakeReadOnly();
- TestPackedTypesLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -6631,6 +7005,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestPackedTypesLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypesLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.packedInt32_.Count != 0) {
base.AddRange(other.packedInt32_, result.packedInt32_);
}
@@ -6681,6 +7056,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -6783,7 +7159,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public pbc::IPopsicleList<int> PackedInt32List {
- get { return result.packedInt32_; }
+ get { return PrepareBuilder().packedInt32_; }
}
public int PackedInt32Count {
get { return result.PackedInt32Count; }
@@ -6792,24 +7168,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedInt32(index);
}
public Builder SetPackedInt32(int index, int value) {
+ PrepareBuilder();
result.packedInt32_[index] = value;
return this;
}
public Builder AddPackedInt32(int value) {
+ PrepareBuilder();
result.packedInt32_.Add(value);
return this;
}
public Builder AddRangePackedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedInt32_);
return this;
}
public Builder ClearPackedInt32() {
+ PrepareBuilder();
result.packedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedInt64List {
- get { return result.packedInt64_; }
+ get { return PrepareBuilder().packedInt64_; }
}
public int PackedInt64Count {
get { return result.PackedInt64Count; }
@@ -6818,25 +7198,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedInt64(index);
}
public Builder SetPackedInt64(int index, long value) {
+ PrepareBuilder();
result.packedInt64_[index] = value;
return this;
}
public Builder AddPackedInt64(long value) {
+ PrepareBuilder();
result.packedInt64_.Add(value);
return this;
}
public Builder AddRangePackedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedInt64_);
return this;
}
public Builder ClearPackedInt64() {
+ PrepareBuilder();
result.packedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedUint32List {
- get { return result.packedUint32_; }
+ get { return PrepareBuilder().packedUint32_; }
}
public int PackedUint32Count {
get { return result.PackedUint32Count; }
@@ -6847,27 +7231,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedUint32(int index, uint value) {
+ PrepareBuilder();
result.packedUint32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedUint32(uint value) {
+ PrepareBuilder();
result.packedUint32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedUint32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedUint32_);
return this;
}
public Builder ClearPackedUint32() {
+ PrepareBuilder();
result.packedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedUint64List {
- get { return result.packedUint64_; }
+ get { return PrepareBuilder().packedUint64_; }
}
public int PackedUint64Count {
get { return result.PackedUint64Count; }
@@ -6878,26 +7266,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedUint64(int index, ulong value) {
+ PrepareBuilder();
result.packedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedUint64(ulong value) {
+ PrepareBuilder();
result.packedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedUint64_);
return this;
}
public Builder ClearPackedUint64() {
+ PrepareBuilder();
result.packedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSint32List {
- get { return result.packedSint32_; }
+ get { return PrepareBuilder().packedSint32_; }
}
public int PackedSint32Count {
get { return result.PackedSint32Count; }
@@ -6906,24 +7298,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSint32(index);
}
public Builder SetPackedSint32(int index, int value) {
+ PrepareBuilder();
result.packedSint32_[index] = value;
return this;
}
public Builder AddPackedSint32(int value) {
+ PrepareBuilder();
result.packedSint32_.Add(value);
return this;
}
public Builder AddRangePackedSint32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSint32_);
return this;
}
public Builder ClearPackedSint32() {
+ PrepareBuilder();
result.packedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSint64List {
- get { return result.packedSint64_; }
+ get { return PrepareBuilder().packedSint64_; }
}
public int PackedSint64Count {
get { return result.PackedSint64Count; }
@@ -6932,25 +7328,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSint64(index);
}
public Builder SetPackedSint64(int index, long value) {
+ PrepareBuilder();
result.packedSint64_[index] = value;
return this;
}
public Builder AddPackedSint64(long value) {
+ PrepareBuilder();
result.packedSint64_.Add(value);
return this;
}
public Builder AddRangePackedSint64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSint64_);
return this;
}
public Builder ClearPackedSint64() {
+ PrepareBuilder();
result.packedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedFixed32List {
- get { return result.packedFixed32_; }
+ get { return PrepareBuilder().packedFixed32_; }
}
public int PackedFixed32Count {
get { return result.PackedFixed32Count; }
@@ -6961,27 +7361,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedFixed32(int index, uint value) {
+ PrepareBuilder();
result.packedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedFixed32(uint value) {
+ PrepareBuilder();
result.packedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedFixed32_);
return this;
}
public Builder ClearPackedFixed32() {
+ PrepareBuilder();
result.packedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedFixed64List {
- get { return result.packedFixed64_; }
+ get { return PrepareBuilder().packedFixed64_; }
}
public int PackedFixed64Count {
get { return result.PackedFixed64Count; }
@@ -6992,26 +7396,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.packedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedFixed64(ulong value) {
+ PrepareBuilder();
result.packedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedFixed64_);
return this;
}
public Builder ClearPackedFixed64() {
+ PrepareBuilder();
result.packedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSfixed32List {
- get { return result.packedSfixed32_; }
+ get { return PrepareBuilder().packedSfixed32_; }
}
public int PackedSfixed32Count {
get { return result.PackedSfixed32Count; }
@@ -7020,24 +7428,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSfixed32(index);
}
public Builder SetPackedSfixed32(int index, int value) {
+ PrepareBuilder();
result.packedSfixed32_[index] = value;
return this;
}
public Builder AddPackedSfixed32(int value) {
+ PrepareBuilder();
result.packedSfixed32_.Add(value);
return this;
}
public Builder AddRangePackedSfixed32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSfixed32_);
return this;
}
public Builder ClearPackedSfixed32() {
+ PrepareBuilder();
result.packedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSfixed64List {
- get { return result.packedSfixed64_; }
+ get { return PrepareBuilder().packedSfixed64_; }
}
public int PackedSfixed64Count {
get { return result.PackedSfixed64Count; }
@@ -7046,24 +7458,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSfixed64(index);
}
public Builder SetPackedSfixed64(int index, long value) {
+ PrepareBuilder();
result.packedSfixed64_[index] = value;
return this;
}
public Builder AddPackedSfixed64(long value) {
+ PrepareBuilder();
result.packedSfixed64_.Add(value);
return this;
}
public Builder AddRangePackedSfixed64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSfixed64_);
return this;
}
public Builder ClearPackedSfixed64() {
+ PrepareBuilder();
result.packedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> PackedFloatList {
- get { return result.packedFloat_; }
+ get { return PrepareBuilder().packedFloat_; }
}
public int PackedFloatCount {
get { return result.PackedFloatCount; }
@@ -7072,24 +7488,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedFloat(index);
}
public Builder SetPackedFloat(int index, float value) {
+ PrepareBuilder();
result.packedFloat_[index] = value;
return this;
}
public Builder AddPackedFloat(float value) {
+ PrepareBuilder();
result.packedFloat_.Add(value);
return this;
}
public Builder AddRangePackedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedFloat_);
return this;
}
public Builder ClearPackedFloat() {
+ PrepareBuilder();
result.packedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> PackedDoubleList {
- get { return result.packedDouble_; }
+ get { return PrepareBuilder().packedDouble_; }
}
public int PackedDoubleCount {
get { return result.PackedDoubleCount; }
@@ -7098,24 +7518,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedDouble(index);
}
public Builder SetPackedDouble(int index, double value) {
+ PrepareBuilder();
result.packedDouble_[index] = value;
return this;
}
public Builder AddPackedDouble(double value) {
+ PrepareBuilder();
result.packedDouble_.Add(value);
return this;
}
public Builder AddRangePackedDouble(scg::IEnumerable<double> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedDouble_);
return this;
}
public Builder ClearPackedDouble() {
+ PrepareBuilder();
result.packedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> PackedBoolList {
- get { return result.packedBool_; }
+ get { return PrepareBuilder().packedBool_; }
}
public int PackedBoolCount {
get { return result.PackedBoolCount; }
@@ -7124,24 +7548,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedBool(index);
}
public Builder SetPackedBool(int index, bool value) {
+ PrepareBuilder();
result.packedBool_[index] = value;
return this;
}
public Builder AddPackedBool(bool value) {
+ PrepareBuilder();
result.packedBool_.Add(value);
return this;
}
public Builder AddRangePackedBool(scg::IEnumerable<bool> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedBool_);
return this;
}
public Builder ClearPackedBool() {
+ PrepareBuilder();
result.packedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> PackedEnumList {
- get { return result.packedEnum_; }
+ get { return PrepareBuilder().packedEnum_; }
}
public int PackedEnumCount {
get { return result.PackedEnumCount; }
@@ -7150,18 +7578,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedEnum(index);
}
public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.packedEnum_[index] = value;
return this;
}
public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.packedEnum_.Add(value);
return this;
}
public Builder AddRangePackedEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedEnum_);
return this;
}
public Builder ClearPackedEnum() {
+ PrepareBuilder();
result.packedEnum_.Clear();
return this;
}
@@ -7665,7 +8097,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestUnpackedTypesLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -7675,21 +8107,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestUnpackedTypesLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestUnpackedTypesLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestUnpackedTypesLite result = new TestUnpackedTypesLite();
+ bool builderIsReadOnly;
+ TestUnpackedTypesLite result;
+
+ private TestUnpackedTypesLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestUnpackedTypesLite original = result;
+ result = new TestUnpackedTypesLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestUnpackedTypesLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestUnpackedTypesLite();
+ result = DefaultInstance ?? new TestUnpackedTypesLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestUnpackedTypesLite DefaultInstanceForType {
@@ -7697,8 +8156,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestUnpackedTypesLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.unpackedInt32_.MakeReadOnly();
result.unpackedInt64_.MakeReadOnly();
@@ -7714,9 +8173,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.unpackedDouble_.MakeReadOnly();
result.unpackedBool_.MakeReadOnly();
result.unpackedEnum_.MakeReadOnly();
- TestUnpackedTypesLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -7730,6 +8188,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestUnpackedTypesLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypesLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.unpackedInt32_.Count != 0) {
base.AddRange(other.unpackedInt32_, result.unpackedInt32_);
}
@@ -7780,6 +8239,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -7882,7 +8342,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public pbc::IPopsicleList<int> UnpackedInt32List {
- get { return result.unpackedInt32_; }
+ get { return PrepareBuilder().unpackedInt32_; }
}
public int UnpackedInt32Count {
get { return result.UnpackedInt32Count; }
@@ -7891,24 +8351,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedInt32(index);
}
public Builder SetUnpackedInt32(int index, int value) {
+ PrepareBuilder();
result.unpackedInt32_[index] = value;
return this;
}
public Builder AddUnpackedInt32(int value) {
+ PrepareBuilder();
result.unpackedInt32_.Add(value);
return this;
}
public Builder AddRangeUnpackedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedInt32_);
return this;
}
public Builder ClearUnpackedInt32() {
+ PrepareBuilder();
result.unpackedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedInt64List {
- get { return result.unpackedInt64_; }
+ get { return PrepareBuilder().unpackedInt64_; }
}
public int UnpackedInt64Count {
get { return result.UnpackedInt64Count; }
@@ -7917,25 +8381,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedInt64(index);
}
public Builder SetUnpackedInt64(int index, long value) {
+ PrepareBuilder();
result.unpackedInt64_[index] = value;
return this;
}
public Builder AddUnpackedInt64(long value) {
+ PrepareBuilder();
result.unpackedInt64_.Add(value);
return this;
}
public Builder AddRangeUnpackedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedInt64_);
return this;
}
public Builder ClearUnpackedInt64() {
+ PrepareBuilder();
result.unpackedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedUint32List {
- get { return result.unpackedUint32_; }
+ get { return PrepareBuilder().unpackedUint32_; }
}
public int UnpackedUint32Count {
get { return result.UnpackedUint32Count; }
@@ -7946,27 +8414,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedUint32(int index, uint value) {
+ PrepareBuilder();
result.unpackedUint32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedUint32(uint value) {
+ PrepareBuilder();
result.unpackedUint32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedUint32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedUint32_);
return this;
}
public Builder ClearUnpackedUint32() {
+ PrepareBuilder();
result.unpackedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedUint64List {
- get { return result.unpackedUint64_; }
+ get { return PrepareBuilder().unpackedUint64_; }
}
public int UnpackedUint64Count {
get { return result.UnpackedUint64Count; }
@@ -7977,26 +8449,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedUint64(int index, ulong value) {
+ PrepareBuilder();
result.unpackedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedUint64(ulong value) {
+ PrepareBuilder();
result.unpackedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedUint64_);
return this;
}
public Builder ClearUnpackedUint64() {
+ PrepareBuilder();
result.unpackedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSint32List {
- get { return result.unpackedSint32_; }
+ get { return PrepareBuilder().unpackedSint32_; }
}
public int UnpackedSint32Count {
get { return result.UnpackedSint32Count; }
@@ -8005,24 +8481,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSint32(index);
}
public Builder SetUnpackedSint32(int index, int value) {
+ PrepareBuilder();
result.unpackedSint32_[index] = value;
return this;
}
public Builder AddUnpackedSint32(int value) {
+ PrepareBuilder();
result.unpackedSint32_.Add(value);
return this;
}
public Builder AddRangeUnpackedSint32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSint32_);
return this;
}
public Builder ClearUnpackedSint32() {
+ PrepareBuilder();
result.unpackedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSint64List {
- get { return result.unpackedSint64_; }
+ get { return PrepareBuilder().unpackedSint64_; }
}
public int UnpackedSint64Count {
get { return result.UnpackedSint64Count; }
@@ -8031,25 +8511,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSint64(index);
}
public Builder SetUnpackedSint64(int index, long value) {
+ PrepareBuilder();
result.unpackedSint64_[index] = value;
return this;
}
public Builder AddUnpackedSint64(long value) {
+ PrepareBuilder();
result.unpackedSint64_.Add(value);
return this;
}
public Builder AddRangeUnpackedSint64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSint64_);
return this;
}
public Builder ClearUnpackedSint64() {
+ PrepareBuilder();
result.unpackedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedFixed32List {
- get { return result.unpackedFixed32_; }
+ get { return PrepareBuilder().unpackedFixed32_; }
}
public int UnpackedFixed32Count {
get { return result.UnpackedFixed32Count; }
@@ -8060,27 +8544,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedFixed32(int index, uint value) {
+ PrepareBuilder();
result.unpackedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedFixed32(uint value) {
+ PrepareBuilder();
result.unpackedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedFixed32_);
return this;
}
public Builder ClearUnpackedFixed32() {
+ PrepareBuilder();
result.unpackedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedFixed64List {
- get { return result.unpackedFixed64_; }
+ get { return PrepareBuilder().unpackedFixed64_; }
}
public int UnpackedFixed64Count {
get { return result.UnpackedFixed64Count; }
@@ -8091,26 +8579,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.unpackedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedFixed64(ulong value) {
+ PrepareBuilder();
result.unpackedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedFixed64_);
return this;
}
public Builder ClearUnpackedFixed64() {
+ PrepareBuilder();
result.unpackedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSfixed32List {
- get { return result.unpackedSfixed32_; }
+ get { return PrepareBuilder().unpackedSfixed32_; }
}
public int UnpackedSfixed32Count {
get { return result.UnpackedSfixed32Count; }
@@ -8119,24 +8611,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSfixed32(index);
}
public Builder SetUnpackedSfixed32(int index, int value) {
+ PrepareBuilder();
result.unpackedSfixed32_[index] = value;
return this;
}
public Builder AddUnpackedSfixed32(int value) {
+ PrepareBuilder();
result.unpackedSfixed32_.Add(value);
return this;
}
public Builder AddRangeUnpackedSfixed32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSfixed32_);
return this;
}
public Builder ClearUnpackedSfixed32() {
+ PrepareBuilder();
result.unpackedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSfixed64List {
- get { return result.unpackedSfixed64_; }
+ get { return PrepareBuilder().unpackedSfixed64_; }
}
public int UnpackedSfixed64Count {
get { return result.UnpackedSfixed64Count; }
@@ -8145,24 +8641,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSfixed64(index);
}
public Builder SetUnpackedSfixed64(int index, long value) {
+ PrepareBuilder();
result.unpackedSfixed64_[index] = value;
return this;
}
public Builder AddUnpackedSfixed64(long value) {
+ PrepareBuilder();
result.unpackedSfixed64_.Add(value);
return this;
}
public Builder AddRangeUnpackedSfixed64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSfixed64_);
return this;
}
public Builder ClearUnpackedSfixed64() {
+ PrepareBuilder();
result.unpackedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> UnpackedFloatList {
- get { return result.unpackedFloat_; }
+ get { return PrepareBuilder().unpackedFloat_; }
}
public int UnpackedFloatCount {
get { return result.UnpackedFloatCount; }
@@ -8171,24 +8671,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedFloat(index);
}
public Builder SetUnpackedFloat(int index, float value) {
+ PrepareBuilder();
result.unpackedFloat_[index] = value;
return this;
}
public Builder AddUnpackedFloat(float value) {
+ PrepareBuilder();
result.unpackedFloat_.Add(value);
return this;
}
public Builder AddRangeUnpackedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedFloat_);
return this;
}
public Builder ClearUnpackedFloat() {
+ PrepareBuilder();
result.unpackedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> UnpackedDoubleList {
- get { return result.unpackedDouble_; }
+ get { return PrepareBuilder().unpackedDouble_; }
}
public int UnpackedDoubleCount {
get { return result.UnpackedDoubleCount; }
@@ -8197,24 +8701,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedDouble(index);
}
public Builder SetUnpackedDouble(int index, double value) {
+ PrepareBuilder();
result.unpackedDouble_[index] = value;
return this;
}
public Builder AddUnpackedDouble(double value) {
+ PrepareBuilder();
result.unpackedDouble_.Add(value);
return this;
}
public Builder AddRangeUnpackedDouble(scg::IEnumerable<double> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedDouble_);
return this;
}
public Builder ClearUnpackedDouble() {
+ PrepareBuilder();
result.unpackedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> UnpackedBoolList {
- get { return result.unpackedBool_; }
+ get { return PrepareBuilder().unpackedBool_; }
}
public int UnpackedBoolCount {
get { return result.UnpackedBoolCount; }
@@ -8223,24 +8731,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedBool(index);
}
public Builder SetUnpackedBool(int index, bool value) {
+ PrepareBuilder();
result.unpackedBool_[index] = value;
return this;
}
public Builder AddUnpackedBool(bool value) {
+ PrepareBuilder();
result.unpackedBool_.Add(value);
return this;
}
public Builder AddRangeUnpackedBool(scg::IEnumerable<bool> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedBool_);
return this;
}
public Builder ClearUnpackedBool() {
+ PrepareBuilder();
result.unpackedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> UnpackedEnumList {
- get { return result.unpackedEnum_; }
+ get { return PrepareBuilder().unpackedEnum_; }
}
public int UnpackedEnumCount {
get { return result.UnpackedEnumCount; }
@@ -8249,18 +8761,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedEnum(index);
}
public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.unpackedEnum_[index] = value;
return this;
}
public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) {
+ PrepareBuilder();
result.unpackedEnum_.Add(value);
return this;
}
public Builder AddRangeUnpackedEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedEnum_);
return this;
}
public Builder ClearUnpackedEnum() {
+ PrepareBuilder();
result.unpackedEnum_.Clear();
return this;
}
@@ -8369,7 +8885,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestAllExtensionsLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8379,21 +8895,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestAllExtensionsLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestAllExtensionsLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestAllExtensionsLite result = new TestAllExtensionsLite();
+ bool builderIsReadOnly;
+ TestAllExtensionsLite result;
+
+ private TestAllExtensionsLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestAllExtensionsLite original = result;
+ result = new TestAllExtensionsLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestAllExtensionsLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestAllExtensionsLite();
+ result = DefaultInstance ?? new TestAllExtensionsLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestAllExtensionsLite DefaultInstanceForType {
@@ -8401,12 +8944,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestAllExtensionsLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestAllExtensionsLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -8420,6 +8962,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestAllExtensionsLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
return this;
}
@@ -8429,6 +8972,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -8575,7 +9119,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OptionalGroup_extension_lite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8585,21 +9129,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new OptionalGroup_extension_lite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(OptionalGroup_extension_lite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ OptionalGroup_extension_lite result;
+
+ private OptionalGroup_extension_lite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ OptionalGroup_extension_lite original = result;
+ result = new OptionalGroup_extension_lite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- OptionalGroup_extension_lite result = new OptionalGroup_extension_lite();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override OptionalGroup_extension_lite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new OptionalGroup_extension_lite();
+ result = DefaultInstance ?? new OptionalGroup_extension_lite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override OptionalGroup_extension_lite DefaultInstanceForType {
@@ -8607,12 +9178,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OptionalGroup_extension_lite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- OptionalGroup_extension_lite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -8626,6 +9196,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OptionalGroup_extension_lite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -8637,6 +9208,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -8679,11 +9251,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -8805,7 +9379,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(RepeatedGroup_extension_lite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8815,21 +9389,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new RepeatedGroup_extension_lite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(RepeatedGroup_extension_lite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ RepeatedGroup_extension_lite result;
+
+ private RepeatedGroup_extension_lite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ RepeatedGroup_extension_lite original = result;
+ result = new RepeatedGroup_extension_lite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- RepeatedGroup_extension_lite result = new RepeatedGroup_extension_lite();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override RepeatedGroup_extension_lite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new RepeatedGroup_extension_lite();
+ result = DefaultInstance ?? new RepeatedGroup_extension_lite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override RepeatedGroup_extension_lite DefaultInstanceForType {
@@ -8837,12 +9438,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override RepeatedGroup_extension_lite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- RepeatedGroup_extension_lite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -8856,6 +9456,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(RepeatedGroup_extension_lite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension_lite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -8867,6 +9468,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -8909,11 +9511,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -9023,7 +9627,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestPackedExtensionsLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9033,21 +9637,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestPackedExtensionsLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestPackedExtensionsLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestPackedExtensionsLite result = new TestPackedExtensionsLite();
+ bool builderIsReadOnly;
+ TestPackedExtensionsLite result;
+
+ private TestPackedExtensionsLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestPackedExtensionsLite original = result;
+ result = new TestPackedExtensionsLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestPackedExtensionsLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestPackedExtensionsLite();
+ result = DefaultInstance ?? new TestPackedExtensionsLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestPackedExtensionsLite DefaultInstanceForType {
@@ -9055,12 +9686,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestPackedExtensionsLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestPackedExtensionsLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9074,6 +9704,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestPackedExtensionsLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
return this;
}
@@ -9083,6 +9714,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -9217,7 +9849,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestUnpackedExtensionsLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9227,21 +9859,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestUnpackedExtensionsLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestUnpackedExtensionsLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestUnpackedExtensionsLite result;
- TestUnpackedExtensionsLite result = new TestUnpackedExtensionsLite();
+ private TestUnpackedExtensionsLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestUnpackedExtensionsLite original = result;
+ result = new TestUnpackedExtensionsLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestUnpackedExtensionsLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestUnpackedExtensionsLite();
+ result = DefaultInstance ?? new TestUnpackedExtensionsLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestUnpackedExtensionsLite DefaultInstanceForType {
@@ -9249,12 +9908,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestUnpackedExtensionsLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestUnpackedExtensionsLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9268,6 +9926,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestUnpackedExtensionsLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
return this;
}
@@ -9277,6 +9936,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -9406,7 +10066,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestNestedExtensionLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9416,21 +10076,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestNestedExtensionLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestNestedExtensionLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestNestedExtensionLite result;
+
+ private TestNestedExtensionLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestNestedExtensionLite original = result;
+ result = new TestNestedExtensionLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestNestedExtensionLite result = new TestNestedExtensionLite();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestNestedExtensionLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestNestedExtensionLite();
+ result = DefaultInstance ?? new TestNestedExtensionLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestNestedExtensionLite DefaultInstanceForType {
@@ -9438,12 +10125,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestNestedExtensionLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestNestedExtensionLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9457,6 +10143,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestNestedExtensionLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.DefaultInstance) return this;
+ PrepareBuilder();
return this;
}
@@ -9465,6 +10152,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -9611,7 +10299,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestDeprecatedLite prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9621,21 +10309,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestDeprecatedLite();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestDeprecatedLite cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestDeprecatedLite result = new TestDeprecatedLite();
+ bool builderIsReadOnly;
+ TestDeprecatedLite result;
+
+ private TestDeprecatedLite PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestDeprecatedLite original = result;
+ result = new TestDeprecatedLite();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestDeprecatedLite MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestDeprecatedLite();
+ result = DefaultInstance ?? new TestDeprecatedLite();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override TestDeprecatedLite DefaultInstanceForType {
@@ -9643,12 +10358,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestDeprecatedLite BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestDeprecatedLite returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessageLite other) {
@@ -9662,6 +10376,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestDeprecatedLite other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedLite.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasDeprecatedField) {
DeprecatedField = other.DeprecatedField;
}
@@ -9673,6 +10388,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
uint tag;
string field_name;
while (input.ReadTag(out tag, out field_name)) {
@@ -9715,11 +10431,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDeprecatedField(value); }
}
public Builder SetDeprecatedField(int value) {
+ PrepareBuilder();
result.hasDeprecatedField = true;
result.deprecatedField_ = value;
return this;
}
public Builder ClearDeprecatedField() {
+ PrepareBuilder();
result.hasDeprecatedField = false;
result.deprecatedField_ = 0;
return this;
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
index d8824d49..aeea673d 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs
@@ -1260,7 +1260,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1270,21 +1270,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new NestedMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- NestedMessage result = new NestedMessage();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override NestedMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new NestedMessage();
+ result = DefaultInstance ?? new NestedMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1296,12 +1323,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override NestedMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1315,6 +1341,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(NestedMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasBb) {
Bb = other.Bb;
}
@@ -1327,6 +1354,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -1382,11 +1410,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetBb(value); }
}
public Builder SetBb(int value) {
+ PrepareBuilder();
result.hasBb = true;
result.bb_ = value;
return this;
}
public Builder ClearBb() {
+ PrepareBuilder();
result.hasBb = false;
result.bb_ = 0;
return this;
@@ -1499,7 +1529,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OptionalGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1509,21 +1539,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new OptionalGroup();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(OptionalGroup cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ OptionalGroup result;
+
+ private OptionalGroup PrepareBuilder() {
+ if (builderIsReadOnly) {
+ OptionalGroup original = result;
+ result = new OptionalGroup();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- OptionalGroup result = new OptionalGroup();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override OptionalGroup MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new OptionalGroup();
+ result = DefaultInstance ?? new OptionalGroup();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1535,12 +1592,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OptionalGroup BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- OptionalGroup returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1554,6 +1610,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OptionalGroup other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -1566,6 +1623,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -1621,11 +1679,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -1738,7 +1798,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(RepeatedGroup prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -1748,21 +1808,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new RepeatedGroup();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(RepeatedGroup cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ RepeatedGroup result;
- RepeatedGroup result = new RepeatedGroup();
+ private RepeatedGroup PrepareBuilder() {
+ if (builderIsReadOnly) {
+ RepeatedGroup original = result;
+ result = new RepeatedGroup();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override RepeatedGroup MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new RepeatedGroup();
+ result = DefaultInstance ?? new RepeatedGroup();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -1774,12 +1861,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override RepeatedGroup BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- RepeatedGroup returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -1793,6 +1879,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(RepeatedGroup other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -1805,6 +1892,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -1860,11 +1948,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -3181,7 +3271,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestAllTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -3191,21 +3281,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestAllTypes();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestAllTypes cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestAllTypes result;
+
+ private TestAllTypes PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestAllTypes original = result;
+ result = new TestAllTypes();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestAllTypes result = new TestAllTypes();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestAllTypes MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestAllTypes();
+ result = DefaultInstance ?? new TestAllTypes();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -3217,8 +3334,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestAllTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.repeatedInt32_.MakeReadOnly();
result.repeatedInt64_.MakeReadOnly();
@@ -3244,9 +3361,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.repeatedImportEnum_.MakeReadOnly();
result.repeatedStringPiece_.MakeReadOnly();
result.repeatedCord_.MakeReadOnly();
- TestAllTypes returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -3260,6 +3376,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestAllTypes other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasOptionalInt32) {
OptionalInt32 = other.OptionalInt32;
}
@@ -3473,6 +3590,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -3907,11 +4025,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalInt32(value); }
}
public Builder SetOptionalInt32(int value) {
+ PrepareBuilder();
result.hasOptionalInt32 = true;
result.optionalInt32_ = value;
return this;
}
public Builder ClearOptionalInt32() {
+ PrepareBuilder();
result.hasOptionalInt32 = false;
result.optionalInt32_ = 0;
return this;
@@ -3925,11 +4045,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalInt64(value); }
}
public Builder SetOptionalInt64(long value) {
+ PrepareBuilder();
result.hasOptionalInt64 = true;
result.optionalInt64_ = value;
return this;
}
public Builder ClearOptionalInt64() {
+ PrepareBuilder();
result.hasOptionalInt64 = false;
result.optionalInt64_ = 0L;
return this;
@@ -3945,11 +4067,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalUint32(uint value) {
+ PrepareBuilder();
result.hasOptionalUint32 = true;
result.optionalUint32_ = value;
return this;
}
public Builder ClearOptionalUint32() {
+ PrepareBuilder();
result.hasOptionalUint32 = false;
result.optionalUint32_ = 0;
return this;
@@ -3965,11 +4089,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalUint64(ulong value) {
+ PrepareBuilder();
result.hasOptionalUint64 = true;
result.optionalUint64_ = value;
return this;
}
public Builder ClearOptionalUint64() {
+ PrepareBuilder();
result.hasOptionalUint64 = false;
result.optionalUint64_ = 0UL;
return this;
@@ -3983,11 +4109,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSint32(value); }
}
public Builder SetOptionalSint32(int value) {
+ PrepareBuilder();
result.hasOptionalSint32 = true;
result.optionalSint32_ = value;
return this;
}
public Builder ClearOptionalSint32() {
+ PrepareBuilder();
result.hasOptionalSint32 = false;
result.optionalSint32_ = 0;
return this;
@@ -4001,11 +4129,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSint64(value); }
}
public Builder SetOptionalSint64(long value) {
+ PrepareBuilder();
result.hasOptionalSint64 = true;
result.optionalSint64_ = value;
return this;
}
public Builder ClearOptionalSint64() {
+ PrepareBuilder();
result.hasOptionalSint64 = false;
result.optionalSint64_ = 0;
return this;
@@ -4021,11 +4151,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalFixed32(uint value) {
+ PrepareBuilder();
result.hasOptionalFixed32 = true;
result.optionalFixed32_ = value;
return this;
}
public Builder ClearOptionalFixed32() {
+ PrepareBuilder();
result.hasOptionalFixed32 = false;
result.optionalFixed32_ = 0;
return this;
@@ -4041,11 +4173,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetOptionalFixed64(ulong value) {
+ PrepareBuilder();
result.hasOptionalFixed64 = true;
result.optionalFixed64_ = value;
return this;
}
public Builder ClearOptionalFixed64() {
+ PrepareBuilder();
result.hasOptionalFixed64 = false;
result.optionalFixed64_ = 0;
return this;
@@ -4059,11 +4193,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSfixed32(value); }
}
public Builder SetOptionalSfixed32(int value) {
+ PrepareBuilder();
result.hasOptionalSfixed32 = true;
result.optionalSfixed32_ = value;
return this;
}
public Builder ClearOptionalSfixed32() {
+ PrepareBuilder();
result.hasOptionalSfixed32 = false;
result.optionalSfixed32_ = 0;
return this;
@@ -4077,11 +4213,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalSfixed64(value); }
}
public Builder SetOptionalSfixed64(long value) {
+ PrepareBuilder();
result.hasOptionalSfixed64 = true;
result.optionalSfixed64_ = value;
return this;
}
public Builder ClearOptionalSfixed64() {
+ PrepareBuilder();
result.hasOptionalSfixed64 = false;
result.optionalSfixed64_ = 0;
return this;
@@ -4095,11 +4233,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalFloat(value); }
}
public Builder SetOptionalFloat(float value) {
+ PrepareBuilder();
result.hasOptionalFloat = true;
result.optionalFloat_ = value;
return this;
}
public Builder ClearOptionalFloat() {
+ PrepareBuilder();
result.hasOptionalFloat = false;
result.optionalFloat_ = 0F;
return this;
@@ -4113,11 +4253,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalDouble(value); }
}
public Builder SetOptionalDouble(double value) {
+ PrepareBuilder();
result.hasOptionalDouble = true;
result.optionalDouble_ = value;
return this;
}
public Builder ClearOptionalDouble() {
+ PrepareBuilder();
result.hasOptionalDouble = false;
result.optionalDouble_ = 0D;
return this;
@@ -4131,11 +4273,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalBool(value); }
}
public Builder SetOptionalBool(bool value) {
+ PrepareBuilder();
result.hasOptionalBool = true;
result.optionalBool_ = value;
return this;
}
public Builder ClearOptionalBool() {
+ PrepareBuilder();
result.hasOptionalBool = false;
result.optionalBool_ = false;
return this;
@@ -4150,11 +4294,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalString = true;
result.optionalString_ = value;
return this;
}
public Builder ClearOptionalString() {
+ PrepareBuilder();
result.hasOptionalString = false;
result.optionalString_ = "";
return this;
@@ -4169,11 +4315,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalBytes = true;
result.optionalBytes_ = value;
return this;
}
public Builder ClearOptionalBytes() {
+ PrepareBuilder();
result.hasOptionalBytes = false;
result.optionalBytes_ = pb::ByteString.Empty;
return this;
@@ -4188,18 +4336,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalGroup = true;
result.optionalGroup_ = value;
return this;
}
public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalGroup = true;
result.optionalGroup_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalGroup &&
result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) {
result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial();
@@ -4210,6 +4361,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalGroup() {
+ PrepareBuilder();
result.hasOptionalGroup = false;
result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance;
return this;
@@ -4224,18 +4376,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalNestedMessage = true;
result.optionalNestedMessage_ = value;
return this;
}
public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalNestedMessage = true;
result.optionalNestedMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalNestedMessage &&
result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) {
result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial();
@@ -4246,6 +4401,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance;
return this;
@@ -4260,18 +4416,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalForeignMessage = true;
result.optionalForeignMessage_ = value;
return this;
}
public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalForeignMessage = true;
result.optionalForeignMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalForeignMessage &&
result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) {
result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial();
@@ -4282,6 +4441,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalForeignMessage() {
+ PrepareBuilder();
result.hasOptionalForeignMessage = false;
result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
return this;
@@ -4296,18 +4456,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalImportMessage = true;
result.optionalImportMessage_ = value;
return this;
}
public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalImportMessage = true;
result.optionalImportMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalImportMessage &&
result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) {
result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial();
@@ -4318,6 +4481,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalImportMessage() {
+ PrepareBuilder();
result.hasOptionalImportMessage = false;
result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance;
return this;
@@ -4331,11 +4495,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalNestedEnum(value); }
}
public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) {
+ PrepareBuilder();
result.hasOptionalNestedEnum = true;
result.optionalNestedEnum_ = value;
return this;
}
public Builder ClearOptionalNestedEnum() {
+ PrepareBuilder();
result.hasOptionalNestedEnum = false;
result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO;
return this;
@@ -4349,11 +4515,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalForeignEnum(value); }
}
public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.hasOptionalForeignEnum = true;
result.optionalForeignEnum_ = value;
return this;
}
public Builder ClearOptionalForeignEnum() {
+ PrepareBuilder();
result.hasOptionalForeignEnum = false;
result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO;
return this;
@@ -4367,11 +4535,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalImportEnum(value); }
}
public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) {
+ PrepareBuilder();
result.hasOptionalImportEnum = true;
result.optionalImportEnum_ = value;
return this;
}
public Builder ClearOptionalImportEnum() {
+ PrepareBuilder();
result.hasOptionalImportEnum = false;
result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO;
return this;
@@ -4386,11 +4556,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalStringPiece(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalStringPiece = true;
result.optionalStringPiece_ = value;
return this;
}
public Builder ClearOptionalStringPiece() {
+ PrepareBuilder();
result.hasOptionalStringPiece = false;
result.optionalStringPiece_ = "";
return this;
@@ -4405,18 +4577,20 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalCord(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalCord = true;
result.optionalCord_ = value;
return this;
}
public Builder ClearOptionalCord() {
+ PrepareBuilder();
result.hasOptionalCord = false;
result.optionalCord_ = "";
return this;
}
public pbc::IPopsicleList<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -4425,24 +4599,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedInt32(index);
}
public Builder SetRepeatedInt32(int index, int value) {
+ PrepareBuilder();
result.repeatedInt32_[index] = value;
return this;
}
public Builder AddRepeatedInt32(int value) {
+ PrepareBuilder();
result.repeatedInt32_.Add(value);
return this;
}
public Builder AddRangeRepeatedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedInt32_);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -4451,25 +4629,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedInt64(index);
}
public Builder SetRepeatedInt64(int index, long value) {
+ PrepareBuilder();
result.repeatedInt64_[index] = value;
return this;
}
public Builder AddRepeatedInt64(long value) {
+ PrepareBuilder();
result.repeatedInt64_.Add(value);
return this;
}
public Builder AddRangeRepeatedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedInt64_);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedUint32List {
- get { return result.repeatedUint32_; }
+ get { return PrepareBuilder().repeatedUint32_; }
}
public int RepeatedUint32Count {
get { return result.RepeatedUint32Count; }
@@ -4480,27 +4662,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedUint32(int index, uint value) {
+ PrepareBuilder();
result.repeatedUint32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedUint32(uint value) {
+ PrepareBuilder();
result.repeatedUint32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedUint32_);
return this;
}
public Builder ClearRepeatedUint32() {
+ PrepareBuilder();
result.repeatedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -4511,26 +4697,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedUint64(int index, ulong value) {
+ PrepareBuilder();
result.repeatedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedUint64(ulong value) {
+ PrepareBuilder();
result.repeatedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedUint64_);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSint32List {
- get { return result.repeatedSint32_; }
+ get { return PrepareBuilder().repeatedSint32_; }
}
public int RepeatedSint32Count {
get { return result.RepeatedSint32Count; }
@@ -4539,24 +4729,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSint32(index);
}
public Builder SetRepeatedSint32(int index, int value) {
+ PrepareBuilder();
result.repeatedSint32_[index] = value;
return this;
}
public Builder AddRepeatedSint32(int value) {
+ PrepareBuilder();
result.repeatedSint32_.Add(value);
return this;
}
public Builder AddRangeRepeatedSint32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSint32_);
return this;
}
public Builder ClearRepeatedSint32() {
+ PrepareBuilder();
result.repeatedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSint64List {
- get { return result.repeatedSint64_; }
+ get { return PrepareBuilder().repeatedSint64_; }
}
public int RepeatedSint64Count {
get { return result.RepeatedSint64Count; }
@@ -4565,25 +4759,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSint64(index);
}
public Builder SetRepeatedSint64(int index, long value) {
+ PrepareBuilder();
result.repeatedSint64_[index] = value;
return this;
}
public Builder AddRepeatedSint64(long value) {
+ PrepareBuilder();
result.repeatedSint64_.Add(value);
return this;
}
public Builder AddRangeRepeatedSint64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSint64_);
return this;
}
public Builder ClearRepeatedSint64() {
+ PrepareBuilder();
result.repeatedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -4594,27 +4792,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed32(int index, uint value) {
+ PrepareBuilder();
result.repeatedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed32(uint value) {
+ PrepareBuilder();
result.repeatedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFixed32_);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -4625,26 +4827,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.repeatedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed64(ulong value) {
+ PrepareBuilder();
result.repeatedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFixed64_);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedSfixed32List {
- get { return result.repeatedSfixed32_; }
+ get { return PrepareBuilder().repeatedSfixed32_; }
}
public int RepeatedSfixed32Count {
get { return result.RepeatedSfixed32Count; }
@@ -4653,24 +4859,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSfixed32(index);
}
public Builder SetRepeatedSfixed32(int index, int value) {
+ PrepareBuilder();
result.repeatedSfixed32_[index] = value;
return this;
}
public Builder AddRepeatedSfixed32(int value) {
+ PrepareBuilder();
result.repeatedSfixed32_.Add(value);
return this;
}
public Builder AddRangeRepeatedSfixed32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSfixed32_);
return this;
}
public Builder ClearRepeatedSfixed32() {
+ PrepareBuilder();
result.repeatedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedSfixed64List {
- get { return result.repeatedSfixed64_; }
+ get { return PrepareBuilder().repeatedSfixed64_; }
}
public int RepeatedSfixed64Count {
get { return result.RepeatedSfixed64Count; }
@@ -4679,24 +4889,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedSfixed64(index);
}
public Builder SetRepeatedSfixed64(int index, long value) {
+ PrepareBuilder();
result.repeatedSfixed64_[index] = value;
return this;
}
public Builder AddRepeatedSfixed64(long value) {
+ PrepareBuilder();
result.repeatedSfixed64_.Add(value);
return this;
}
public Builder AddRangeRepeatedSfixed64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedSfixed64_);
return this;
}
public Builder ClearRepeatedSfixed64() {
+ PrepareBuilder();
result.repeatedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -4705,24 +4919,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedFloat(index);
}
public Builder SetRepeatedFloat(int index, float value) {
+ PrepareBuilder();
result.repeatedFloat_[index] = value;
return this;
}
public Builder AddRepeatedFloat(float value) {
+ PrepareBuilder();
result.repeatedFloat_.Add(value);
return this;
}
public Builder AddRangeRepeatedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFloat_);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> RepeatedDoubleList {
- get { return result.repeatedDouble_; }
+ get { return PrepareBuilder().repeatedDouble_; }
}
public int RepeatedDoubleCount {
get { return result.RepeatedDoubleCount; }
@@ -4731,24 +4949,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedDouble(index);
}
public Builder SetRepeatedDouble(int index, double value) {
+ PrepareBuilder();
result.repeatedDouble_[index] = value;
return this;
}
public Builder AddRepeatedDouble(double value) {
+ PrepareBuilder();
result.repeatedDouble_.Add(value);
return this;
}
public Builder AddRangeRepeatedDouble(scg::IEnumerable<double> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedDouble_);
return this;
}
public Builder ClearRepeatedDouble() {
+ PrepareBuilder();
result.repeatedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> RepeatedBoolList {
- get { return result.repeatedBool_; }
+ get { return PrepareBuilder().repeatedBool_; }
}
public int RepeatedBoolCount {
get { return result.RepeatedBoolCount; }
@@ -4757,24 +4979,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedBool(index);
}
public Builder SetRepeatedBool(int index, bool value) {
+ PrepareBuilder();
result.repeatedBool_[index] = value;
return this;
}
public Builder AddRepeatedBool(bool value) {
+ PrepareBuilder();
result.repeatedBool_.Add(value);
return this;
}
public Builder AddRangeRepeatedBool(scg::IEnumerable<bool> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedBool_);
return this;
}
public Builder ClearRepeatedBool() {
+ PrepareBuilder();
result.repeatedBool_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringList {
- get { return result.repeatedString_; }
+ get { return PrepareBuilder().repeatedString_; }
}
public int RepeatedStringCount {
get { return result.RepeatedStringCount; }
@@ -4784,25 +5010,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedString(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedString_[index] = value;
return this;
}
public Builder AddRepeatedString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedString_.Add(value);
return this;
}
public Builder AddRangeRepeatedString(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedString_);
return this;
}
public Builder ClearRepeatedString() {
+ PrepareBuilder();
result.repeatedString_.Clear();
return this;
}
public pbc::IPopsicleList<pb::ByteString> RepeatedBytesList {
- get { return result.repeatedBytes_; }
+ get { return PrepareBuilder().repeatedBytes_; }
}
public int RepeatedBytesCount {
get { return result.RepeatedBytesCount; }
@@ -4812,25 +5042,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedBytes(int index, pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedBytes_[index] = value;
return this;
}
public Builder AddRepeatedBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedBytes_.Add(value);
return this;
}
public Builder AddRangeRepeatedBytes(scg::IEnumerable<pb::ByteString> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedBytes_);
return this;
}
public Builder ClearRepeatedBytes() {
+ PrepareBuilder();
result.repeatedBytes_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup> RepeatedGroupList {
- get { return result.repeatedGroup_; }
+ get { return PrepareBuilder().repeatedGroup_; }
}
public int RepeatedGroupCount {
get { return result.RepeatedGroupCount; }
@@ -4840,35 +5074,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedGroup_[index] = value;
return this;
}
public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedGroup_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedGroup_.Add(value);
return this;
}
public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedGroup_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedGroup(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedGroup_);
return this;
}
public Builder ClearRepeatedGroup() {
+ PrepareBuilder();
result.repeatedGroup_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage> RepeatedNestedMessageList {
- get { return result.repeatedNestedMessage_; }
+ get { return PrepareBuilder().repeatedNestedMessage_; }
}
public int RepeatedNestedMessageCount {
get { return result.RepeatedNestedMessageCount; }
@@ -4878,35 +5118,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedNestedMessage_[index] = value;
return this;
}
public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedNestedMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedNestedMessage_.Add(value);
return this;
}
public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedNestedMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedNestedMessage_);
return this;
}
public Builder ClearRepeatedNestedMessage() {
+ PrepareBuilder();
result.repeatedNestedMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> RepeatedForeignMessageList {
- get { return result.repeatedForeignMessage_; }
+ get { return PrepareBuilder().repeatedForeignMessage_; }
}
public int RepeatedForeignMessageCount {
get { return result.RepeatedForeignMessageCount; }
@@ -4916,35 +5162,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedForeignMessage_[index] = value;
return this;
}
public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedForeignMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedForeignMessage_.Add(value);
return this;
}
public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedForeignMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedForeignMessage_);
return this;
}
public Builder ClearRepeatedForeignMessage() {
+ PrepareBuilder();
result.repeatedForeignMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportMessage> RepeatedImportMessageList {
- get { return result.repeatedImportMessage_; }
+ get { return PrepareBuilder().repeatedImportMessage_; }
}
public int RepeatedImportMessageCount {
get { return result.RepeatedImportMessageCount; }
@@ -4954,35 +5206,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedImportMessage_[index] = value;
return this;
}
public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedImportMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedImportMessage_.Add(value);
return this;
}
public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedImportMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedImportMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ImportMessage> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedImportMessage_);
return this;
}
public Builder ClearRepeatedImportMessage() {
+ PrepareBuilder();
result.repeatedImportMessage_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum> RepeatedNestedEnumList {
- get { return result.repeatedNestedEnum_; }
+ get { return PrepareBuilder().repeatedNestedEnum_; }
}
public int RepeatedNestedEnumCount {
get { return result.RepeatedNestedEnumCount; }
@@ -4991,24 +5249,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedNestedEnum(index);
}
public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) {
+ PrepareBuilder();
result.repeatedNestedEnum_[index] = value;
return this;
}
public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) {
+ PrepareBuilder();
result.repeatedNestedEnum_.Add(value);
return this;
}
public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedNestedEnum_);
return this;
}
public Builder ClearRepeatedNestedEnum() {
+ PrepareBuilder();
result.repeatedNestedEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> RepeatedForeignEnumList {
- get { return result.repeatedForeignEnum_; }
+ get { return PrepareBuilder().repeatedForeignEnum_; }
}
public int RepeatedForeignEnumCount {
get { return result.RepeatedForeignEnumCount; }
@@ -5017,24 +5279,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedForeignEnum(index);
}
public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.repeatedForeignEnum_[index] = value;
return this;
}
public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.repeatedForeignEnum_.Add(value);
return this;
}
public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedForeignEnum_);
return this;
}
public Builder ClearRepeatedForeignEnum() {
+ PrepareBuilder();
result.repeatedForeignEnum_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ImportEnum> RepeatedImportEnumList {
- get { return result.repeatedImportEnum_; }
+ get { return PrepareBuilder().repeatedImportEnum_; }
}
public int RepeatedImportEnumCount {
get { return result.RepeatedImportEnumCount; }
@@ -5043,24 +5309,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedImportEnum(index);
}
public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnum value) {
+ PrepareBuilder();
result.repeatedImportEnum_[index] = value;
return this;
}
public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) {
+ PrepareBuilder();
result.repeatedImportEnum_.Add(value);
return this;
}
public Builder AddRangeRepeatedImportEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ImportEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedImportEnum_);
return this;
}
public Builder ClearRepeatedImportEnum() {
+ PrepareBuilder();
result.repeatedImportEnum_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceList {
- get { return result.repeatedStringPiece_; }
+ get { return PrepareBuilder().repeatedStringPiece_; }
}
public int RepeatedStringPieceCount {
get { return result.RepeatedStringPieceCount; }
@@ -5070,25 +5340,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedStringPiece(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringPiece_[index] = value;
return this;
}
public Builder AddRepeatedStringPiece(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringPiece_.Add(value);
return this;
}
public Builder AddRangeRepeatedStringPiece(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedStringPiece_);
return this;
}
public Builder ClearRepeatedStringPiece() {
+ PrepareBuilder();
result.repeatedStringPiece_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordList {
- get { return result.repeatedCord_; }
+ get { return PrepareBuilder().repeatedCord_; }
}
public int RepeatedCordCount {
get { return result.RepeatedCordCount; }
@@ -5098,19 +5372,23 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedCord(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedCord_[index] = value;
return this;
}
public Builder AddRepeatedCord(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedCord_.Add(value);
return this;
}
public Builder AddRangeRepeatedCord(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedCord_);
return this;
}
public Builder ClearRepeatedCord() {
+ PrepareBuilder();
result.repeatedCord_.Clear();
return this;
}
@@ -5123,11 +5401,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultInt32(value); }
}
public Builder SetDefaultInt32(int value) {
+ PrepareBuilder();
result.hasDefaultInt32 = true;
result.defaultInt32_ = value;
return this;
}
public Builder ClearDefaultInt32() {
+ PrepareBuilder();
result.hasDefaultInt32 = false;
result.defaultInt32_ = 41;
return this;
@@ -5141,11 +5421,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultInt64(value); }
}
public Builder SetDefaultInt64(long value) {
+ PrepareBuilder();
result.hasDefaultInt64 = true;
result.defaultInt64_ = value;
return this;
}
public Builder ClearDefaultInt64() {
+ PrepareBuilder();
result.hasDefaultInt64 = false;
result.defaultInt64_ = 42L;
return this;
@@ -5161,11 +5443,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultUint32(uint value) {
+ PrepareBuilder();
result.hasDefaultUint32 = true;
result.defaultUint32_ = value;
return this;
}
public Builder ClearDefaultUint32() {
+ PrepareBuilder();
result.hasDefaultUint32 = false;
result.defaultUint32_ = 43;
return this;
@@ -5181,11 +5465,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultUint64(ulong value) {
+ PrepareBuilder();
result.hasDefaultUint64 = true;
result.defaultUint64_ = value;
return this;
}
public Builder ClearDefaultUint64() {
+ PrepareBuilder();
result.hasDefaultUint64 = false;
result.defaultUint64_ = 44UL;
return this;
@@ -5199,11 +5485,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSint32(value); }
}
public Builder SetDefaultSint32(int value) {
+ PrepareBuilder();
result.hasDefaultSint32 = true;
result.defaultSint32_ = value;
return this;
}
public Builder ClearDefaultSint32() {
+ PrepareBuilder();
result.hasDefaultSint32 = false;
result.defaultSint32_ = -45;
return this;
@@ -5217,11 +5505,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSint64(value); }
}
public Builder SetDefaultSint64(long value) {
+ PrepareBuilder();
result.hasDefaultSint64 = true;
result.defaultSint64_ = value;
return this;
}
public Builder ClearDefaultSint64() {
+ PrepareBuilder();
result.hasDefaultSint64 = false;
result.defaultSint64_ = 46;
return this;
@@ -5237,11 +5527,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultFixed32(uint value) {
+ PrepareBuilder();
result.hasDefaultFixed32 = true;
result.defaultFixed32_ = value;
return this;
}
public Builder ClearDefaultFixed32() {
+ PrepareBuilder();
result.hasDefaultFixed32 = false;
result.defaultFixed32_ = 47;
return this;
@@ -5257,11 +5549,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetDefaultFixed64(ulong value) {
+ PrepareBuilder();
result.hasDefaultFixed64 = true;
result.defaultFixed64_ = value;
return this;
}
public Builder ClearDefaultFixed64() {
+ PrepareBuilder();
result.hasDefaultFixed64 = false;
result.defaultFixed64_ = 48;
return this;
@@ -5275,11 +5569,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSfixed32(value); }
}
public Builder SetDefaultSfixed32(int value) {
+ PrepareBuilder();
result.hasDefaultSfixed32 = true;
result.defaultSfixed32_ = value;
return this;
}
public Builder ClearDefaultSfixed32() {
+ PrepareBuilder();
result.hasDefaultSfixed32 = false;
result.defaultSfixed32_ = 49;
return this;
@@ -5293,11 +5589,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultSfixed64(value); }
}
public Builder SetDefaultSfixed64(long value) {
+ PrepareBuilder();
result.hasDefaultSfixed64 = true;
result.defaultSfixed64_ = value;
return this;
}
public Builder ClearDefaultSfixed64() {
+ PrepareBuilder();
result.hasDefaultSfixed64 = false;
result.defaultSfixed64_ = -50;
return this;
@@ -5311,11 +5609,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultFloat(value); }
}
public Builder SetDefaultFloat(float value) {
+ PrepareBuilder();
result.hasDefaultFloat = true;
result.defaultFloat_ = value;
return this;
}
public Builder ClearDefaultFloat() {
+ PrepareBuilder();
result.hasDefaultFloat = false;
result.defaultFloat_ = 51.5F;
return this;
@@ -5329,11 +5629,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultDouble(value); }
}
public Builder SetDefaultDouble(double value) {
+ PrepareBuilder();
result.hasDefaultDouble = true;
result.defaultDouble_ = value;
return this;
}
public Builder ClearDefaultDouble() {
+ PrepareBuilder();
result.hasDefaultDouble = false;
result.defaultDouble_ = 52000D;
return this;
@@ -5347,11 +5649,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultBool(value); }
}
public Builder SetDefaultBool(bool value) {
+ PrepareBuilder();
result.hasDefaultBool = true;
result.defaultBool_ = value;
return this;
}
public Builder ClearDefaultBool() {
+ PrepareBuilder();
result.hasDefaultBool = false;
result.defaultBool_ = true;
return this;
@@ -5366,11 +5670,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultString = true;
result.defaultString_ = value;
return this;
}
public Builder ClearDefaultString() {
+ PrepareBuilder();
result.hasDefaultString = false;
result.defaultString_ = "hello";
return this;
@@ -5385,11 +5691,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultBytes = true;
result.defaultBytes_ = value;
return this;
}
public Builder ClearDefaultBytes() {
+ PrepareBuilder();
result.hasDefaultBytes = false;
result.defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue;
return this;
@@ -5403,11 +5711,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultNestedEnum(value); }
}
public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) {
+ PrepareBuilder();
result.hasDefaultNestedEnum = true;
result.defaultNestedEnum_ = value;
return this;
}
public Builder ClearDefaultNestedEnum() {
+ PrepareBuilder();
result.hasDefaultNestedEnum = false;
result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR;
return this;
@@ -5421,11 +5731,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultForeignEnum(value); }
}
public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.hasDefaultForeignEnum = true;
result.defaultForeignEnum_ = value;
return this;
}
public Builder ClearDefaultForeignEnum() {
+ PrepareBuilder();
result.hasDefaultForeignEnum = false;
result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR;
return this;
@@ -5439,11 +5751,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDefaultImportEnum(value); }
}
public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) {
+ PrepareBuilder();
result.hasDefaultImportEnum = true;
result.defaultImportEnum_ = value;
return this;
}
public Builder ClearDefaultImportEnum() {
+ PrepareBuilder();
result.hasDefaultImportEnum = false;
result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR;
return this;
@@ -5458,11 +5772,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultStringPiece(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultStringPiece = true;
result.defaultStringPiece_ = value;
return this;
}
public Builder ClearDefaultStringPiece() {
+ PrepareBuilder();
result.hasDefaultStringPiece = false;
result.defaultStringPiece_ = "abc";
return this;
@@ -5477,11 +5793,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDefaultCord(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDefaultCord = true;
result.defaultCord_ = value;
return this;
}
public Builder ClearDefaultCord() {
+ PrepareBuilder();
result.hasDefaultCord = false;
result.defaultCord_ = "123";
return this;
@@ -5594,7 +5912,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestDeprecatedFields prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5604,21 +5922,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestDeprecatedFields();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestDeprecatedFields cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestDeprecatedFields result;
- TestDeprecatedFields result = new TestDeprecatedFields();
+ private TestDeprecatedFields PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestDeprecatedFields original = result;
+ result = new TestDeprecatedFields();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestDeprecatedFields MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestDeprecatedFields();
+ result = DefaultInstance ?? new TestDeprecatedFields();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5630,12 +5975,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestDeprecatedFields BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestDeprecatedFields returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5649,6 +5993,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestDeprecatedFields other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasDeprecatedInt32) {
DeprecatedInt32 = other.DeprecatedInt32;
}
@@ -5661,6 +6006,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -5716,11 +6062,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDeprecatedInt32(value); }
}
public Builder SetDeprecatedInt32(int value) {
+ PrepareBuilder();
result.hasDeprecatedInt32 = true;
result.deprecatedInt32_ = value;
return this;
}
public Builder ClearDeprecatedInt32() {
+ PrepareBuilder();
result.hasDeprecatedInt32 = false;
result.deprecatedInt32_ = 0;
return this;
@@ -5833,7 +6181,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(ForeignMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -5843,21 +6191,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new ForeignMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(ForeignMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- ForeignMessage result = new ForeignMessage();
+ bool builderIsReadOnly;
+ ForeignMessage result;
+
+ private ForeignMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ ForeignMessage original = result;
+ result = new ForeignMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override ForeignMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new ForeignMessage();
+ result = DefaultInstance ?? new ForeignMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -5869,12 +6244,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override ForeignMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- ForeignMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -5888,6 +6262,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(ForeignMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasC) {
C = other.C;
}
@@ -5900,6 +6275,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -5955,11 +6331,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetC(value); }
}
public Builder SetC(int value) {
+ PrepareBuilder();
result.hasC = true;
result.c_ = value;
return this;
}
public Builder ClearC() {
+ PrepareBuilder();
result.hasC = false;
result.c_ = 0;
return this;
@@ -6060,7 +6438,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestAllExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6070,21 +6448,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestAllExtensions();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestAllExtensions cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestAllExtensions result = new TestAllExtensions();
+ bool builderIsReadOnly;
+ TestAllExtensions result;
+
+ private TestAllExtensions PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestAllExtensions original = result;
+ result = new TestAllExtensions();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestAllExtensions MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestAllExtensions();
+ result = DefaultInstance ?? new TestAllExtensions();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6096,12 +6501,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestAllExtensions BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestAllExtensions returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6115,6 +6519,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestAllExtensions other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -6125,6 +6530,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -6275,7 +6681,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OptionalGroup_extension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6285,21 +6691,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new OptionalGroup_extension();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(OptionalGroup_extension cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- OptionalGroup_extension result = new OptionalGroup_extension();
+ bool builderIsReadOnly;
+ OptionalGroup_extension result;
+
+ private OptionalGroup_extension PrepareBuilder() {
+ if (builderIsReadOnly) {
+ OptionalGroup_extension original = result;
+ result = new OptionalGroup_extension();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override OptionalGroup_extension MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new OptionalGroup_extension();
+ result = DefaultInstance ?? new OptionalGroup_extension();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6311,12 +6744,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OptionalGroup_extension BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- OptionalGroup_extension returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6330,6 +6762,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OptionalGroup_extension other) {
if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -6342,6 +6775,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -6397,11 +6831,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -6514,7 +6950,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(RepeatedGroup_extension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6524,21 +6960,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new RepeatedGroup_extension();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(RepeatedGroup_extension cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ RepeatedGroup_extension result;
+
+ private RepeatedGroup_extension PrepareBuilder() {
+ if (builderIsReadOnly) {
+ RepeatedGroup_extension original = result;
+ result = new RepeatedGroup_extension();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- RepeatedGroup_extension result = new RepeatedGroup_extension();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override RepeatedGroup_extension MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new RepeatedGroup_extension();
+ result = DefaultInstance ?? new RepeatedGroup_extension();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6550,12 +7013,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override RepeatedGroup_extension BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- RepeatedGroup_extension returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6569,6 +7031,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(RepeatedGroup_extension other) {
if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -6581,6 +7044,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -6636,11 +7100,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -6739,7 +7205,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestNestedExtension prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -6749,21 +7215,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestNestedExtension();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestNestedExtension cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestNestedExtension result;
+
+ private TestNestedExtension PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestNestedExtension original = result;
+ result = new TestNestedExtension();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestNestedExtension result = new TestNestedExtension();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestNestedExtension MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestNestedExtension();
+ result = DefaultInstance ?? new TestNestedExtension();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -6775,12 +7268,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestNestedExtension BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestNestedExtension returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -6794,6 +7286,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestNestedExtension other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -6803,6 +7296,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -7472,7 +7966,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestRequired prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -7482,21 +7976,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestRequired();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestRequired cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestRequired result = new TestRequired();
+ bool builderIsReadOnly;
+ TestRequired result;
+
+ private TestRequired PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestRequired original = result;
+ result = new TestRequired();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestRequired MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestRequired();
+ result = DefaultInstance ?? new TestRequired();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -7508,12 +8029,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestRequired BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestRequired returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -7527,6 +8047,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestRequired other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -7635,6 +8156,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -7818,11 +8340,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -7836,11 +8360,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy2(value); }
}
public Builder SetDummy2(int value) {
+ PrepareBuilder();
result.hasDummy2 = true;
result.dummy2_ = value;
return this;
}
public Builder ClearDummy2() {
+ PrepareBuilder();
result.hasDummy2 = false;
result.dummy2_ = 0;
return this;
@@ -7854,11 +8380,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetB(value); }
}
public Builder SetB(int value) {
+ PrepareBuilder();
result.hasB = true;
result.b_ = value;
return this;
}
public Builder ClearB() {
+ PrepareBuilder();
result.hasB = false;
result.b_ = 0;
return this;
@@ -7872,11 +8400,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy4(value); }
}
public Builder SetDummy4(int value) {
+ PrepareBuilder();
result.hasDummy4 = true;
result.dummy4_ = value;
return this;
}
public Builder ClearDummy4() {
+ PrepareBuilder();
result.hasDummy4 = false;
result.dummy4_ = 0;
return this;
@@ -7890,11 +8420,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy5(value); }
}
public Builder SetDummy5(int value) {
+ PrepareBuilder();
result.hasDummy5 = true;
result.dummy5_ = value;
return this;
}
public Builder ClearDummy5() {
+ PrepareBuilder();
result.hasDummy5 = false;
result.dummy5_ = 0;
return this;
@@ -7908,11 +8440,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy6(value); }
}
public Builder SetDummy6(int value) {
+ PrepareBuilder();
result.hasDummy6 = true;
result.dummy6_ = value;
return this;
}
public Builder ClearDummy6() {
+ PrepareBuilder();
result.hasDummy6 = false;
result.dummy6_ = 0;
return this;
@@ -7926,11 +8460,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy7(value); }
}
public Builder SetDummy7(int value) {
+ PrepareBuilder();
result.hasDummy7 = true;
result.dummy7_ = value;
return this;
}
public Builder ClearDummy7() {
+ PrepareBuilder();
result.hasDummy7 = false;
result.dummy7_ = 0;
return this;
@@ -7944,11 +8480,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy8(value); }
}
public Builder SetDummy8(int value) {
+ PrepareBuilder();
result.hasDummy8 = true;
result.dummy8_ = value;
return this;
}
public Builder ClearDummy8() {
+ PrepareBuilder();
result.hasDummy8 = false;
result.dummy8_ = 0;
return this;
@@ -7962,11 +8500,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy9(value); }
}
public Builder SetDummy9(int value) {
+ PrepareBuilder();
result.hasDummy9 = true;
result.dummy9_ = value;
return this;
}
public Builder ClearDummy9() {
+ PrepareBuilder();
result.hasDummy9 = false;
result.dummy9_ = 0;
return this;
@@ -7980,11 +8520,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy10(value); }
}
public Builder SetDummy10(int value) {
+ PrepareBuilder();
result.hasDummy10 = true;
result.dummy10_ = value;
return this;
}
public Builder ClearDummy10() {
+ PrepareBuilder();
result.hasDummy10 = false;
result.dummy10_ = 0;
return this;
@@ -7998,11 +8540,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy11(value); }
}
public Builder SetDummy11(int value) {
+ PrepareBuilder();
result.hasDummy11 = true;
result.dummy11_ = value;
return this;
}
public Builder ClearDummy11() {
+ PrepareBuilder();
result.hasDummy11 = false;
result.dummy11_ = 0;
return this;
@@ -8016,11 +8560,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy12(value); }
}
public Builder SetDummy12(int value) {
+ PrepareBuilder();
result.hasDummy12 = true;
result.dummy12_ = value;
return this;
}
public Builder ClearDummy12() {
+ PrepareBuilder();
result.hasDummy12 = false;
result.dummy12_ = 0;
return this;
@@ -8034,11 +8580,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy13(value); }
}
public Builder SetDummy13(int value) {
+ PrepareBuilder();
result.hasDummy13 = true;
result.dummy13_ = value;
return this;
}
public Builder ClearDummy13() {
+ PrepareBuilder();
result.hasDummy13 = false;
result.dummy13_ = 0;
return this;
@@ -8052,11 +8600,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy14(value); }
}
public Builder SetDummy14(int value) {
+ PrepareBuilder();
result.hasDummy14 = true;
result.dummy14_ = value;
return this;
}
public Builder ClearDummy14() {
+ PrepareBuilder();
result.hasDummy14 = false;
result.dummy14_ = 0;
return this;
@@ -8070,11 +8620,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy15(value); }
}
public Builder SetDummy15(int value) {
+ PrepareBuilder();
result.hasDummy15 = true;
result.dummy15_ = value;
return this;
}
public Builder ClearDummy15() {
+ PrepareBuilder();
result.hasDummy15 = false;
result.dummy15_ = 0;
return this;
@@ -8088,11 +8640,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy16(value); }
}
public Builder SetDummy16(int value) {
+ PrepareBuilder();
result.hasDummy16 = true;
result.dummy16_ = value;
return this;
}
public Builder ClearDummy16() {
+ PrepareBuilder();
result.hasDummy16 = false;
result.dummy16_ = 0;
return this;
@@ -8106,11 +8660,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy17(value); }
}
public Builder SetDummy17(int value) {
+ PrepareBuilder();
result.hasDummy17 = true;
result.dummy17_ = value;
return this;
}
public Builder ClearDummy17() {
+ PrepareBuilder();
result.hasDummy17 = false;
result.dummy17_ = 0;
return this;
@@ -8124,11 +8680,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy18(value); }
}
public Builder SetDummy18(int value) {
+ PrepareBuilder();
result.hasDummy18 = true;
result.dummy18_ = value;
return this;
}
public Builder ClearDummy18() {
+ PrepareBuilder();
result.hasDummy18 = false;
result.dummy18_ = 0;
return this;
@@ -8142,11 +8700,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy19(value); }
}
public Builder SetDummy19(int value) {
+ PrepareBuilder();
result.hasDummy19 = true;
result.dummy19_ = value;
return this;
}
public Builder ClearDummy19() {
+ PrepareBuilder();
result.hasDummy19 = false;
result.dummy19_ = 0;
return this;
@@ -8160,11 +8720,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy20(value); }
}
public Builder SetDummy20(int value) {
+ PrepareBuilder();
result.hasDummy20 = true;
result.dummy20_ = value;
return this;
}
public Builder ClearDummy20() {
+ PrepareBuilder();
result.hasDummy20 = false;
result.dummy20_ = 0;
return this;
@@ -8178,11 +8740,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy21(value); }
}
public Builder SetDummy21(int value) {
+ PrepareBuilder();
result.hasDummy21 = true;
result.dummy21_ = value;
return this;
}
public Builder ClearDummy21() {
+ PrepareBuilder();
result.hasDummy21 = false;
result.dummy21_ = 0;
return this;
@@ -8196,11 +8760,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy22(value); }
}
public Builder SetDummy22(int value) {
+ PrepareBuilder();
result.hasDummy22 = true;
result.dummy22_ = value;
return this;
}
public Builder ClearDummy22() {
+ PrepareBuilder();
result.hasDummy22 = false;
result.dummy22_ = 0;
return this;
@@ -8214,11 +8780,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy23(value); }
}
public Builder SetDummy23(int value) {
+ PrepareBuilder();
result.hasDummy23 = true;
result.dummy23_ = value;
return this;
}
public Builder ClearDummy23() {
+ PrepareBuilder();
result.hasDummy23 = false;
result.dummy23_ = 0;
return this;
@@ -8232,11 +8800,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy24(value); }
}
public Builder SetDummy24(int value) {
+ PrepareBuilder();
result.hasDummy24 = true;
result.dummy24_ = value;
return this;
}
public Builder ClearDummy24() {
+ PrepareBuilder();
result.hasDummy24 = false;
result.dummy24_ = 0;
return this;
@@ -8250,11 +8820,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy25(value); }
}
public Builder SetDummy25(int value) {
+ PrepareBuilder();
result.hasDummy25 = true;
result.dummy25_ = value;
return this;
}
public Builder ClearDummy25() {
+ PrepareBuilder();
result.hasDummy25 = false;
result.dummy25_ = 0;
return this;
@@ -8268,11 +8840,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy26(value); }
}
public Builder SetDummy26(int value) {
+ PrepareBuilder();
result.hasDummy26 = true;
result.dummy26_ = value;
return this;
}
public Builder ClearDummy26() {
+ PrepareBuilder();
result.hasDummy26 = false;
result.dummy26_ = 0;
return this;
@@ -8286,11 +8860,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy27(value); }
}
public Builder SetDummy27(int value) {
+ PrepareBuilder();
result.hasDummy27 = true;
result.dummy27_ = value;
return this;
}
public Builder ClearDummy27() {
+ PrepareBuilder();
result.hasDummy27 = false;
result.dummy27_ = 0;
return this;
@@ -8304,11 +8880,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy28(value); }
}
public Builder SetDummy28(int value) {
+ PrepareBuilder();
result.hasDummy28 = true;
result.dummy28_ = value;
return this;
}
public Builder ClearDummy28() {
+ PrepareBuilder();
result.hasDummy28 = false;
result.dummy28_ = 0;
return this;
@@ -8322,11 +8900,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy29(value); }
}
public Builder SetDummy29(int value) {
+ PrepareBuilder();
result.hasDummy29 = true;
result.dummy29_ = value;
return this;
}
public Builder ClearDummy29() {
+ PrepareBuilder();
result.hasDummy29 = false;
result.dummy29_ = 0;
return this;
@@ -8340,11 +8920,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy30(value); }
}
public Builder SetDummy30(int value) {
+ PrepareBuilder();
result.hasDummy30 = true;
result.dummy30_ = value;
return this;
}
public Builder ClearDummy30() {
+ PrepareBuilder();
result.hasDummy30 = false;
result.dummy30_ = 0;
return this;
@@ -8358,11 +8940,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy31(value); }
}
public Builder SetDummy31(int value) {
+ PrepareBuilder();
result.hasDummy31 = true;
result.dummy31_ = value;
return this;
}
public Builder ClearDummy31() {
+ PrepareBuilder();
result.hasDummy31 = false;
result.dummy31_ = 0;
return this;
@@ -8376,11 +8960,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy32(value); }
}
public Builder SetDummy32(int value) {
+ PrepareBuilder();
result.hasDummy32 = true;
result.dummy32_ = value;
return this;
}
public Builder ClearDummy32() {
+ PrepareBuilder();
result.hasDummy32 = false;
result.dummy32_ = 0;
return this;
@@ -8394,11 +8980,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetC(value); }
}
public Builder SetC(int value) {
+ PrepareBuilder();
result.hasC = true;
result.c_ = value;
return this;
}
public Builder ClearC() {
+ PrepareBuilder();
result.hasC = false;
result.c_ = 0;
return this;
@@ -8551,7 +9139,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestRequiredForeign prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8561,21 +9149,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestRequiredForeign();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestRequiredForeign cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestRequiredForeign result;
- TestRequiredForeign result = new TestRequiredForeign();
+ private TestRequiredForeign PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestRequiredForeign original = result;
+ result = new TestRequiredForeign();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestRequiredForeign MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestRequiredForeign();
+ result = DefaultInstance ?? new TestRequiredForeign();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -8587,13 +9202,12 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestRequiredForeign BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.repeatedMessage_.MakeReadOnly();
- TestRequiredForeign returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -8607,6 +9221,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestRequiredForeign other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasOptionalMessage) {
MergeOptionalMessage(other.OptionalMessage);
}
@@ -8625,6 +9240,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -8694,18 +9310,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalMessage = true;
result.optionalMessage_ = value;
return this;
}
public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalMessage = true;
result.optionalMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalMessage &&
result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) {
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial();
@@ -8716,13 +9335,14 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalMessage() {
+ PrepareBuilder();
result.hasOptionalMessage = false;
result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.TestRequired> RepeatedMessageList {
- get { return result.repeatedMessage_; }
+ get { return PrepareBuilder().repeatedMessage_; }
}
public int RepeatedMessageCount {
get { return result.RepeatedMessageCount; }
@@ -8732,29 +9352,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedMessage_[index] = value;
return this;
}
public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedMessage_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedMessage_.Add(value);
return this;
}
public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedMessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedMessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.TestRequired> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedMessage_);
return this;
}
public Builder ClearRepeatedMessage() {
+ PrepareBuilder();
result.repeatedMessage_.Clear();
return this;
}
@@ -8767,11 +9393,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDummy(value); }
}
public Builder SetDummy(int value) {
+ PrepareBuilder();
result.hasDummy = true;
result.dummy_ = value;
return this;
}
public Builder ClearDummy() {
+ PrepareBuilder();
result.hasDummy = false;
result.dummy_ = 0;
return this;
@@ -8884,7 +9512,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestForeignNested prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -8894,21 +9522,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestForeignNested();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestForeignNested cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestForeignNested result = new TestForeignNested();
+ bool builderIsReadOnly;
+ TestForeignNested result;
+
+ private TestForeignNested PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestForeignNested original = result;
+ result = new TestForeignNested();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestForeignNested MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestForeignNested();
+ result = DefaultInstance ?? new TestForeignNested();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -8920,12 +9575,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestForeignNested BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestForeignNested returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -8939,6 +9593,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestForeignNested other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasForeignNested) {
MergeForeignNested(other.ForeignNested);
}
@@ -8951,6 +9606,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -9012,18 +9668,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasForeignNested = true;
result.foreignNested_ = value;
return this;
}
public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasForeignNested = true;
result.foreignNested_ = builderForValue.Build();
return this;
}
public Builder MergeForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasForeignNested &&
result.foreignNested_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) {
result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.foreignNested_).MergeFrom(value).BuildPartial();
@@ -9034,6 +9693,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearForeignNested() {
+ PrepareBuilder();
result.hasForeignNested = false;
result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance;
return this;
@@ -9130,7 +9790,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestEmptyMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9140,21 +9800,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestEmptyMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestEmptyMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestEmptyMessage result;
+
+ private TestEmptyMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestEmptyMessage original = result;
+ result = new TestEmptyMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestEmptyMessage result = new TestEmptyMessage();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestEmptyMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestEmptyMessage();
+ result = DefaultInstance ?? new TestEmptyMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9166,12 +9853,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestEmptyMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestEmptyMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9185,6 +9871,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestEmptyMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -9194,6 +9881,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -9332,7 +10020,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9342,21 +10030,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestEmptyMessageWithExtensions();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestEmptyMessageWithExtensions cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestEmptyMessageWithExtensions result = new TestEmptyMessageWithExtensions();
+ bool builderIsReadOnly;
+ TestEmptyMessageWithExtensions result;
+
+ private TestEmptyMessageWithExtensions PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestEmptyMessageWithExtensions original = result;
+ result = new TestEmptyMessageWithExtensions();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestEmptyMessageWithExtensions MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestEmptyMessageWithExtensions();
+ result = DefaultInstance ?? new TestEmptyMessageWithExtensions();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9368,12 +10083,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestEmptyMessageWithExtensions BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestEmptyMessageWithExtensions returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9387,6 +10101,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestEmptyMessageWithExtensions other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -9397,6 +10112,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -9537,7 +10253,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9547,21 +10263,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestMultipleExtensionRanges();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestMultipleExtensionRanges cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestMultipleExtensionRanges result;
+
+ private TestMultipleExtensionRanges PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestMultipleExtensionRanges original = result;
+ result = new TestMultipleExtensionRanges();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMultipleExtensionRanges result = new TestMultipleExtensionRanges();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestMultipleExtensionRanges MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestMultipleExtensionRanges();
+ result = DefaultInstance ?? new TestMultipleExtensionRanges();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9573,12 +10316,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestMultipleExtensionRanges BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestMultipleExtensionRanges returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9592,6 +10334,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestMultipleExtensionRanges other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -9602,6 +10345,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -9768,7 +10512,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -9778,21 +10522,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestReallyLargeTagNumber();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestReallyLargeTagNumber cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestReallyLargeTagNumber result;
+
+ private TestReallyLargeTagNumber PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestReallyLargeTagNumber original = result;
+ result = new TestReallyLargeTagNumber();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestReallyLargeTagNumber result = new TestReallyLargeTagNumber();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestReallyLargeTagNumber MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestReallyLargeTagNumber();
+ result = DefaultInstance ?? new TestReallyLargeTagNumber();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -9804,12 +10575,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestReallyLargeTagNumber BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestReallyLargeTagNumber returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -9823,6 +10593,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestReallyLargeTagNumber other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -9838,6 +10609,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -9897,11 +10669,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -9915,11 +10689,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetBb(value); }
}
public Builder SetBb(int value) {
+ PrepareBuilder();
result.hasBb = true;
result.bb_ = value;
return this;
}
public Builder ClearBb() {
+ PrepareBuilder();
result.hasBb = false;
result.bb_ = 0;
return this;
@@ -10048,7 +10824,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestRecursiveMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10058,21 +10834,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestRecursiveMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestRecursiveMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestRecursiveMessage result = new TestRecursiveMessage();
+ bool builderIsReadOnly;
+ TestRecursiveMessage result;
+
+ private TestRecursiveMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestRecursiveMessage original = result;
+ result = new TestRecursiveMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestRecursiveMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestRecursiveMessage();
+ result = DefaultInstance ?? new TestRecursiveMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10084,12 +10887,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestRecursiveMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestRecursiveMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10103,6 +10905,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestRecursiveMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
MergeA(other.A);
}
@@ -10118,6 +10921,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -10183,18 +10987,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasA = true;
result.a_ = builderForValue.Build();
return this;
}
public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasA &&
result.a_ != global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) {
result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(result.a_).MergeFrom(value).BuildPartial();
@@ -10205,6 +11012,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance;
return this;
@@ -10218,11 +11026,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetI(value); }
}
public Builder SetI(int value) {
+ PrepareBuilder();
result.hasI = true;
result.i_ = value;
return this;
}
public Builder ClearI() {
+ PrepareBuilder();
result.hasI = false;
result.i_ = 0;
return this;
@@ -10335,7 +11145,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestMutualRecursionA prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10345,21 +11155,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestMutualRecursionA();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestMutualRecursionA cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestMutualRecursionA result;
+
+ private TestMutualRecursionA PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestMutualRecursionA original = result;
+ result = new TestMutualRecursionA();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestMutualRecursionA result = new TestMutualRecursionA();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestMutualRecursionA MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestMutualRecursionA();
+ result = DefaultInstance ?? new TestMutualRecursionA();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10371,12 +11208,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestMutualRecursionA BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestMutualRecursionA returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10390,6 +11226,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestMutualRecursionA other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasBb) {
MergeBb(other.Bb);
}
@@ -10402,6 +11239,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -10463,18 +11301,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasBb = true;
result.bb_ = value;
return this;
}
public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasBb = true;
result.bb_ = builderForValue.Build();
return this;
}
public Builder MergeBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasBb &&
result.bb_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) {
result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(result.bb_).MergeFrom(value).BuildPartial();
@@ -10485,6 +11326,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearBb() {
+ PrepareBuilder();
result.hasBb = false;
result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance;
return this;
@@ -10613,7 +11455,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestMutualRecursionB prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10623,21 +11465,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestMutualRecursionB();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestMutualRecursionB cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestMutualRecursionB result = new TestMutualRecursionB();
+ bool builderIsReadOnly;
+ TestMutualRecursionB result;
+
+ private TestMutualRecursionB PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestMutualRecursionB original = result;
+ result = new TestMutualRecursionB();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestMutualRecursionB MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestMutualRecursionB();
+ result = DefaultInstance ?? new TestMutualRecursionB();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10649,12 +11518,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestMutualRecursionB BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestMutualRecursionB returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10668,6 +11536,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestMutualRecursionB other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
MergeA(other.A);
}
@@ -10683,6 +11552,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -10748,18 +11618,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasA = true;
result.a_ = builderForValue.Build();
return this;
}
public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasA &&
result.a_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) {
result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(result.a_).MergeFrom(value).BuildPartial();
@@ -10770,6 +11643,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance;
return this;
@@ -10783,11 +11657,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOptionalInt32(value); }
}
public Builder SetOptionalInt32(int value) {
+ PrepareBuilder();
result.hasOptionalInt32 = true;
result.optionalInt32_ = value;
return this;
}
public Builder ClearOptionalInt32() {
+ PrepareBuilder();
result.hasOptionalInt32 = false;
result.optionalInt32_ = 0;
return this;
@@ -10932,7 +11808,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(Foo prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -10942,21 +11818,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new Foo();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(Foo cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ Foo result;
- Foo result = new Foo();
+ private Foo PrepareBuilder() {
+ if (builderIsReadOnly) {
+ Foo original = result;
+ result = new Foo();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override Foo MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new Foo();
+ result = DefaultInstance ?? new Foo();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -10968,12 +11871,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Foo BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- Foo returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -10987,6 +11889,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(Foo other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -10999,6 +11902,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -11054,11 +11958,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -11171,7 +12077,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(Bar prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11181,21 +12087,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new Bar();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(Bar cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- Bar result = new Bar();
+ bool builderIsReadOnly;
+ Bar result;
+
+ private Bar PrepareBuilder() {
+ if (builderIsReadOnly) {
+ Bar original = result;
+ result = new Bar();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override Bar MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new Bar();
+ result = DefaultInstance ?? new Bar();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11207,12 +12140,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Bar BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- Bar returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11226,6 +12158,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(Bar other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -11238,6 +12171,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -11293,11 +12227,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -11418,7 +12354,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestDupFieldNumber prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11428,21 +12364,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestDupFieldNumber();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestDupFieldNumber cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestDupFieldNumber result = new TestDupFieldNumber();
+ bool builderIsReadOnly;
+ TestDupFieldNumber result;
+
+ private TestDupFieldNumber PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestDupFieldNumber original = result;
+ result = new TestDupFieldNumber();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestDupFieldNumber MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestDupFieldNumber();
+ result = DefaultInstance ?? new TestDupFieldNumber();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11454,12 +12417,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestDupFieldNumber BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestDupFieldNumber returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11473,6 +12435,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestDupFieldNumber other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasA) {
A = other.A;
}
@@ -11491,6 +12454,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -11564,11 +12528,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetA(value); }
}
public Builder SetA(int value) {
+ PrepareBuilder();
result.hasA = true;
result.a_ = value;
return this;
}
public Builder ClearA() {
+ PrepareBuilder();
result.hasA = false;
result.a_ = 0;
return this;
@@ -11583,18 +12549,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasFoo = true;
result.foo_ = value;
return this;
}
public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasFoo = true;
result.foo_ = builderForValue.Build();
return this;
}
public Builder MergeFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasFoo &&
result.foo_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) {
result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(result.foo_).MergeFrom(value).BuildPartial();
@@ -11605,6 +12574,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearFoo() {
+ PrepareBuilder();
result.hasFoo = false;
result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance;
return this;
@@ -11619,18 +12589,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasBar = true;
result.bar_ = value;
return this;
}
public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasBar = true;
result.bar_ = builderForValue.Build();
return this;
}
public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasBar &&
result.bar_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) {
result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial();
@@ -11641,6 +12614,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearBar() {
+ PrepareBuilder();
result.hasBar = false;
result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance;
return this;
@@ -11810,7 +12784,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(NestedMessage prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -11820,21 +12794,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new NestedMessage();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(NestedMessage cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ NestedMessage result;
+
+ private NestedMessage PrepareBuilder() {
+ if (builderIsReadOnly) {
+ NestedMessage original = result;
+ result = new NestedMessage();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- NestedMessage result = new NestedMessage();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override NestedMessage MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new NestedMessage();
+ result = DefaultInstance ?? new NestedMessage();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -11846,14 +12847,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override NestedMessage BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.nestedmessageRepeatedInt32_.MakeReadOnly();
result.nestedmessageRepeatedForeignmessage_.MakeReadOnly();
- NestedMessage returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -11867,6 +12867,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(NestedMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this;
+ PrepareBuilder();
if (other.nestedmessageRepeatedInt32_.Count != 0) {
base.AddRange(other.nestedmessageRepeatedInt32_, result.nestedmessageRepeatedInt32_);
}
@@ -11882,6 +12883,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -11935,7 +12937,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public pbc::IPopsicleList<int> NestedmessageRepeatedInt32List {
- get { return result.nestedmessageRepeatedInt32_; }
+ get { return PrepareBuilder().nestedmessageRepeatedInt32_; }
}
public int NestedmessageRepeatedInt32Count {
get { return result.NestedmessageRepeatedInt32Count; }
@@ -11944,24 +12946,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetNestedmessageRepeatedInt32(index);
}
public Builder SetNestedmessageRepeatedInt32(int index, int value) {
+ PrepareBuilder();
result.nestedmessageRepeatedInt32_[index] = value;
return this;
}
public Builder AddNestedmessageRepeatedInt32(int value) {
+ PrepareBuilder();
result.nestedmessageRepeatedInt32_.Add(value);
return this;
}
public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.nestedmessageRepeatedInt32_);
return this;
}
public Builder ClearNestedmessageRepeatedInt32() {
+ PrepareBuilder();
result.nestedmessageRepeatedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> NestedmessageRepeatedForeignmessageList {
- get { return result.nestedmessageRepeatedForeignmessage_; }
+ get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; }
}
public int NestedmessageRepeatedForeignmessageCount {
get { return result.NestedmessageRepeatedForeignmessageCount; }
@@ -11971,29 +12977,35 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_[index] = value;
return this;
}
public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_[index] = builderForValue.Build();
return this;
}
public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_.Add(value);
return this;
}
public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
+ PrepareBuilder();
base.AddRange(values, result.nestedmessageRepeatedForeignmessage_);
return this;
}
public Builder ClearNestedmessageRepeatedForeignmessage() {
+ PrepareBuilder();
result.nestedmessageRepeatedForeignmessage_.Clear();
return this;
}
@@ -12081,7 +13093,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestNestedMessageHasBits prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -12091,21 +13103,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestNestedMessageHasBits();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestNestedMessageHasBits cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestNestedMessageHasBits result = new TestNestedMessageHasBits();
+ bool builderIsReadOnly;
+ TestNestedMessageHasBits result;
+
+ private TestNestedMessageHasBits PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestNestedMessageHasBits original = result;
+ result = new TestNestedMessageHasBits();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestNestedMessageHasBits MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestNestedMessageHasBits();
+ result = DefaultInstance ?? new TestNestedMessageHasBits();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -12117,12 +13156,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestNestedMessageHasBits BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestNestedMessageHasBits returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -12136,6 +13174,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestNestedMessageHasBits other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasOptionalNestedMessage) {
MergeOptionalNestedMessage(other.OptionalNestedMessage);
}
@@ -12148,6 +13187,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -12209,18 +13249,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasOptionalNestedMessage = true;
result.optionalNestedMessage_ = value;
return this;
}
public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasOptionalNestedMessage = true;
result.optionalNestedMessage_ = builderForValue.Build();
return this;
}
public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasOptionalNestedMessage &&
result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) {
result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial();
@@ -12231,6 +13274,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearOptionalNestedMessage() {
+ PrepareBuilder();
result.hasOptionalNestedMessage = false;
result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance;
return this;
@@ -12558,7 +13602,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -12568,21 +13612,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestCamelCaseFieldNames();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestCamelCaseFieldNames cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestCamelCaseFieldNames result;
+
+ private TestCamelCaseFieldNames PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestCamelCaseFieldNames original = result;
+ result = new TestCamelCaseFieldNames();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestCamelCaseFieldNames result = new TestCamelCaseFieldNames();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestCamelCaseFieldNames MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestCamelCaseFieldNames();
+ result = DefaultInstance ?? new TestCamelCaseFieldNames();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -12594,8 +13665,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestCamelCaseFieldNames BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.repeatedPrimitiveField_.MakeReadOnly();
result.repeatedStringField_.MakeReadOnly();
@@ -12603,9 +13674,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.repeatedMessageField_.MakeReadOnly();
result.repeatedStringPieceField_.MakeReadOnly();
result.repeatedCordField_.MakeReadOnly();
- TestCamelCaseFieldNames returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -12619,6 +13689,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestCamelCaseFieldNames other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasPrimitiveField) {
PrimitiveField = other.PrimitiveField;
}
@@ -12664,6 +13735,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -12787,11 +13859,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetPrimitiveField(value); }
}
public Builder SetPrimitiveField(int value) {
+ PrepareBuilder();
result.hasPrimitiveField = true;
result.primitiveField_ = value;
return this;
}
public Builder ClearPrimitiveField() {
+ PrepareBuilder();
result.hasPrimitiveField = false;
result.primitiveField_ = 0;
return this;
@@ -12806,11 +13880,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetStringField(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasStringField = true;
result.stringField_ = value;
return this;
}
public Builder ClearStringField() {
+ PrepareBuilder();
result.hasStringField = false;
result.stringField_ = "";
return this;
@@ -12824,11 +13900,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetEnumField(value); }
}
public Builder SetEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.hasEnumField = true;
result.enumField_ = value;
return this;
}
public Builder ClearEnumField() {
+ PrepareBuilder();
result.hasEnumField = false;
result.enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO;
return this;
@@ -12843,18 +13921,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasMessageField = true;
result.messageField_ = value;
return this;
}
public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasMessageField = true;
result.messageField_ = builderForValue.Build();
return this;
}
public Builder MergeMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasMessageField &&
result.messageField_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) {
result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageField_).MergeFrom(value).BuildPartial();
@@ -12865,6 +13946,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearMessageField() {
+ PrepareBuilder();
result.hasMessageField = false;
result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
return this;
@@ -12879,11 +13961,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetStringPieceField(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasStringPieceField = true;
result.stringPieceField_ = value;
return this;
}
public Builder ClearStringPieceField() {
+ PrepareBuilder();
result.hasStringPieceField = false;
result.stringPieceField_ = "";
return this;
@@ -12898,18 +13982,20 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetCordField(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasCordField = true;
result.cordField_ = value;
return this;
}
public Builder ClearCordField() {
+ PrepareBuilder();
result.hasCordField = false;
result.cordField_ = "";
return this;
}
public pbc::IPopsicleList<int> RepeatedPrimitiveFieldList {
- get { return result.repeatedPrimitiveField_; }
+ get { return PrepareBuilder().repeatedPrimitiveField_; }
}
public int RepeatedPrimitiveFieldCount {
get { return result.RepeatedPrimitiveFieldCount; }
@@ -12918,24 +14004,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedPrimitiveField(index);
}
public Builder SetRepeatedPrimitiveField(int index, int value) {
+ PrepareBuilder();
result.repeatedPrimitiveField_[index] = value;
return this;
}
public Builder AddRepeatedPrimitiveField(int value) {
+ PrepareBuilder();
result.repeatedPrimitiveField_.Add(value);
return this;
}
public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedPrimitiveField_);
return this;
}
public Builder ClearRepeatedPrimitiveField() {
+ PrepareBuilder();
result.repeatedPrimitiveField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringFieldList {
- get { return result.repeatedStringField_; }
+ get { return PrepareBuilder().repeatedStringField_; }
}
public int RepeatedStringFieldCount {
get { return result.RepeatedStringFieldCount; }
@@ -12945,25 +14035,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedStringField(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringField_[index] = value;
return this;
}
public Builder AddRepeatedStringField(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringField_.Add(value);
return this;
}
public Builder AddRangeRepeatedStringField(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedStringField_);
return this;
}
public Builder ClearRepeatedStringField() {
+ PrepareBuilder();
result.repeatedStringField_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> RepeatedEnumFieldList {
- get { return result.repeatedEnumField_; }
+ get { return PrepareBuilder().repeatedEnumField_; }
}
public int RepeatedEnumFieldCount {
get { return result.RepeatedEnumFieldCount; }
@@ -12972,24 +14066,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedEnumField(index);
}
public Builder SetRepeatedEnumField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.repeatedEnumField_[index] = value;
return this;
}
public Builder AddRepeatedEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.repeatedEnumField_.Add(value);
return this;
}
public Builder AddRangeRepeatedEnumField(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedEnumField_);
return this;
}
public Builder ClearRepeatedEnumField() {
+ PrepareBuilder();
result.repeatedEnumField_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> RepeatedMessageFieldList {
- get { return result.repeatedMessageField_; }
+ get { return PrepareBuilder().repeatedMessageField_; }
}
public int RepeatedMessageFieldCount {
get { return result.RepeatedMessageFieldCount; }
@@ -12999,35 +14097,41 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedMessageField_[index] = value;
return this;
}
public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedMessageField_[index] = builderForValue.Build();
return this;
}
public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedMessageField_.Add(value);
return this;
}
public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.repeatedMessageField_.Add(builderForValue.Build());
return this;
}
public Builder AddRangeRepeatedMessageField(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignMessage> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedMessageField_);
return this;
}
public Builder ClearRepeatedMessageField() {
+ PrepareBuilder();
result.repeatedMessageField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedStringPieceFieldList {
- get { return result.repeatedStringPieceField_; }
+ get { return PrepareBuilder().repeatedStringPieceField_; }
}
public int RepeatedStringPieceFieldCount {
get { return result.RepeatedStringPieceFieldCount; }
@@ -13037,25 +14141,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedStringPieceField(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringPieceField_[index] = value;
return this;
}
public Builder AddRepeatedStringPieceField(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedStringPieceField_.Add(value);
return this;
}
public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedStringPieceField_);
return this;
}
public Builder ClearRepeatedStringPieceField() {
+ PrepareBuilder();
result.repeatedStringPieceField_.Clear();
return this;
}
public pbc::IPopsicleList<string> RepeatedCordFieldList {
- get { return result.repeatedCordField_; }
+ get { return PrepareBuilder().repeatedCordField_; }
}
public int RepeatedCordFieldCount {
get { return result.RepeatedCordFieldCount; }
@@ -13065,19 +14173,23 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedCordField(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedCordField_[index] = value;
return this;
}
public Builder AddRepeatedCordField(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedCordField_.Add(value);
return this;
}
public Builder AddRangeRepeatedCordField(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedCordField_);
return this;
}
public Builder ClearRepeatedCordField() {
+ PrepareBuilder();
result.repeatedCordField_.Clear();
return this;
}
@@ -13226,7 +14338,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestFieldOrderings prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -13236,21 +14348,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestFieldOrderings();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestFieldOrderings cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestFieldOrderings result;
+
+ private TestFieldOrderings PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestFieldOrderings original = result;
+ result = new TestFieldOrderings();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestFieldOrderings result = new TestFieldOrderings();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestFieldOrderings MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestFieldOrderings();
+ result = DefaultInstance ?? new TestFieldOrderings();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -13262,12 +14401,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestFieldOrderings BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestFieldOrderings returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -13281,6 +14419,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestFieldOrderings other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasMyString) {
MyString = other.MyString;
}
@@ -13300,6 +14439,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -13364,11 +14504,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetMyString(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasMyString = true;
result.myString_ = value;
return this;
}
public Builder ClearMyString() {
+ PrepareBuilder();
result.hasMyString = false;
result.myString_ = "";
return this;
@@ -13382,11 +14524,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetMyInt(value); }
}
public Builder SetMyInt(long value) {
+ PrepareBuilder();
result.hasMyInt = true;
result.myInt_ = value;
return this;
}
public Builder ClearMyInt() {
+ PrepareBuilder();
result.hasMyInt = false;
result.myInt_ = 0L;
return this;
@@ -13400,11 +14544,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetMyFloat(value); }
}
public Builder SetMyFloat(float value) {
+ PrepareBuilder();
result.hasMyFloat = true;
result.myFloat_ = value;
return this;
}
public Builder ClearMyFloat() {
+ PrepareBuilder();
result.hasMyFloat = false;
result.myFloat_ = 0F;
return this;
@@ -13807,7 +14953,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestExtremeDefaultValues prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -13817,21 +14963,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestExtremeDefaultValues();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestExtremeDefaultValues cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestExtremeDefaultValues result;
- TestExtremeDefaultValues result = new TestExtremeDefaultValues();
+ private TestExtremeDefaultValues PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestExtremeDefaultValues original = result;
+ result = new TestExtremeDefaultValues();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestExtremeDefaultValues MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestExtremeDefaultValues();
+ result = DefaultInstance ?? new TestExtremeDefaultValues();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -13843,12 +15016,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestExtremeDefaultValues BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestExtremeDefaultValues returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -13862,6 +15034,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestExtremeDefaultValues other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasEscapedBytes) {
EscapedBytes = other.EscapedBytes;
}
@@ -13928,6 +15101,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -14056,11 +15230,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetEscapedBytes(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasEscapedBytes = true;
result.escapedBytes_ = value;
return this;
}
public Builder ClearEscapedBytes() {
+ PrepareBuilder();
result.hasEscapedBytes = false;
result.escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue;
return this;
@@ -14076,11 +15252,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetLargeUint32(uint value) {
+ PrepareBuilder();
result.hasLargeUint32 = true;
result.largeUint32_ = value;
return this;
}
public Builder ClearLargeUint32() {
+ PrepareBuilder();
result.hasLargeUint32 = false;
result.largeUint32_ = 4294967295;
return this;
@@ -14096,11 +15274,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetLargeUint64(ulong value) {
+ PrepareBuilder();
result.hasLargeUint64 = true;
result.largeUint64_ = value;
return this;
}
public Builder ClearLargeUint64() {
+ PrepareBuilder();
result.hasLargeUint64 = false;
result.largeUint64_ = 18446744073709551615UL;
return this;
@@ -14114,11 +15294,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetSmallInt32(value); }
}
public Builder SetSmallInt32(int value) {
+ PrepareBuilder();
result.hasSmallInt32 = true;
result.smallInt32_ = value;
return this;
}
public Builder ClearSmallInt32() {
+ PrepareBuilder();
result.hasSmallInt32 = false;
result.smallInt32_ = -2147483647;
return this;
@@ -14132,11 +15314,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetSmallInt64(value); }
}
public Builder SetSmallInt64(long value) {
+ PrepareBuilder();
result.hasSmallInt64 = true;
result.smallInt64_ = value;
return this;
}
public Builder ClearSmallInt64() {
+ PrepareBuilder();
result.hasSmallInt64 = false;
result.smallInt64_ = -9223372036854775807L;
return this;
@@ -14151,11 +15335,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetUtf8String(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasUtf8String = true;
result.utf8String_ = value;
return this;
}
public Builder ClearUtf8String() {
+ PrepareBuilder();
result.hasUtf8String = false;
result.utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue;
return this;
@@ -14169,11 +15355,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetZeroFloat(value); }
}
public Builder SetZeroFloat(float value) {
+ PrepareBuilder();
result.hasZeroFloat = true;
result.zeroFloat_ = value;
return this;
}
public Builder ClearZeroFloat() {
+ PrepareBuilder();
result.hasZeroFloat = false;
result.zeroFloat_ = 0F;
return this;
@@ -14187,11 +15375,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetOneFloat(value); }
}
public Builder SetOneFloat(float value) {
+ PrepareBuilder();
result.hasOneFloat = true;
result.oneFloat_ = value;
return this;
}
public Builder ClearOneFloat() {
+ PrepareBuilder();
result.hasOneFloat = false;
result.oneFloat_ = 1F;
return this;
@@ -14205,11 +15395,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetSmallFloat(value); }
}
public Builder SetSmallFloat(float value) {
+ PrepareBuilder();
result.hasSmallFloat = true;
result.smallFloat_ = value;
return this;
}
public Builder ClearSmallFloat() {
+ PrepareBuilder();
result.hasSmallFloat = false;
result.smallFloat_ = 1.5F;
return this;
@@ -14223,11 +15415,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetNegativeOneFloat(value); }
}
public Builder SetNegativeOneFloat(float value) {
+ PrepareBuilder();
result.hasNegativeOneFloat = true;
result.negativeOneFloat_ = value;
return this;
}
public Builder ClearNegativeOneFloat() {
+ PrepareBuilder();
result.hasNegativeOneFloat = false;
result.negativeOneFloat_ = -1F;
return this;
@@ -14241,11 +15435,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetNegativeFloat(value); }
}
public Builder SetNegativeFloat(float value) {
+ PrepareBuilder();
result.hasNegativeFloat = true;
result.negativeFloat_ = value;
return this;
}
public Builder ClearNegativeFloat() {
+ PrepareBuilder();
result.hasNegativeFloat = false;
result.negativeFloat_ = -1.5F;
return this;
@@ -14259,11 +15455,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetLargeFloat(value); }
}
public Builder SetLargeFloat(float value) {
+ PrepareBuilder();
result.hasLargeFloat = true;
result.largeFloat_ = value;
return this;
}
public Builder ClearLargeFloat() {
+ PrepareBuilder();
result.hasLargeFloat = false;
result.largeFloat_ = 2E+08F;
return this;
@@ -14277,11 +15475,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetSmallNegativeFloat(value); }
}
public Builder SetSmallNegativeFloat(float value) {
+ PrepareBuilder();
result.hasSmallNegativeFloat = true;
result.smallNegativeFloat_ = value;
return this;
}
public Builder ClearSmallNegativeFloat() {
+ PrepareBuilder();
result.hasSmallNegativeFloat = false;
result.smallNegativeFloat_ = -8E-28F;
return this;
@@ -14295,11 +15495,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetInfDouble(value); }
}
public Builder SetInfDouble(double value) {
+ PrepareBuilder();
result.hasInfDouble = true;
result.infDouble_ = value;
return this;
}
public Builder ClearInfDouble() {
+ PrepareBuilder();
result.hasInfDouble = false;
result.infDouble_ = double.PositiveInfinity;
return this;
@@ -14313,11 +15515,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetNegInfDouble(value); }
}
public Builder SetNegInfDouble(double value) {
+ PrepareBuilder();
result.hasNegInfDouble = true;
result.negInfDouble_ = value;
return this;
}
public Builder ClearNegInfDouble() {
+ PrepareBuilder();
result.hasNegInfDouble = false;
result.negInfDouble_ = double.NegativeInfinity;
return this;
@@ -14331,11 +15535,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetNanDouble(value); }
}
public Builder SetNanDouble(double value) {
+ PrepareBuilder();
result.hasNanDouble = true;
result.nanDouble_ = value;
return this;
}
public Builder ClearNanDouble() {
+ PrepareBuilder();
result.hasNanDouble = false;
result.nanDouble_ = double.NaN;
return this;
@@ -14349,11 +15555,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetInfFloat(value); }
}
public Builder SetInfFloat(float value) {
+ PrepareBuilder();
result.hasInfFloat = true;
result.infFloat_ = value;
return this;
}
public Builder ClearInfFloat() {
+ PrepareBuilder();
result.hasInfFloat = false;
result.infFloat_ = float.PositiveInfinity;
return this;
@@ -14367,11 +15575,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetNegInfFloat(value); }
}
public Builder SetNegInfFloat(float value) {
+ PrepareBuilder();
result.hasNegInfFloat = true;
result.negInfFloat_ = value;
return this;
}
public Builder ClearNegInfFloat() {
+ PrepareBuilder();
result.hasNegInfFloat = false;
result.negInfFloat_ = float.NegativeInfinity;
return this;
@@ -14385,11 +15595,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetNanFloat(value); }
}
public Builder SetNanFloat(float value) {
+ PrepareBuilder();
result.hasNanFloat = true;
result.nanFloat_ = value;
return this;
}
public Builder ClearNanFloat() {
+ PrepareBuilder();
result.hasNanFloat = false;
result.nanFloat_ = float.NaN;
return this;
@@ -14502,7 +15714,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OneString prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -14512,21 +15724,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new OneString();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(OneString cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- OneString result = new OneString();
+ bool builderIsReadOnly;
+ OneString result;
+
+ private OneString PrepareBuilder() {
+ if (builderIsReadOnly) {
+ OneString original = result;
+ result = new OneString();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override OneString MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new OneString();
+ result = DefaultInstance ?? new OneString();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -14538,12 +15777,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OneString BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- OneString returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -14557,6 +15795,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OneString other) {
if (other == global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasData) {
Data = other.Data;
}
@@ -14569,6 +15808,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -14625,11 +15865,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetData(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasData = true;
result.data_ = value;
return this;
}
public Builder ClearData() {
+ PrepareBuilder();
result.hasData = false;
result.data_ = "";
return this;
@@ -14742,7 +15984,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(OneBytes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -14752,21 +15994,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new OneBytes();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(OneBytes cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- OneBytes result = new OneBytes();
+ bool builderIsReadOnly;
+ OneBytes result;
+
+ private OneBytes PrepareBuilder() {
+ if (builderIsReadOnly) {
+ OneBytes original = result;
+ result = new OneBytes();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override OneBytes MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new OneBytes();
+ result = DefaultInstance ?? new OneBytes();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -14778,12 +16047,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override OneBytes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- OneBytes returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -14797,6 +16065,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(OneBytes other) {
if (other == global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasData) {
Data = other.Data;
}
@@ -14809,6 +16078,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -14865,11 +16135,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetData(pb::ByteString value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasData = true;
result.data_ = value;
return this;
}
public Builder ClearData() {
+ PrepareBuilder();
result.hasData = false;
result.data_ = pb::ByteString.Empty;
return this;
@@ -15339,7 +16611,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestPackedTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -15349,21 +16621,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestPackedTypes();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestPackedTypes cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestPackedTypes result = new TestPackedTypes();
+ bool builderIsReadOnly;
+ TestPackedTypes result;
+
+ private TestPackedTypes PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestPackedTypes original = result;
+ result = new TestPackedTypes();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestPackedTypes MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestPackedTypes();
+ result = DefaultInstance ?? new TestPackedTypes();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -15375,8 +16674,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestPackedTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.packedInt32_.MakeReadOnly();
result.packedInt64_.MakeReadOnly();
@@ -15392,9 +16691,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.packedDouble_.MakeReadOnly();
result.packedBool_.MakeReadOnly();
result.packedEnum_.MakeReadOnly();
- TestPackedTypes returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -15408,6 +16706,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestPackedTypes other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this;
+ PrepareBuilder();
if (other.packedInt32_.Count != 0) {
base.AddRange(other.packedInt32_, result.packedInt32_);
}
@@ -15459,6 +16758,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -15582,7 +16882,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public pbc::IPopsicleList<int> PackedInt32List {
- get { return result.packedInt32_; }
+ get { return PrepareBuilder().packedInt32_; }
}
public int PackedInt32Count {
get { return result.PackedInt32Count; }
@@ -15591,24 +16891,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedInt32(index);
}
public Builder SetPackedInt32(int index, int value) {
+ PrepareBuilder();
result.packedInt32_[index] = value;
return this;
}
public Builder AddPackedInt32(int value) {
+ PrepareBuilder();
result.packedInt32_.Add(value);
return this;
}
public Builder AddRangePackedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedInt32_);
return this;
}
public Builder ClearPackedInt32() {
+ PrepareBuilder();
result.packedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedInt64List {
- get { return result.packedInt64_; }
+ get { return PrepareBuilder().packedInt64_; }
}
public int PackedInt64Count {
get { return result.PackedInt64Count; }
@@ -15617,25 +16921,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedInt64(index);
}
public Builder SetPackedInt64(int index, long value) {
+ PrepareBuilder();
result.packedInt64_[index] = value;
return this;
}
public Builder AddPackedInt64(long value) {
+ PrepareBuilder();
result.packedInt64_.Add(value);
return this;
}
public Builder AddRangePackedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedInt64_);
return this;
}
public Builder ClearPackedInt64() {
+ PrepareBuilder();
result.packedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedUint32List {
- get { return result.packedUint32_; }
+ get { return PrepareBuilder().packedUint32_; }
}
public int PackedUint32Count {
get { return result.PackedUint32Count; }
@@ -15646,27 +16954,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedUint32(int index, uint value) {
+ PrepareBuilder();
result.packedUint32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedUint32(uint value) {
+ PrepareBuilder();
result.packedUint32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedUint32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedUint32_);
return this;
}
public Builder ClearPackedUint32() {
+ PrepareBuilder();
result.packedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedUint64List {
- get { return result.packedUint64_; }
+ get { return PrepareBuilder().packedUint64_; }
}
public int PackedUint64Count {
get { return result.PackedUint64Count; }
@@ -15677,26 +16989,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedUint64(int index, ulong value) {
+ PrepareBuilder();
result.packedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedUint64(ulong value) {
+ PrepareBuilder();
result.packedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedUint64_);
return this;
}
public Builder ClearPackedUint64() {
+ PrepareBuilder();
result.packedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSint32List {
- get { return result.packedSint32_; }
+ get { return PrepareBuilder().packedSint32_; }
}
public int PackedSint32Count {
get { return result.PackedSint32Count; }
@@ -15705,24 +17021,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSint32(index);
}
public Builder SetPackedSint32(int index, int value) {
+ PrepareBuilder();
result.packedSint32_[index] = value;
return this;
}
public Builder AddPackedSint32(int value) {
+ PrepareBuilder();
result.packedSint32_.Add(value);
return this;
}
public Builder AddRangePackedSint32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSint32_);
return this;
}
public Builder ClearPackedSint32() {
+ PrepareBuilder();
result.packedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSint64List {
- get { return result.packedSint64_; }
+ get { return PrepareBuilder().packedSint64_; }
}
public int PackedSint64Count {
get { return result.PackedSint64Count; }
@@ -15731,25 +17051,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSint64(index);
}
public Builder SetPackedSint64(int index, long value) {
+ PrepareBuilder();
result.packedSint64_[index] = value;
return this;
}
public Builder AddPackedSint64(long value) {
+ PrepareBuilder();
result.packedSint64_.Add(value);
return this;
}
public Builder AddRangePackedSint64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSint64_);
return this;
}
public Builder ClearPackedSint64() {
+ PrepareBuilder();
result.packedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> PackedFixed32List {
- get { return result.packedFixed32_; }
+ get { return PrepareBuilder().packedFixed32_; }
}
public int PackedFixed32Count {
get { return result.PackedFixed32Count; }
@@ -15760,27 +17084,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedFixed32(int index, uint value) {
+ PrepareBuilder();
result.packedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedFixed32(uint value) {
+ PrepareBuilder();
result.packedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedFixed32_);
return this;
}
public Builder ClearPackedFixed32() {
+ PrepareBuilder();
result.packedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> PackedFixed64List {
- get { return result.packedFixed64_; }
+ get { return PrepareBuilder().packedFixed64_; }
}
public int PackedFixed64Count {
get { return result.PackedFixed64Count; }
@@ -15791,26 +17119,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetPackedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.packedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddPackedFixed64(ulong value) {
+ PrepareBuilder();
result.packedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangePackedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedFixed64_);
return this;
}
public Builder ClearPackedFixed64() {
+ PrepareBuilder();
result.packedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedSfixed32List {
- get { return result.packedSfixed32_; }
+ get { return PrepareBuilder().packedSfixed32_; }
}
public int PackedSfixed32Count {
get { return result.PackedSfixed32Count; }
@@ -15819,24 +17151,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSfixed32(index);
}
public Builder SetPackedSfixed32(int index, int value) {
+ PrepareBuilder();
result.packedSfixed32_[index] = value;
return this;
}
public Builder AddPackedSfixed32(int value) {
+ PrepareBuilder();
result.packedSfixed32_.Add(value);
return this;
}
public Builder AddRangePackedSfixed32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSfixed32_);
return this;
}
public Builder ClearPackedSfixed32() {
+ PrepareBuilder();
result.packedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> PackedSfixed64List {
- get { return result.packedSfixed64_; }
+ get { return PrepareBuilder().packedSfixed64_; }
}
public int PackedSfixed64Count {
get { return result.PackedSfixed64Count; }
@@ -15845,24 +17181,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedSfixed64(index);
}
public Builder SetPackedSfixed64(int index, long value) {
+ PrepareBuilder();
result.packedSfixed64_[index] = value;
return this;
}
public Builder AddPackedSfixed64(long value) {
+ PrepareBuilder();
result.packedSfixed64_.Add(value);
return this;
}
public Builder AddRangePackedSfixed64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedSfixed64_);
return this;
}
public Builder ClearPackedSfixed64() {
+ PrepareBuilder();
result.packedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> PackedFloatList {
- get { return result.packedFloat_; }
+ get { return PrepareBuilder().packedFloat_; }
}
public int PackedFloatCount {
get { return result.PackedFloatCount; }
@@ -15871,24 +17211,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedFloat(index);
}
public Builder SetPackedFloat(int index, float value) {
+ PrepareBuilder();
result.packedFloat_[index] = value;
return this;
}
public Builder AddPackedFloat(float value) {
+ PrepareBuilder();
result.packedFloat_.Add(value);
return this;
}
public Builder AddRangePackedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedFloat_);
return this;
}
public Builder ClearPackedFloat() {
+ PrepareBuilder();
result.packedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> PackedDoubleList {
- get { return result.packedDouble_; }
+ get { return PrepareBuilder().packedDouble_; }
}
public int PackedDoubleCount {
get { return result.PackedDoubleCount; }
@@ -15897,24 +17241,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedDouble(index);
}
public Builder SetPackedDouble(int index, double value) {
+ PrepareBuilder();
result.packedDouble_[index] = value;
return this;
}
public Builder AddPackedDouble(double value) {
+ PrepareBuilder();
result.packedDouble_.Add(value);
return this;
}
public Builder AddRangePackedDouble(scg::IEnumerable<double> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedDouble_);
return this;
}
public Builder ClearPackedDouble() {
+ PrepareBuilder();
result.packedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> PackedBoolList {
- get { return result.packedBool_; }
+ get { return PrepareBuilder().packedBool_; }
}
public int PackedBoolCount {
get { return result.PackedBoolCount; }
@@ -15923,24 +17271,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedBool(index);
}
public Builder SetPackedBool(int index, bool value) {
+ PrepareBuilder();
result.packedBool_[index] = value;
return this;
}
public Builder AddPackedBool(bool value) {
+ PrepareBuilder();
result.packedBool_.Add(value);
return this;
}
public Builder AddRangePackedBool(scg::IEnumerable<bool> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedBool_);
return this;
}
public Builder ClearPackedBool() {
+ PrepareBuilder();
result.packedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> PackedEnumList {
- get { return result.packedEnum_; }
+ get { return PrepareBuilder().packedEnum_; }
}
public int PackedEnumCount {
get { return result.PackedEnumCount; }
@@ -15949,18 +17301,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedEnum(index);
}
public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.packedEnum_[index] = value;
return this;
}
public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.packedEnum_.Add(value);
return this;
}
public Builder AddRangePackedEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedEnum_);
return this;
}
public Builder ClearPackedEnum() {
+ PrepareBuilder();
result.packedEnum_.Clear();
return this;
}
@@ -16374,7 +17730,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestUnpackedTypes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -16384,21 +17740,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestUnpackedTypes();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestUnpackedTypes cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestUnpackedTypes result;
+
+ private TestUnpackedTypes PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestUnpackedTypes original = result;
+ result = new TestUnpackedTypes();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestUnpackedTypes result = new TestUnpackedTypes();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestUnpackedTypes MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestUnpackedTypes();
+ result = DefaultInstance ?? new TestUnpackedTypes();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -16410,8 +17793,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestUnpackedTypes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.unpackedInt32_.MakeReadOnly();
result.unpackedInt64_.MakeReadOnly();
@@ -16427,9 +17810,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.unpackedDouble_.MakeReadOnly();
result.unpackedBool_.MakeReadOnly();
result.unpackedEnum_.MakeReadOnly();
- TestUnpackedTypes returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -16443,6 +17825,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestUnpackedTypes other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this;
+ PrepareBuilder();
if (other.unpackedInt32_.Count != 0) {
base.AddRange(other.unpackedInt32_, result.unpackedInt32_);
}
@@ -16494,6 +17877,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -16617,7 +18001,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public pbc::IPopsicleList<int> UnpackedInt32List {
- get { return result.unpackedInt32_; }
+ get { return PrepareBuilder().unpackedInt32_; }
}
public int UnpackedInt32Count {
get { return result.UnpackedInt32Count; }
@@ -16626,24 +18010,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedInt32(index);
}
public Builder SetUnpackedInt32(int index, int value) {
+ PrepareBuilder();
result.unpackedInt32_[index] = value;
return this;
}
public Builder AddUnpackedInt32(int value) {
+ PrepareBuilder();
result.unpackedInt32_.Add(value);
return this;
}
public Builder AddRangeUnpackedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedInt32_);
return this;
}
public Builder ClearUnpackedInt32() {
+ PrepareBuilder();
result.unpackedInt32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedInt64List {
- get { return result.unpackedInt64_; }
+ get { return PrepareBuilder().unpackedInt64_; }
}
public int UnpackedInt64Count {
get { return result.UnpackedInt64Count; }
@@ -16652,25 +18040,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedInt64(index);
}
public Builder SetUnpackedInt64(int index, long value) {
+ PrepareBuilder();
result.unpackedInt64_[index] = value;
return this;
}
public Builder AddUnpackedInt64(long value) {
+ PrepareBuilder();
result.unpackedInt64_.Add(value);
return this;
}
public Builder AddRangeUnpackedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedInt64_);
return this;
}
public Builder ClearUnpackedInt64() {
+ PrepareBuilder();
result.unpackedInt64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedUint32List {
- get { return result.unpackedUint32_; }
+ get { return PrepareBuilder().unpackedUint32_; }
}
public int UnpackedUint32Count {
get { return result.UnpackedUint32Count; }
@@ -16681,27 +18073,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedUint32(int index, uint value) {
+ PrepareBuilder();
result.unpackedUint32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedUint32(uint value) {
+ PrepareBuilder();
result.unpackedUint32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedUint32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedUint32_);
return this;
}
public Builder ClearUnpackedUint32() {
+ PrepareBuilder();
result.unpackedUint32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedUint64List {
- get { return result.unpackedUint64_; }
+ get { return PrepareBuilder().unpackedUint64_; }
}
public int UnpackedUint64Count {
get { return result.UnpackedUint64Count; }
@@ -16712,26 +18108,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedUint64(int index, ulong value) {
+ PrepareBuilder();
result.unpackedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedUint64(ulong value) {
+ PrepareBuilder();
result.unpackedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedUint64_);
return this;
}
public Builder ClearUnpackedUint64() {
+ PrepareBuilder();
result.unpackedUint64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSint32List {
- get { return result.unpackedSint32_; }
+ get { return PrepareBuilder().unpackedSint32_; }
}
public int UnpackedSint32Count {
get { return result.UnpackedSint32Count; }
@@ -16740,24 +18140,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSint32(index);
}
public Builder SetUnpackedSint32(int index, int value) {
+ PrepareBuilder();
result.unpackedSint32_[index] = value;
return this;
}
public Builder AddUnpackedSint32(int value) {
+ PrepareBuilder();
result.unpackedSint32_.Add(value);
return this;
}
public Builder AddRangeUnpackedSint32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSint32_);
return this;
}
public Builder ClearUnpackedSint32() {
+ PrepareBuilder();
result.unpackedSint32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSint64List {
- get { return result.unpackedSint64_; }
+ get { return PrepareBuilder().unpackedSint64_; }
}
public int UnpackedSint64Count {
get { return result.UnpackedSint64Count; }
@@ -16766,25 +18170,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSint64(index);
}
public Builder SetUnpackedSint64(int index, long value) {
+ PrepareBuilder();
result.unpackedSint64_[index] = value;
return this;
}
public Builder AddUnpackedSint64(long value) {
+ PrepareBuilder();
result.unpackedSint64_.Add(value);
return this;
}
public Builder AddRangeUnpackedSint64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSint64_);
return this;
}
public Builder ClearUnpackedSint64() {
+ PrepareBuilder();
result.unpackedSint64_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedFixed32List {
- get { return result.unpackedFixed32_; }
+ get { return PrepareBuilder().unpackedFixed32_; }
}
public int UnpackedFixed32Count {
get { return result.UnpackedFixed32Count; }
@@ -16795,27 +18203,31 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedFixed32(int index, uint value) {
+ PrepareBuilder();
result.unpackedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedFixed32(uint value) {
+ PrepareBuilder();
result.unpackedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedFixed32_);
return this;
}
public Builder ClearUnpackedFixed32() {
+ PrepareBuilder();
result.unpackedFixed32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedFixed64List {
- get { return result.unpackedFixed64_; }
+ get { return PrepareBuilder().unpackedFixed64_; }
}
public int UnpackedFixed64Count {
get { return result.UnpackedFixed64Count; }
@@ -16826,26 +18238,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetUnpackedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.unpackedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddUnpackedFixed64(ulong value) {
+ PrepareBuilder();
result.unpackedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedFixed64_);
return this;
}
public Builder ClearUnpackedFixed64() {
+ PrepareBuilder();
result.unpackedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<int> UnpackedSfixed32List {
- get { return result.unpackedSfixed32_; }
+ get { return PrepareBuilder().unpackedSfixed32_; }
}
public int UnpackedSfixed32Count {
get { return result.UnpackedSfixed32Count; }
@@ -16854,24 +18270,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSfixed32(index);
}
public Builder SetUnpackedSfixed32(int index, int value) {
+ PrepareBuilder();
result.unpackedSfixed32_[index] = value;
return this;
}
public Builder AddUnpackedSfixed32(int value) {
+ PrepareBuilder();
result.unpackedSfixed32_.Add(value);
return this;
}
public Builder AddRangeUnpackedSfixed32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSfixed32_);
return this;
}
public Builder ClearUnpackedSfixed32() {
+ PrepareBuilder();
result.unpackedSfixed32_.Clear();
return this;
}
public pbc::IPopsicleList<long> UnpackedSfixed64List {
- get { return result.unpackedSfixed64_; }
+ get { return PrepareBuilder().unpackedSfixed64_; }
}
public int UnpackedSfixed64Count {
get { return result.UnpackedSfixed64Count; }
@@ -16880,24 +18300,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedSfixed64(index);
}
public Builder SetUnpackedSfixed64(int index, long value) {
+ PrepareBuilder();
result.unpackedSfixed64_[index] = value;
return this;
}
public Builder AddUnpackedSfixed64(long value) {
+ PrepareBuilder();
result.unpackedSfixed64_.Add(value);
return this;
}
public Builder AddRangeUnpackedSfixed64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedSfixed64_);
return this;
}
public Builder ClearUnpackedSfixed64() {
+ PrepareBuilder();
result.unpackedSfixed64_.Clear();
return this;
}
public pbc::IPopsicleList<float> UnpackedFloatList {
- get { return result.unpackedFloat_; }
+ get { return PrepareBuilder().unpackedFloat_; }
}
public int UnpackedFloatCount {
get { return result.UnpackedFloatCount; }
@@ -16906,24 +18330,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedFloat(index);
}
public Builder SetUnpackedFloat(int index, float value) {
+ PrepareBuilder();
result.unpackedFloat_[index] = value;
return this;
}
public Builder AddUnpackedFloat(float value) {
+ PrepareBuilder();
result.unpackedFloat_.Add(value);
return this;
}
public Builder AddRangeUnpackedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedFloat_);
return this;
}
public Builder ClearUnpackedFloat() {
+ PrepareBuilder();
result.unpackedFloat_.Clear();
return this;
}
public pbc::IPopsicleList<double> UnpackedDoubleList {
- get { return result.unpackedDouble_; }
+ get { return PrepareBuilder().unpackedDouble_; }
}
public int UnpackedDoubleCount {
get { return result.UnpackedDoubleCount; }
@@ -16932,24 +18360,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedDouble(index);
}
public Builder SetUnpackedDouble(int index, double value) {
+ PrepareBuilder();
result.unpackedDouble_[index] = value;
return this;
}
public Builder AddUnpackedDouble(double value) {
+ PrepareBuilder();
result.unpackedDouble_.Add(value);
return this;
}
public Builder AddRangeUnpackedDouble(scg::IEnumerable<double> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedDouble_);
return this;
}
public Builder ClearUnpackedDouble() {
+ PrepareBuilder();
result.unpackedDouble_.Clear();
return this;
}
public pbc::IPopsicleList<bool> UnpackedBoolList {
- get { return result.unpackedBool_; }
+ get { return PrepareBuilder().unpackedBool_; }
}
public int UnpackedBoolCount {
get { return result.UnpackedBoolCount; }
@@ -16958,24 +18390,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedBool(index);
}
public Builder SetUnpackedBool(int index, bool value) {
+ PrepareBuilder();
result.unpackedBool_[index] = value;
return this;
}
public Builder AddUnpackedBool(bool value) {
+ PrepareBuilder();
result.unpackedBool_.Add(value);
return this;
}
public Builder AddRangeUnpackedBool(scg::IEnumerable<bool> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedBool_);
return this;
}
public Builder ClearUnpackedBool() {
+ PrepareBuilder();
result.unpackedBool_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> UnpackedEnumList {
- get { return result.unpackedEnum_; }
+ get { return PrepareBuilder().unpackedEnum_; }
}
public int UnpackedEnumCount {
get { return result.UnpackedEnumCount; }
@@ -16984,18 +18420,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetUnpackedEnum(index);
}
public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.unpackedEnum_[index] = value;
return this;
}
public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.unpackedEnum_.Add(value);
return this;
}
public Builder AddRangeUnpackedEnum(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.ForeignEnum> values) {
+ PrepareBuilder();
base.AddRange(values, result.unpackedEnum_);
return this;
}
public Builder ClearUnpackedEnum() {
+ PrepareBuilder();
result.unpackedEnum_.Clear();
return this;
}
@@ -17095,7 +18535,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestPackedExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17105,21 +18545,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestPackedExtensions();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestPackedExtensions cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestPackedExtensions result;
+
+ private TestPackedExtensions PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestPackedExtensions original = result;
+ result = new TestPackedExtensions();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestPackedExtensions result = new TestPackedExtensions();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestPackedExtensions MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestPackedExtensions();
+ result = DefaultInstance ?? new TestPackedExtensions();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17131,12 +18598,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestPackedExtensions BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestPackedExtensions returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17150,6 +18616,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestPackedExtensions other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -17160,6 +18627,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -17298,7 +18766,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestUnpackedExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17308,21 +18776,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestUnpackedExtensions();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestUnpackedExtensions cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestUnpackedExtensions result;
+
+ private TestUnpackedExtensions PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestUnpackedExtensions original = result;
+ result = new TestUnpackedExtensions();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestUnpackedExtensions result = new TestUnpackedExtensions();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestUnpackedExtensions MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestUnpackedExtensions();
+ result = DefaultInstance ?? new TestUnpackedExtensions();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17334,12 +18829,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestUnpackedExtensions BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- TestUnpackedExtensions returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17353,6 +18847,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestUnpackedExtensions other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensions.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeExtensionFields(other);
this.MergeUnknownFields(other.UnknownFields);
return this;
@@ -17363,6 +18858,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -17553,7 +19049,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(DynamicMessageType prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17563,21 +19059,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new DynamicMessageType();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(DynamicMessageType cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ DynamicMessageType result;
- DynamicMessageType result = new DynamicMessageType();
+ private DynamicMessageType PrepareBuilder() {
+ if (builderIsReadOnly) {
+ DynamicMessageType original = result;
+ result = new DynamicMessageType();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override DynamicMessageType MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new DynamicMessageType();
+ result = DefaultInstance ?? new DynamicMessageType();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17589,12 +19112,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override DynamicMessageType BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- DynamicMessageType returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17608,6 +19130,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(DynamicMessageType other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasDynamicField) {
DynamicField = other.DynamicField;
}
@@ -17620,6 +19143,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -17675,11 +19199,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDynamicField(value); }
}
public Builder SetDynamicField(int value) {
+ PrepareBuilder();
result.hasDynamicField = true;
result.dynamicField_ = value;
return this;
}
public Builder ClearDynamicField() {
+ PrepareBuilder();
result.hasDynamicField = false;
result.dynamicField_ = 0;
return this;
@@ -17883,7 +19409,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestDynamicExtensions prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -17893,21 +19419,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestDynamicExtensions();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestDynamicExtensions cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- TestDynamicExtensions result = new TestDynamicExtensions();
+ bool builderIsReadOnly;
+ TestDynamicExtensions result;
+
+ private TestDynamicExtensions PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestDynamicExtensions original = result;
+ result = new TestDynamicExtensions();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestDynamicExtensions MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestDynamicExtensions();
+ result = DefaultInstance ?? new TestDynamicExtensions();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -17919,14 +19472,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestDynamicExtensions BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.repeatedExtension_.MakeReadOnly();
result.packedExtension_.MakeReadOnly();
- TestDynamicExtensions returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -17940,6 +19492,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestDynamicExtensions other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance) return this;
+ PrepareBuilder();
if (other.HasScalarExtension) {
ScalarExtension = other.ScalarExtension;
}
@@ -17970,6 +19523,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -18078,11 +19632,13 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetScalarExtension(uint value) {
+ PrepareBuilder();
result.hasScalarExtension = true;
result.scalarExtension_ = value;
return this;
}
public Builder ClearScalarExtension() {
+ PrepareBuilder();
result.hasScalarExtension = false;
result.scalarExtension_ = 0;
return this;
@@ -18096,11 +19652,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetEnumExtension(value); }
}
public Builder SetEnumExtension(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) {
+ PrepareBuilder();
result.hasEnumExtension = true;
result.enumExtension_ = value;
return this;
}
public Builder ClearEnumExtension() {
+ PrepareBuilder();
result.hasEnumExtension = false;
result.enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO;
return this;
@@ -18114,11 +19672,13 @@ namespace Google.ProtocolBuffers.TestProtos {
set { SetDynamicEnumExtension(value); }
}
public Builder SetDynamicEnumExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType value) {
+ PrepareBuilder();
result.hasDynamicEnumExtension = true;
result.dynamicEnumExtension_ = value;
return this;
}
public Builder ClearDynamicEnumExtension() {
+ PrepareBuilder();
result.hasDynamicEnumExtension = false;
result.dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO;
return this;
@@ -18133,18 +19693,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasMessageExtension = true;
result.messageExtension_ = value;
return this;
}
public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasMessageExtension = true;
result.messageExtension_ = builderForValue.Build();
return this;
}
public Builder MergeMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasMessageExtension &&
result.messageExtension_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) {
result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageExtension_).MergeFrom(value).BuildPartial();
@@ -18155,6 +19718,7 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearMessageExtension() {
+ PrepareBuilder();
result.hasMessageExtension = false;
result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance;
return this;
@@ -18169,18 +19733,21 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.hasDynamicMessageExtension = true;
result.dynamicMessageExtension_ = value;
return this;
}
public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder builderForValue) {
pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
+ PrepareBuilder();
result.hasDynamicMessageExtension = true;
result.dynamicMessageExtension_ = builderForValue.Build();
return this;
}
public Builder MergeDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
if (result.hasDynamicMessageExtension &&
result.dynamicMessageExtension_ != global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) {
result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(result.dynamicMessageExtension_).MergeFrom(value).BuildPartial();
@@ -18191,13 +19758,14 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
public Builder ClearDynamicMessageExtension() {
+ PrepareBuilder();
result.hasDynamicMessageExtension = false;
result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance;
return this;
}
public pbc::IPopsicleList<string> RepeatedExtensionList {
- get { return result.repeatedExtension_; }
+ get { return PrepareBuilder().repeatedExtension_; }
}
public int RepeatedExtensionCount {
get { return result.RepeatedExtensionCount; }
@@ -18207,25 +19775,29 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public Builder SetRepeatedExtension(int index, string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedExtension_[index] = value;
return this;
}
public Builder AddRepeatedExtension(string value) {
pb::ThrowHelper.ThrowIfNull(value, "value");
+ PrepareBuilder();
result.repeatedExtension_.Add(value);
return this;
}
public Builder AddRangeRepeatedExtension(scg::IEnumerable<string> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedExtension_);
return this;
}
public Builder ClearRepeatedExtension() {
+ PrepareBuilder();
result.repeatedExtension_.Clear();
return this;
}
public pbc::IPopsicleList<int> PackedExtensionList {
- get { return result.packedExtension_; }
+ get { return PrepareBuilder().packedExtension_; }
}
public int PackedExtensionCount {
get { return result.PackedExtensionCount; }
@@ -18234,18 +19806,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetPackedExtension(index);
}
public Builder SetPackedExtension(int index, int value) {
+ PrepareBuilder();
result.packedExtension_[index] = value;
return this;
}
public Builder AddPackedExtension(int value) {
+ PrepareBuilder();
result.packedExtension_.Add(value);
return this;
}
public Builder AddRangePackedExtension(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.packedExtension_);
return this;
}
public Builder ClearPackedExtension() {
+ PrepareBuilder();
result.packedExtension_.Clear();
return this;
}
@@ -18479,7 +20055,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -18489,21 +20065,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ TestRepeatedScalarDifferentTagSizes result;
+
+ private TestRepeatedScalarDifferentTagSizes PrepareBuilder() {
+ if (builderIsReadOnly) {
+ TestRepeatedScalarDifferentTagSizes original = result;
+ result = new TestRepeatedScalarDifferentTagSizes();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- TestRepeatedScalarDifferentTagSizes result = new TestRepeatedScalarDifferentTagSizes();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override TestRepeatedScalarDifferentTagSizes MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new TestRepeatedScalarDifferentTagSizes();
+ result = DefaultInstance ?? new TestRepeatedScalarDifferentTagSizes();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -18515,8 +20118,8 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override TestRepeatedScalarDifferentTagSizes BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
result.repeatedFixed32_.MakeReadOnly();
result.repeatedInt32_.MakeReadOnly();
@@ -18524,9 +20127,8 @@ namespace Google.ProtocolBuffers.TestProtos {
result.repeatedInt64_.MakeReadOnly();
result.repeatedFloat_.MakeReadOnly();
result.repeatedUint64_.MakeReadOnly();
- TestRepeatedScalarDifferentTagSizes returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -18540,6 +20142,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) {
if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this;
+ PrepareBuilder();
if (other.repeatedFixed32_.Count != 0) {
base.AddRange(other.repeatedFixed32_, result.repeatedFixed32_);
}
@@ -18567,6 +20170,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -18642,7 +20246,7 @@ namespace Google.ProtocolBuffers.TestProtos {
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> RepeatedFixed32List {
- get { return result.repeatedFixed32_; }
+ get { return PrepareBuilder().repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
@@ -18653,26 +20257,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed32(int index, uint value) {
+ PrepareBuilder();
result.repeatedFixed32_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed32(uint value) {
+ PrepareBuilder();
result.repeatedFixed32_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed32(scg::IEnumerable<uint> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFixed32_);
return this;
}
public Builder ClearRepeatedFixed32() {
+ PrepareBuilder();
result.repeatedFixed32_.Clear();
return this;
}
public pbc::IPopsicleList<int> RepeatedInt32List {
- get { return result.repeatedInt32_; }
+ get { return PrepareBuilder().repeatedInt32_; }
}
public int RepeatedInt32Count {
get { return result.RepeatedInt32Count; }
@@ -18681,25 +20289,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedInt32(index);
}
public Builder SetRepeatedInt32(int index, int value) {
+ PrepareBuilder();
result.repeatedInt32_[index] = value;
return this;
}
public Builder AddRepeatedInt32(int value) {
+ PrepareBuilder();
result.repeatedInt32_.Add(value);
return this;
}
public Builder AddRangeRepeatedInt32(scg::IEnumerable<int> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedInt32_);
return this;
}
public Builder ClearRepeatedInt32() {
+ PrepareBuilder();
result.repeatedInt32_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedFixed64List {
- get { return result.repeatedFixed64_; }
+ get { return PrepareBuilder().repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
@@ -18710,26 +20322,30 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed64(int index, ulong value) {
+ PrepareBuilder();
result.repeatedFixed64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed64(ulong value) {
+ PrepareBuilder();
result.repeatedFixed64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFixed64_);
return this;
}
public Builder ClearRepeatedFixed64() {
+ PrepareBuilder();
result.repeatedFixed64_.Clear();
return this;
}
public pbc::IPopsicleList<long> RepeatedInt64List {
- get { return result.repeatedInt64_; }
+ get { return PrepareBuilder().repeatedInt64_; }
}
public int RepeatedInt64Count {
get { return result.RepeatedInt64Count; }
@@ -18738,24 +20354,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedInt64(index);
}
public Builder SetRepeatedInt64(int index, long value) {
+ PrepareBuilder();
result.repeatedInt64_[index] = value;
return this;
}
public Builder AddRepeatedInt64(long value) {
+ PrepareBuilder();
result.repeatedInt64_.Add(value);
return this;
}
public Builder AddRangeRepeatedInt64(scg::IEnumerable<long> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedInt64_);
return this;
}
public Builder ClearRepeatedInt64() {
+ PrepareBuilder();
result.repeatedInt64_.Clear();
return this;
}
public pbc::IPopsicleList<float> RepeatedFloatList {
- get { return result.repeatedFloat_; }
+ get { return PrepareBuilder().repeatedFloat_; }
}
public int RepeatedFloatCount {
get { return result.RepeatedFloatCount; }
@@ -18764,25 +20384,29 @@ namespace Google.ProtocolBuffers.TestProtos {
return result.GetRepeatedFloat(index);
}
public Builder SetRepeatedFloat(int index, float value) {
+ PrepareBuilder();
result.repeatedFloat_[index] = value;
return this;
}
public Builder AddRepeatedFloat(float value) {
+ PrepareBuilder();
result.repeatedFloat_.Add(value);
return this;
}
public Builder AddRangeRepeatedFloat(scg::IEnumerable<float> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedFloat_);
return this;
}
public Builder ClearRepeatedFloat() {
+ PrepareBuilder();
result.repeatedFloat_.Clear();
return this;
}
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> RepeatedUint64List {
- get { return result.repeatedUint64_; }
+ get { return PrepareBuilder().repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
@@ -18793,20 +20417,24 @@ namespace Google.ProtocolBuffers.TestProtos {
}
[global::System.CLSCompliant(false)]
public Builder SetRepeatedUint64(int index, ulong value) {
+ PrepareBuilder();
result.repeatedUint64_[index] = value;
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRepeatedUint64(ulong value) {
+ PrepareBuilder();
result.repeatedUint64_.Add(value);
return this;
}
[global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint64(scg::IEnumerable<ulong> values) {
+ PrepareBuilder();
base.AddRange(values, result.repeatedUint64_);
return this;
}
public Builder ClearRepeatedUint64() {
+ PrepareBuilder();
result.repeatedUint64_.Clear();
return this;
}
@@ -18902,7 +20530,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(FooRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -18912,21 +20540,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new FooRequest();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(FooRequest cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- FooRequest result = new FooRequest();
+ bool builderIsReadOnly;
+ FooRequest result;
+
+ private FooRequest PrepareBuilder() {
+ if (builderIsReadOnly) {
+ FooRequest original = result;
+ result = new FooRequest();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override FooRequest MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new FooRequest();
+ result = DefaultInstance ?? new FooRequest();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -18938,12 +20593,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override FooRequest BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- FooRequest returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -18957,6 +20611,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(FooRequest other) {
if (other == global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -18966,6 +20621,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -19100,7 +20756,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(FooResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19110,21 +20766,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new FooResponse();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(FooResponse cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ FooResponse result;
+
+ private FooResponse PrepareBuilder() {
+ if (builderIsReadOnly) {
+ FooResponse original = result;
+ result = new FooResponse();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- FooResponse result = new FooResponse();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override FooResponse MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new FooResponse();
+ result = DefaultInstance ?? new FooResponse();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19136,12 +20819,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override FooResponse BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- FooResponse returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19155,6 +20837,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(FooResponse other) {
if (other == global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -19164,6 +20847,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -19298,7 +20982,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(BarRequest prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19308,21 +20992,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new BarRequest();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(BarRequest cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
+
+ bool builderIsReadOnly;
+ BarRequest result;
+
+ private BarRequest PrepareBuilder() {
+ if (builderIsReadOnly) {
+ BarRequest original = result;
+ result = new BarRequest();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
- BarRequest result = new BarRequest();
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override BarRequest MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new BarRequest();
+ result = DefaultInstance ?? new BarRequest();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19334,12 +21045,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override BarRequest BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- BarRequest returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19353,6 +21063,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(BarRequest other) {
if (other == global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -19362,6 +21073,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;
@@ -19496,7 +21208,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(BarResponse prototype) {
- return (Builder) new Builder().MergeFrom(prototype);
+ return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -19506,21 +21218,48 @@ namespace Google.ProtocolBuffers.TestProtos {
protected override Builder ThisBuilder {
get { return this; }
}
- public Builder() {}
+ public Builder() {
+ result = DefaultInstance ?? new BarResponse();
+ builderIsReadOnly = result == DefaultInstance;
+ }
+ internal Builder(BarResponse cloneFrom) {
+ result = cloneFrom;
+ builderIsReadOnly = true;
+ }
- BarResponse result = new BarResponse();
+ bool builderIsReadOnly;
+ BarResponse result;
+
+ private BarResponse PrepareBuilder() {
+ if (builderIsReadOnly) {
+ BarResponse original = result;
+ result = new BarResponse();
+ builderIsReadOnly = false;
+ MergeFrom(original);
+ }
+ return result;
+ }
+
+ public override bool IsInitialized {
+ get { return result.IsInitialized; }
+ }
protected override BarResponse MessageBeingBuilt {
- get { return result; }
+ get { return PrepareBuilder(); }
}
public override Builder Clear() {
- result = new BarResponse();
+ result = DefaultInstance ?? new BarResponse();
+ builderIsReadOnly = true;
return this;
}
public override Builder Clone() {
- return new Builder().MergeFrom(result);
+ if (builderIsReadOnly) {
+ return new Builder(result);
+ } else {
+ return new Builder().MergeFrom(result);
+ }
}
public override pbd::MessageDescriptor DescriptorForType {
@@ -19532,12 +21271,11 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override BarResponse BuildPartial() {
- if (result == null) {
- throw new global::System.InvalidOperationException("build() has already been called on this Builder");
+ if (builderIsReadOnly) {
+ return result;
}
- BarResponse returnMe = result;
- result = null;
- return returnMe;
+ builderIsReadOnly = true;
+ return result;
}
public override Builder MergeFrom(pb::IMessage other) {
@@ -19551,6 +21289,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(BarResponse other) {
if (other == global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance) return this;
+ PrepareBuilder();
this.MergeUnknownFields(other.UnknownFields);
return this;
}
@@ -19560,6 +21299,7 @@ namespace Google.ProtocolBuffers.TestProtos {
}
public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
+ PrepareBuilder();
pb::UnknownFieldSet.Builder unknownFields = null;
uint tag;
string field_name;