Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
642a8140
Commit
642a8140
authored
Jan 27, 2009
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setters/adders now throw ArgumentNullException appropriately.
parent
25a27922
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
588 additions
and
5 deletions
+588
-5
AddressBookProtos.cs
src/AddressBook/AddressBookProtos.cs
+11
-0
BenchmarkProtoFile.cs
src/ProtoBench/BenchmarkProtoFile.cs
+37
-0
BenchmarkSpeedProtoFile.cs
src/ProtoBench/BenchmarkSpeedProtoFile.cs
+37
-0
FieldGeneratorBase.cs
src/ProtoGen/FieldGeneratorBase.cs
+40
-1
MessageFieldGenerator.cs
src/ProtoGen/MessageFieldGenerator.cs
+3
-0
PrimitiveFieldGenerator.cs
src/ProtoGen/PrimitiveFieldGenerator.cs
+1
-0
RepeatedMessageFieldGenerator.cs
src/ProtoGen/RepeatedMessageFieldGenerator.cs
+4
-0
RepeatedPrimitiveFieldGenerator.cs
src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs
+2
-0
DynamicMessageTest.cs
src/ProtocolBuffers.Test/DynamicMessageTest.cs
+18
-0
GeneratedMessageTest.cs
src/ProtocolBuffers.Test/GeneratedMessageTest.cs
+60
-0
ReflectionTester.cs
src/ProtocolBuffers.Test/ReflectionTester.cs
+32
-0
UnitTestCustomOptionsProtoFile.cs
...Buffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
+10
-0
UnitTestEmbedOptimizeForProtoFile.cs
...fers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
+7
-0
UnitTestMessageSetProtoFile.cs
...colBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
+9
-0
UnitTestOptimizeForProtoFile.cs
...olBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
+6
-0
UnitTestProtoFile.cs
src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
+95
-0
TestUtil.cs
src/ProtocolBuffers.Test/TestUtil.cs
+9
-0
TextFormatTest.cs
src/ProtocolBuffers.Test/TextFormatTest.cs
+24
-0
CSharpOptions.cs
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+3
-0
DescriptorProtoFile.cs
src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
+122
-0
RepeatedEnumAccessor.cs
src/ProtocolBuffers/FieldAccess/RepeatedEnumAccessor.cs
+3
-1
RepeatedMessageAccessor.cs
src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs
+1
-1
RepeatedPrimitiveAccessor.cs
src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs
+3
-1
SingleEnumAccessor.cs
src/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs
+1
-0
SingleMessageAccessor.cs
src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs
+1
-1
FieldSet.cs
src/ProtocolBuffers/FieldSet.cs
+2
-0
GeneratedBuilder.cs
src/ProtocolBuffers/GeneratedBuilder.cs
+6
-0
ProtocolBuffers.csproj
src/ProtocolBuffers/ProtocolBuffers.csproj
+1
-0
ThrowHelper.cs
src/ProtocolBuffers/ThrowHelper.cs
+40
-0
No files found.
src/AddressBook/AddressBookProtos.cs
View file @
642a8140
...
...
@@ -286,6 +286,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
set
{
SetNumber
(
value
);
}
}
public
Builder
SetNumber
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasNumber
=
true
;
result
.
number_
=
value
;
return
this
;
...
...
@@ -553,6 +554,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -589,6 +591,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
set
{
SetEmail
(
value
);
}
}
public
Builder
SetEmail
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasEmail
=
true
;
result
.
email_
=
value
;
return
this
;
...
...
@@ -609,18 +612,22 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
return
result
.
GetPhone
(
index
);
}
public
Builder
SetPhone
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
phone_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetPhone
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
phone_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddPhone
(
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
phone_
.
Add
(
value
);
return
this
;
}
public
Builder
AddPhone
(
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
.
Types
.
PhoneNumber
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
phone_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -825,18 +832,22 @@ namespace Google.ProtocolBuffers.Examples.AddressBook {
return
result
.
GetPerson
(
index
);
}
public
Builder
SetPerson
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
person_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetPerson
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
person_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddPerson
(
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
person_
.
Add
(
value
);
return
this
;
}
public
Builder
AddPerson
(
global
::
Google
.
ProtocolBuffers
.
Examples
.
AddressBook
.
Person
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
person_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
src/ProtoBench/BenchmarkProtoFile.cs
View file @
642a8140
...
...
@@ -575,6 +575,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField1
(
value
);
}
}
public
Builder
SetField1
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField1
=
true
;
result
.
field1_
=
value
;
return
this
;
...
...
@@ -593,6 +594,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField9
(
value
);
}
}
public
Builder
SetField9
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField9
=
true
;
result
.
field9_
=
value
;
return
this
;
...
...
@@ -611,6 +613,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField18
(
value
);
}
}
public
Builder
SetField18
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField18
=
true
;
result
.
field18_
=
value
;
return
this
;
...
...
@@ -755,6 +758,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField4
(
value
);
}
}
public
Builder
SetField4
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField4
=
true
;
result
.
field4_
=
value
;
return
this
;
...
...
@@ -817,6 +821,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField7
(
value
);
}
}
public
Builder
SetField7
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField7
=
true
;
result
.
field7_
=
value
;
return
this
;
...
...
@@ -997,6 +1002,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField102
(
value
);
}
}
public
Builder
SetField102
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField102
=
true
;
result
.
field102_
=
value
;
return
this
;
...
...
@@ -1015,6 +1021,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField103
(
value
);
}
}
public
Builder
SetField103
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField103
=
true
;
result
.
field103_
=
value
;
return
this
;
...
...
@@ -1195,16 +1202,19 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField15
(
value
);
}
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField15
=
true
;
result
.
field15_
=
value
;
return
this
;
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasField15
=
true
;
result
.
field15_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasField15
&&
result
.
field15_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
DefaultInstance
)
{
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message2
.
CreateBuilder
(
result
.
field15_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -1300,6 +1310,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField129
(
value
);
}
}
public
Builder
SetField129
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField129
=
true
;
result
.
field129_
=
value
;
return
this
;
...
...
@@ -1660,6 +1671,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField15
(
value
);
}
}
public
Builder
SetField15
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField15
=
true
;
result
.
field15_
=
value
;
return
this
;
...
...
@@ -1912,6 +1924,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField205
(
value
);
}
}
public
Builder
SetField205
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField205
=
true
;
result
.
field205_
=
value
;
return
this
;
...
...
@@ -2269,6 +2282,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField12
(
value
);
}
}
public
Builder
SetField12
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField12
=
true
;
result
.
field12_
=
value
;
return
this
;
...
...
@@ -2287,6 +2301,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField13
(
value
);
}
}
public
Builder
SetField13
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField13
=
true
;
result
.
field13_
=
value
;
return
this
;
...
...
@@ -2307,10 +2322,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField14
(
index
);
}
public
Builder
SetField14
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field14_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField14
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field14_
.
Add
(
value
);
return
this
;
}
...
...
@@ -2367,6 +2384,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField27
(
value
);
}
}
public
Builder
SetField27
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField27
=
true
;
result
.
field27_
=
value
;
return
this
;
...
...
@@ -2403,6 +2421,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField29
(
value
);
}
}
public
Builder
SetField29
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField29
=
true
;
result
.
field29_
=
value
;
return
this
;
...
...
@@ -2421,6 +2440,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField16
(
value
);
}
}
public
Builder
SetField16
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField16
=
true
;
result
.
field16_
=
value
;
return
this
;
...
...
@@ -2441,10 +2461,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField22
(
index
);
}
public
Builder
SetField22
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field22_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField22
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field22_
.
Add
(
value
);
return
this
;
}
...
...
@@ -2509,6 +2531,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField24
(
value
);
}
}
public
Builder
SetField24
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField24
=
true
;
result
.
field24_
=
value
;
return
this
;
...
...
@@ -2527,16 +2550,19 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField31
(
value
);
}
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField31
=
true
;
result
.
field31_
=
value
;
return
this
;
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasField31
=
true
;
result
.
field31_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasField31
&&
result
.
field31_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
DefaultInstance
)
{
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message4
.
CreateBuilder
(
result
.
field31_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -2913,6 +2939,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField1
(
value
);
}
}
public
Builder
SetField1
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField1
=
true
;
result
.
field1_
=
value
;
return
this
;
...
...
@@ -3003,6 +3030,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField6
(
value
);
}
}
public
Builder
SetField6
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField6
=
true
;
result
.
field6_
=
value
;
return
this
;
...
...
@@ -3021,6 +3049,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField2
(
value
);
}
}
public
Builder
SetField2
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField2
=
true
;
result
.
field2_
=
value
;
return
this
;
...
...
@@ -3311,18 +3340,22 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetGroup1
(
index
);
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
group1_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
group1_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
group1_
.
Add
(
value
);
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
Message3
.
Types
.
Group1
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
group1_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -3345,10 +3378,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField128
(
index
);
}
public
Builder
SetField128
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field128_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField128
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field128_
.
Add
(
value
);
return
this
;
}
...
...
@@ -3389,10 +3424,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField127
(
index
);
}
public
Builder
SetField127
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field127_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField127
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field127_
.
Add
(
value
);
return
this
;
}
...
...
src/ProtoBench/BenchmarkSpeedProtoFile.cs
View file @
642a8140
...
...
@@ -1179,6 +1179,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField1
(
value
);
}
}
public
Builder
SetField1
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField1
=
true
;
result
.
field1_
=
value
;
return
this
;
...
...
@@ -1197,6 +1198,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField9
(
value
);
}
}
public
Builder
SetField9
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField9
=
true
;
result
.
field9_
=
value
;
return
this
;
...
...
@@ -1215,6 +1217,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField18
(
value
);
}
}
public
Builder
SetField18
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField18
=
true
;
result
.
field18_
=
value
;
return
this
;
...
...
@@ -1359,6 +1362,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField4
(
value
);
}
}
public
Builder
SetField4
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField4
=
true
;
result
.
field4_
=
value
;
return
this
;
...
...
@@ -1421,6 +1425,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField7
(
value
);
}
}
public
Builder
SetField7
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField7
=
true
;
result
.
field7_
=
value
;
return
this
;
...
...
@@ -1601,6 +1606,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField102
(
value
);
}
}
public
Builder
SetField102
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField102
=
true
;
result
.
field102_
=
value
;
return
this
;
...
...
@@ -1619,6 +1625,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField103
(
value
);
}
}
public
Builder
SetField103
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField103
=
true
;
result
.
field103_
=
value
;
return
this
;
...
...
@@ -1799,16 +1806,19 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField15
(
value
);
}
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField15
=
true
;
result
.
field15_
=
value
;
return
this
;
}
public
Builder
SetField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasField15
=
true
;
result
.
field15_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField15
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasField15
&&
result
.
field15_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
DefaultInstance
)
{
result
.
field15_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage2
.
CreateBuilder
(
result
.
field15_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -1904,6 +1914,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField129
(
value
);
}
}
public
Builder
SetField129
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField129
=
true
;
result
.
field129_
=
value
;
return
this
;
...
...
@@ -2586,6 +2597,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField15
(
value
);
}
}
public
Builder
SetField15
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField15
=
true
;
result
.
field15_
=
value
;
return
this
;
...
...
@@ -2838,6 +2850,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField205
(
value
);
}
}
public
Builder
SetField205
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField205
=
true
;
result
.
field205_
=
value
;
return
this
;
...
...
@@ -3472,6 +3485,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField12
(
value
);
}
}
public
Builder
SetField12
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField12
=
true
;
result
.
field12_
=
value
;
return
this
;
...
...
@@ -3490,6 +3504,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField13
(
value
);
}
}
public
Builder
SetField13
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField13
=
true
;
result
.
field13_
=
value
;
return
this
;
...
...
@@ -3510,10 +3525,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField14
(
index
);
}
public
Builder
SetField14
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field14_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField14
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field14_
.
Add
(
value
);
return
this
;
}
...
...
@@ -3570,6 +3587,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField27
(
value
);
}
}
public
Builder
SetField27
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField27
=
true
;
result
.
field27_
=
value
;
return
this
;
...
...
@@ -3606,6 +3624,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField29
(
value
);
}
}
public
Builder
SetField29
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField29
=
true
;
result
.
field29_
=
value
;
return
this
;
...
...
@@ -3624,6 +3643,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField16
(
value
);
}
}
public
Builder
SetField16
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField16
=
true
;
result
.
field16_
=
value
;
return
this
;
...
...
@@ -3644,10 +3664,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField22
(
index
);
}
public
Builder
SetField22
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field22_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField22
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field22_
.
Add
(
value
);
return
this
;
}
...
...
@@ -3712,6 +3734,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField24
(
value
);
}
}
public
Builder
SetField24
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField24
=
true
;
result
.
field24_
=
value
;
return
this
;
...
...
@@ -3730,16 +3753,19 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField31
(
value
);
}
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField31
=
true
;
result
.
field31_
=
value
;
return
this
;
}
public
Builder
SetField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasField31
=
true
;
result
.
field31_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeField31
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasField31
&&
result
.
field31_
!=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
DefaultInstance
)
{
result
.
field31_
=
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage4
.
CreateBuilder
(
result
.
field31_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -4570,6 +4596,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField1
(
value
);
}
}
public
Builder
SetField1
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField1
=
true
;
result
.
field1_
=
value
;
return
this
;
...
...
@@ -4660,6 +4687,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField6
(
value
);
}
}
public
Builder
SetField6
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField6
=
true
;
result
.
field6_
=
value
;
return
this
;
...
...
@@ -4678,6 +4706,7 @@ namespace Google.ProtocolBuffers.ProtoBench {
set
{
SetField2
(
value
);
}
}
public
Builder
SetField2
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField2
=
true
;
result
.
field2_
=
value
;
return
this
;
...
...
@@ -4968,18 +4997,22 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetGroup1
(
index
);
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
group1_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetGroup1
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
group1_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
group1_
.
Add
(
value
);
return
this
;
}
public
Builder
AddGroup1
(
global
::
Google
.
ProtocolBuffers
.
ProtoBench
.
SpeedMessage3
.
Types
.
Group1
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
group1_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -5002,10 +5035,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField128
(
index
);
}
public
Builder
SetField128
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field128_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField128
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field128_
.
Add
(
value
);
return
this
;
}
...
...
@@ -5046,10 +5081,12 @@ namespace Google.ProtocolBuffers.ProtoBench {
return
result
.
GetField127
(
index
);
}
public
Builder
SetField127
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field127_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddField127
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field127_
.
Add
(
value
);
return
this
;
}
...
...
src/ProtoGen/FieldGeneratorBase.cs
View file @
642a8140
using
System
;
using
Google.ProtocolBuffers.Descriptors
;
using
System.Globalization
;
using
Google.ProtocolBuffers.Descriptors
;
namespace
Google.ProtocolBuffers.ProtoGen
{
internal
abstract
class
FieldGeneratorBase
:
SourceGeneratorBase
<
FieldDescriptor
>
{
...
...
@@ -87,6 +87,45 @@ namespace Google.ProtocolBuffers.ProtoGen {
get
{
return
Descriptor
.
FieldNumber
;
}
}
protected
void
AddNullCheck
(
TextGenerator
writer
)
{
AddNullCheck
(
writer
,
"value"
);
}
protected
void
AddNullCheck
(
TextGenerator
writer
,
string
name
)
{
if
(
IsNullableType
)
{
writer
.
WriteLine
(
" pb::ThrowHelper.ThrowIfNull({0}, \"{0}\");"
,
name
);
}
}
protected
bool
IsNullableType
{
get
{
switch
(
Descriptor
.
FieldType
)
{
case
FieldType
.
Float
:
case
FieldType
.
Double
:
case
FieldType
.
Int32
:
case
FieldType
.
Int64
:
case
FieldType
.
SInt32
:
case
FieldType
.
SInt64
:
case
FieldType
.
SFixed32
:
case
FieldType
.
SFixed64
:
case
FieldType
.
UInt32
:
case
FieldType
.
UInt64
:
case
FieldType
.
Fixed32
:
case
FieldType
.
Fixed64
:
case
FieldType
.
Bool
:
case
FieldType
.
Enum
:
return
false
;
case
FieldType
.
Bytes
:
case
FieldType
.
String
:
case
FieldType
.
Message
:
case
FieldType
.
Group
:
return
true
;
default
:
throw
new
InvalidOperationException
(
"Invalid field descriptor type"
);
}
}
}
protected
string
TypeName
{
get
{
switch
(
Descriptor
.
FieldType
)
{
...
...
src/ProtoGen/MessageFieldGenerator.cs
View file @
642a8140
...
...
@@ -27,16 +27,19 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer
.
WriteLine
(
" set {{ Set{0}(value); }}"
,
PropertyName
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Set{0}({1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" result.has{0} = true;"
,
PropertyName
);
writer
.
WriteLine
(
" result.{0}_ = value;"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Set{0}({1}.Builder builderForValue) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
,
"builderForValue"
);
writer
.
WriteLine
(
" result.has{0} = true;"
,
PropertyName
);
writer
.
WriteLine
(
" result.{0}_ = builderForValue.Build();"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Merge{0}({1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" if (result.Has{0} &&"
,
PropertyName
);
writer
.
WriteLine
(
" result.{0}_ != {1}) {{"
,
Name
,
DefaultValue
);
writer
.
WriteLine
(
" result.{0}_ = {1}.CreateBuilder(result.{0}_).MergeFrom(value).BuildPartial();"
,
Name
,
TypeName
);
...
...
src/ProtoGen/PrimitiveFieldGenerator.cs
View file @
642a8140
...
...
@@ -29,6 +29,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer
.
WriteLine
(
" set {{ Set{0}(value); }}"
,
PropertyName
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Set{0}({1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" result.has{0} = true;"
,
PropertyName
);
writer
.
WriteLine
(
" result.{0}_ = value;"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
...
...
src/ProtoGen/RepeatedMessageFieldGenerator.cs
View file @
642a8140
...
...
@@ -38,20 +38,24 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer
.
WriteLine
(
" return result.Get{0}(index);"
,
PropertyName
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Set{0}(int index, {1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" result.{0}_[index] = value;"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
// Extra overload for builder (just on messages)
writer
.
WriteLine
(
"public Builder Set{0}(int index, {1}.Builder builderForValue) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
,
"builderForValue"
);
writer
.
WriteLine
(
" result.{0}_[index] = builderForValue.Build();"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Add{0}({1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" result.{0}_.Add(value);"
,
Name
,
TypeName
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
// Extra overload for builder (just on messages)
writer
.
WriteLine
(
"public Builder Add{0}({1}.Builder builderForValue) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
,
"builderForValue"
);
writer
.
WriteLine
(
" result.{0}_.Add(builderForValue.Build());"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
...
...
src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs
View file @
642a8140
...
...
@@ -38,10 +38,12 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer
.
WriteLine
(
" return result.Get{0}(index);"
,
PropertyName
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Set{0}(int index, {1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" result.{0}_[index] = value;"
,
Name
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
writer
.
WriteLine
(
"public Builder Add{0}({1} value) {{"
,
PropertyName
,
TypeName
);
AddNullCheck
(
writer
);
writer
.
WriteLine
(
" result.{0}_.Add(value);"
,
Name
,
TypeName
);
writer
.
WriteLine
(
" return this;"
);
writer
.
WriteLine
(
"}"
);
...
...
src/ProtocolBuffers.Test/DynamicMessageTest.cs
View file @
642a8140
...
...
@@ -53,6 +53,12 @@ namespace Google.ProtocolBuffers {
reflectionTester
.
AssertAllFieldsSetViaReflection
(
message
);
}
[
Test
]
public
void
DynamicMessageSettersRejectNull
()
{
IBuilder
builder
=
DynamicMessage
.
CreateBuilder
(
TestAllTypes
.
Descriptor
);
reflectionTester
.
AssertReflectionSettersRejectNull
(
builder
);
}
[
Test
]
public
void
DynamicMessageExtensionAccessors
()
{
// We don't need to extensively test DynamicMessage's handling of
...
...
@@ -64,6 +70,12 @@ namespace Google.ProtocolBuffers {
extensionsReflectionTester
.
AssertAllFieldsSetViaReflection
(
message
);
}
[
Test
]
public
void
DynamicMessageExtensionSettersRejectNull
()
{
IBuilder
builder
=
DynamicMessage
.
CreateBuilder
(
TestAllExtensions
.
Descriptor
);
extensionsReflectionTester
.
AssertReflectionSettersRejectNull
(
builder
);
}
[
Test
]
public
void
DynamicMessageRepeatedSetters
()
{
IBuilder
builder
=
DynamicMessage
.
CreateBuilder
(
TestAllTypes
.
Descriptor
);
...
...
@@ -73,6 +85,12 @@ namespace Google.ProtocolBuffers {
reflectionTester
.
AssertRepeatedFieldsModifiedViaReflection
(
message
);
}
[
Test
]
public
void
DynamicMessageRepeatedSettersRejectNull
()
{
IBuilder
builder
=
DynamicMessage
.
CreateBuilder
(
TestAllTypes
.
Descriptor
);
reflectionTester
.
AssertReflectionRepeatedSettersRejectNull
(
builder
);
}
[
Test
]
public
void
DynamicMessageDefaults
()
{
reflectionTester
.
AssertClearViaReflection
(
DynamicMessage
.
GetDefaultInstance
(
TestAllTypes
.
Descriptor
));
...
...
src/ProtocolBuffers.Test/GeneratedMessageTest.cs
View file @
642a8140
...
...
@@ -104,6 +104,19 @@ namespace Google.ProtocolBuffers {
TestUtil
.
AssertAllFieldsSet
(
message
);
}
[
Test
]
public
void
SettersRejectNull
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetOptionalString
(
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetOptionalBytes
(
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetOptionalNestedMessage
((
TestAllTypes
.
Types
.
NestedMessage
)
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetOptionalNestedMessage
((
TestAllTypes
.
Types
.
NestedMessage
.
Builder
)
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRepeatedString
(
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRepeatedBytes
(
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRepeatedNestedMessage
((
TestAllTypes
.
Types
.
NestedMessage
)
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRepeatedNestedMessage
((
TestAllTypes
.
Types
.
NestedMessage
.
Builder
)
null
));
}
[
Test
]
public
void
RepeatedSetters
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
...
...
@@ -130,6 +143,18 @@ namespace Google.ProtocolBuffers {
Assert
.
AreEqual
(
12
,
message
.
GetRepeatedForeignMessage
(
0
).
C
);
}
[
Test
]
public
void
RepeatedAppendRejectsNull
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
ForeignMessage
foreignMessage
=
ForeignMessage
.
CreateBuilder
().
SetC
(
12
).
Build
();
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRangeRepeatedForeignMessage
(
new
[]
{
foreignMessage
,
null
}));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRangeRepeatedForeignMessage
(
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRangeRepeatedForeignEnum
(
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRangeRepeatedString
(
new
[]
{
"one"
,
null
}));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
AddRangeRepeatedBytes
(
new
[]
{
TestUtil
.
ToBytes
(
"one"
),
null
}));
}
[
Test
]
public
void
SettingForeignMessageUsingBuilder
()
{
TestAllTypes
message
=
TestAllTypes
.
CreateBuilder
()
...
...
@@ -181,6 +206,11 @@ namespace Google.ProtocolBuffers {
TestUtil
.
AssertAllFieldsSet
(
message
);
}
[
Test
]
public
void
ReflectionSettersRejectNull
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
reflectionTester
.
AssertReflectionSettersRejectNull
(
builder
);
}
[
Test
]
public
void
ReflectionRepeatedSetters
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
...
...
@@ -190,6 +220,12 @@ namespace Google.ProtocolBuffers {
TestUtil
.
AssertRepeatedFieldsModified
(
message
);
}
[
Test
]
public
void
TestReflectionRepeatedSettersRejectNull
()
{
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
reflectionTester
.
AssertReflectionRepeatedSettersRejectNull
(
builder
);
}
[
Test
]
public
void
ReflectionDefaults
()
{
reflectionTester
.
AssertClearViaReflection
(
TestAllTypes
.
DefaultInstance
);
...
...
@@ -237,6 +273,12 @@ namespace Google.ProtocolBuffers {
TestUtil
.
AssertAllExtensionsSet
(
message
);
}
[
Test
]
public
void
ExtensionReflectionSettersRejectNull
()
{
TestAllExtensions
.
Builder
builder
=
TestAllExtensions
.
CreateBuilder
();
extensionsReflectionTester
.
AssertReflectionSettersRejectNull
(
builder
);
}
[
Test
]
public
void
ExtensionReflectionRepeatedSetters
()
{
TestAllExtensions
.
Builder
builder
=
TestAllExtensions
.
CreateBuilder
();
...
...
@@ -246,6 +288,12 @@ namespace Google.ProtocolBuffers {
TestUtil
.
AssertRepeatedExtensionsModified
(
message
);
}
[
Test
]
public
void
ExtensionReflectionRepeatedSettersRejectNull
()
{
TestAllExtensions
.
Builder
builder
=
TestAllExtensions
.
CreateBuilder
();
extensionsReflectionTester
.
AssertReflectionRepeatedSettersRejectNull
(
builder
);
}
[
Test
]
public
void
ExtensionReflectionDefaults
()
{
extensionsReflectionTester
.
AssertClearViaReflection
(
TestAllExtensions
.
DefaultInstance
);
...
...
@@ -265,6 +313,18 @@ namespace Google.ProtocolBuffers {
.
GetExtensionCount
(
UnitTestProtoFile
.
RepeatedInt32Extension
));
}
/* Reinstate this test in the commit where it's fixed...
[Test]
public void ExtensionMergeFrom() {
TestAllExtensions original = TestAllExtensions.CreateBuilder()
.SetExtension(UnitTestProtoFile.OptionalInt32Extension, 1).Build();
TestAllExtensions merged =
TestAllExtensions.CreateBuilder().MergeFrom(original).Build();
Assert.IsTrue((merged.HasExtension(UnitTestProtoFile.OptionalInt32Extension)));
Assert.AreEqual(1, (int)merged.GetExtension(UnitTestProtoFile.OptionalInt32Extension));
}
*/
/* Removed multiple files option for the moment
[Test]
public void MultipleFilesOption() {
...
...
src/ProtocolBuffers.Test/ReflectionTester.cs
View file @
642a8140
...
...
@@ -810,5 +810,37 @@ namespace Google.ProtocolBuffers {
Assert
.
AreEqual
(
"524"
,
message
[
f
(
"repeated_string_piece"
),
1
]);
Assert
.
AreEqual
(
"525"
,
message
[
f
(
"repeated_cord"
),
1
]);
}
/// <summary>
/// Verifies that the reflection setters for the given Builder object throw an
/// ArgumentNullException if they are passed a null value.
/// </summary>
public
void
AssertReflectionSettersRejectNull
(
IBuilder
builder
)
{
TestUtil
.
AssertArgumentNullException
(()
=>
builder
[
f
(
"optional_string"
)]
=
null
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
[
f
(
"optional_bytes"
)]
=
null
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
[
f
(
"optional_nested_enum"
)]
=
null
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
[
f
(
"optional_nested_message"
)]
=
null
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
[
f
(
"optional_nested_message"
)]
=
null
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
WeakAddRepeatedField
(
f
(
"repeated_string"
),
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
WeakAddRepeatedField
(
f
(
"repeated_bytes"
),
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
WeakAddRepeatedField
(
f
(
"repeated_nested_enum"
),
null
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
WeakAddRepeatedField
(
f
(
"repeated_nested_message"
),
null
));
}
/// <summary>
/// Verifies that the reflection repeated setters for the given Builder object throw an
/// ArgumentNullException if they are passed a null value.
/// </summary>
public
void
AssertReflectionRepeatedSettersRejectNull
(
IBuilder
builder
)
{
builder
.
WeakAddRepeatedField
(
f
(
"repeated_string"
),
"one"
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetRepeatedField
(
f
(
"repeated_string"
),
0
,
null
));
builder
.
WeakAddRepeatedField
(
f
(
"repeated_bytes"
),
TestUtil
.
ToBytes
(
"one"
));
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetRepeatedField
(
f
(
"repeated_bytes"
),
0
,
null
));
builder
.
WeakAddRepeatedField
(
f
(
"repeated_nested_enum"
),
nestedBaz
);
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetRepeatedField
(
f
(
"repeated_nested_enum"
),
0
,
null
));
builder
.
WeakAddRepeatedField
(
f
(
"repeated_nested_message"
),
new
TestAllTypes
.
Types
.
NestedMessage
.
Builder
{
Bb
=
218
}.
Build
());
TestUtil
.
AssertArgumentNullException
(()
=>
builder
.
SetRepeatedField
(
f
(
"repeated_nested_message"
),
0
,
null
));
}
}
}
src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
View file @
642a8140
...
...
@@ -397,6 +397,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetField1
(
value
);
}
}
public
Builder
SetField1
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasField1
=
true
;
result
.
field1_
=
value
;
return
this
;
...
...
@@ -1593,16 +1594,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetBar
(
value
);
}
}
public
Builder
SetBar
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType1
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasBar
=
true
;
result
.
bar_
=
value
;
return
this
;
}
public
Builder
SetBar
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType1
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasBar
=
true
;
result
.
bar_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeBar
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType1
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasBar
&&
result
.
bar_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType1
.
DefaultInstance
)
{
result
.
bar_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType1
.
CreateBuilder
(
result
.
bar_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -1644,16 +1648,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetFred
(
value
);
}
}
public
Builder
SetFred
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasFred
=
true
;
result
.
fred_
=
value
;
return
this
;
}
public
Builder
SetFred
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasFred
=
true
;
result
.
fred_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeFred
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasFred
&&
result
.
fred_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
.
DefaultInstance
)
{
result
.
fred_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType2
.
Types
.
ComplexOptionType4
.
CreateBuilder
(
result
.
fred_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -1925,16 +1932,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetComplexOptionType5
(
value
);
}
}
public
Builder
SetComplexOptionType5
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType3
.
Types
.
ComplexOptionType5
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasComplexOptionType5
=
true
;
result
.
complexOptionType5_
=
value
;
return
this
;
}
public
Builder
SetComplexOptionType5
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType3
.
Types
.
ComplexOptionType5
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasComplexOptionType5
=
true
;
result
.
complexOptionType5_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeComplexOptionType5
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType3
.
Types
.
ComplexOptionType5
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasComplexOptionType5
&&
result
.
complexOptionType5_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType3
.
Types
.
ComplexOptionType5
.
DefaultInstance
)
{
result
.
complexOptionType5_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ComplexOptionType3
.
Types
.
ComplexOptionType5
.
CreateBuilder
(
result
.
complexOptionType5_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs
View file @
642a8140
...
...
@@ -256,16 +256,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalMessage
(
value
);
}
}
public
Builder
SetOptionalMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalMessage
=
true
;
result
.
optionalMessage_
=
value
;
return
this
;
}
public
Builder
SetOptionalMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptionalMessage
=
true
;
result
.
optionalMessage_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptionalMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptionalMessage
&&
result
.
optionalMessage_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
.
DefaultInstance
)
{
result
.
optionalMessage_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
.
CreateBuilder
(
result
.
optionalMessage_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -291,18 +294,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedMessage
(
index
);
}
public
Builder
SetRepeatedMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedMessage_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetRepeatedMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedMessage_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedMessage_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestOptimizedForSize
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedMessage_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs
View file @
642a8140
...
...
@@ -410,16 +410,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetMessageSet
(
value
);
}
}
public
Builder
SetMessageSet
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMessageSet
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasMessageSet
=
true
;
result
.
messageSet_
=
value
;
return
this
;
}
public
Builder
SetMessageSet
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMessageSet
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasMessageSet
=
true
;
result
.
messageSet_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeMessageSet
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMessageSet
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasMessageSet
&&
result
.
messageSet_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMessageSet
.
DefaultInstance
)
{
result
.
messageSet_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMessageSet
.
CreateBuilder
(
result
.
messageSet_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -813,6 +816,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetStr
(
value
);
}
}
public
Builder
SetStr
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasStr
=
true
;
result
.
str_
=
value
;
return
this
;
...
...
@@ -1071,6 +1075,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetMessage
(
value
);
}
}
public
Builder
SetMessage
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasMessage
=
true
;
result
.
message_
=
value
;
return
this
;
...
...
@@ -1251,18 +1256,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetItem
(
index
);
}
public
Builder
SetItem
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
RawMessageSet
.
Types
.
Item
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
item_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetItem
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
RawMessageSet
.
Types
.
Item
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
item_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddItem
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
RawMessageSet
.
Types
.
Item
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
item_
.
Add
(
value
);
return
this
;
}
public
Builder
AddItem
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
RawMessageSet
.
Types
.
Item
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
item_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs
View file @
642a8140
...
...
@@ -189,16 +189,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetMsg
(
value
);
}
}
public
Builder
SetMsg
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasMsg
=
true
;
result
.
msg_
=
value
;
return
this
;
}
public
Builder
SetMsg
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasMsg
=
true
;
result
.
msg_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeMsg
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasMsg
&&
result
.
msg_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
DefaultInstance
)
{
result
.
msg_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
CreateBuilder
(
result
.
msg_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -438,16 +441,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetO
(
value
);
}
}
public
Builder
SetO
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequiredOptimizedForSize
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasO
=
true
;
result
.
o_
=
value
;
return
this
;
}
public
Builder
SetO
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequiredOptimizedForSize
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasO
=
true
;
result
.
o_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeO
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequiredOptimizedForSize
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasO
&&
result
.
o_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequiredOptimizedForSize
.
DefaultInstance
)
{
result
.
o_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequiredOptimizedForSize
.
CreateBuilder
(
result
.
o_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
View file @
642a8140
...
...
@@ -3255,6 +3255,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalString
(
value
);
}
}
public
Builder
SetOptionalString
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalString
=
true
;
result
.
optionalString_
=
value
;
return
this
;
...
...
@@ -3273,6 +3274,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalBytes
(
value
);
}
}
public
Builder
SetOptionalBytes
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalBytes
=
true
;
result
.
optionalBytes_
=
value
;
return
this
;
...
...
@@ -3291,16 +3293,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalGroup
(
value
);
}
}
public
Builder
SetOptionalGroup
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
OptionalGroup
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
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"
);
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
();
...
...
@@ -3324,16 +3329,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalNestedMessage
(
value
);
}
}
public
Builder
SetOptionalNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
NestedMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
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"
);
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
();
...
...
@@ -3357,16 +3365,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalForeignMessage
(
value
);
}
}
public
Builder
SetOptionalForeignMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalForeignMessage
=
true
;
result
.
optionalForeignMessage_
=
value
;
return
this
;
}
public
Builder
SetOptionalForeignMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptionalForeignMessage
=
true
;
result
.
optionalForeignMessage_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptionalForeignMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptionalForeignMessage
&&
result
.
optionalForeignMessage_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
DefaultInstance
)
{
result
.
optionalForeignMessage_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
CreateBuilder
(
result
.
optionalForeignMessage_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -3390,16 +3401,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalImportMessage
(
value
);
}
}
public
Builder
SetOptionalImportMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalImportMessage
=
true
;
result
.
optionalImportMessage_
=
value
;
return
this
;
}
public
Builder
SetOptionalImportMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptionalImportMessage
=
true
;
result
.
optionalImportMessage_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptionalImportMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptionalImportMessage
&&
result
.
optionalImportMessage_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
.
DefaultInstance
)
{
result
.
optionalImportMessage_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
.
CreateBuilder
(
result
.
optionalImportMessage_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -3477,6 +3491,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalStringPiece
(
value
);
}
}
public
Builder
SetOptionalStringPiece
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalStringPiece
=
true
;
result
.
optionalStringPiece_
=
value
;
return
this
;
...
...
@@ -3495,6 +3510,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalCord
(
value
);
}
}
public
Builder
SetOptionalCord
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalCord
=
true
;
result
.
optionalCord_
=
value
;
return
this
;
...
...
@@ -3853,10 +3869,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedString
(
index
);
}
public
Builder
SetRepeatedString
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedString_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedString
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedString_
.
Add
(
value
);
return
this
;
}
...
...
@@ -3879,10 +3897,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedBytes
(
index
);
}
public
Builder
SetRepeatedBytes
(
int
index
,
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedBytes_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedBytes
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedBytes_
.
Add
(
value
);
return
this
;
}
...
...
@@ -3905,18 +3925,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedGroup
(
index
);
}
public
Builder
SetRepeatedGroup
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
RepeatedGroup
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
result
.
repeatedGroup_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedGroup
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
RepeatedGroup
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedGroup_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedGroup
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
RepeatedGroup
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedGroup_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -3939,18 +3963,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedNestedMessage
(
index
);
}
public
Builder
SetRepeatedNestedMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
NestedMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
result
.
repeatedNestedMessage_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
NestedMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedNestedMessage_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
NestedMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedNestedMessage_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -3973,18 +4001,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedForeignMessage
(
index
);
}
public
Builder
SetRepeatedForeignMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedForeignMessage_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetRepeatedForeignMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedForeignMessage_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedForeignMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedForeignMessage_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedForeignMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedForeignMessage_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -4007,18 +4039,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedImportMessage
(
index
);
}
public
Builder
SetRepeatedImportMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedImportMessage_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetRepeatedImportMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedImportMessage_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedImportMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedImportMessage_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedImportMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ImportMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedImportMessage_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -4119,10 +4155,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedStringPiece
(
index
);
}
public
Builder
SetRepeatedStringPiece
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedStringPiece_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedStringPiece
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedStringPiece_
.
Add
(
value
);
return
this
;
}
...
...
@@ -4145,10 +4183,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedCord
(
index
);
}
public
Builder
SetRepeatedCord
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedCord_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedCord
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedCord_
.
Add
(
value
);
return
this
;
}
...
...
@@ -4403,6 +4443,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetDefaultString
(
value
);
}
}
public
Builder
SetDefaultString
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasDefaultString
=
true
;
result
.
defaultString_
=
value
;
return
this
;
...
...
@@ -4421,6 +4462,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetDefaultBytes
(
value
);
}
}
public
Builder
SetDefaultBytes
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasDefaultBytes
=
true
;
result
.
defaultBytes_
=
value
;
return
this
;
...
...
@@ -4493,6 +4535,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetDefaultStringPiece
(
value
);
}
}
public
Builder
SetDefaultStringPiece
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasDefaultStringPiece
=
true
;
result
.
defaultStringPiece_
=
value
;
return
this
;
...
...
@@ -4511,6 +4554,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetDefaultCord
(
value
);
}
}
public
Builder
SetDefaultCord
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasDefaultCord
=
true
;
result
.
defaultCord_
=
value
;
return
this
;
...
...
@@ -6975,16 +7019,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalMessage
(
value
);
}
}
public
Builder
SetOptionalMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptionalMessage
=
true
;
result
.
optionalMessage_
=
value
;
return
this
;
}
public
Builder
SetOptionalMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptionalMessage
=
true
;
result
.
optionalMessage_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptionalMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptionalMessage
&&
result
.
optionalMessage_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
.
DefaultInstance
)
{
result
.
optionalMessage_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
.
CreateBuilder
(
result
.
optionalMessage_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -7010,18 +7057,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedMessage
(
index
);
}
public
Builder
SetRepeatedMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedMessage_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetRepeatedMessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedMessage_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedMessage_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRequired
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedMessage_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -7239,16 +7290,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetForeignNested
(
value
);
}
}
public
Builder
SetForeignNested
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestAllTypes
.
Types
.
NestedMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
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"
);
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
();
...
...
@@ -8013,16 +8067,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetA
(
value
);
}
}
public
Builder
SetA
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRecursiveMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasA
=
true
;
result
.
a_
=
value
;
return
this
;
}
public
Builder
SetA
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRecursiveMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasA
=
true
;
result
.
a_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeA
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRecursiveMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasA
&&
result
.
a_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRecursiveMessage
.
DefaultInstance
)
{
result
.
a_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestRecursiveMessage
.
CreateBuilder
(
result
.
a_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -8243,16 +8300,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetBb
(
value
);
}
}
public
Builder
SetBb
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionB
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasBb
=
true
;
result
.
bb_
=
value
;
return
this
;
}
public
Builder
SetBb
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionB
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasBb
=
true
;
result
.
bb_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeBb
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionB
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasBb
&&
result
.
bb_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionB
.
DefaultInstance
)
{
result
.
bb_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionB
.
CreateBuilder
(
result
.
bb_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -8477,16 +8537,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetA
(
value
);
}
}
public
Builder
SetA
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionA
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasA
=
true
;
result
.
a_
=
value
;
return
this
;
}
public
Builder
SetA
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionA
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasA
=
true
;
result
.
a_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeA
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionA
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasA
&&
result
.
a_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionA
.
DefaultInstance
)
{
result
.
a_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestMutualRecursionA
.
CreateBuilder
(
result
.
a_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -9163,16 +9226,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetFoo
(
value
);
}
}
public
Builder
SetFoo
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestDupFieldNumber
.
Types
.
Foo
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
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"
);
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
();
...
...
@@ -9196,16 +9262,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetBar
(
value
);
}
}
public
Builder
SetBar
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestDupFieldNumber
.
Types
.
Bar
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
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"
);
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
();
...
...
@@ -9485,18 +9554,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetNestedmessageRepeatedForeignmessage
(
index
);
}
public
Builder
SetNestedmessageRepeatedForeignmessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
nestedmessageRepeatedForeignmessage_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetNestedmessageRepeatedForeignmessage
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
nestedmessageRepeatedForeignmessage_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddNestedmessageRepeatedForeignmessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
nestedmessageRepeatedForeignmessage_
.
Add
(
value
);
return
this
;
}
public
Builder
AddNestedmessageRepeatedForeignmessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
nestedmessageRepeatedForeignmessage_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -9677,16 +9750,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetOptionalNestedMessage
(
value
);
}
}
public
Builder
SetOptionalNestedMessage
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
TestNestedMessageHasBits
.
Types
.
NestedMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
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"
);
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"
);
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
();
...
...
@@ -10179,6 +10255,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetStringField
(
value
);
}
}
public
Builder
SetStringField
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasStringField
=
true
;
result
.
stringField_
=
value
;
return
this
;
...
...
@@ -10215,16 +10292,19 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetMessageField
(
value
);
}
}
public
Builder
SetMessageField
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasMessageField
=
true
;
result
.
messageField_
=
value
;
return
this
;
}
public
Builder
SetMessageField
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasMessageField
=
true
;
result
.
messageField_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeMessageField
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasMessageField
&&
result
.
messageField_
!=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
DefaultInstance
)
{
result
.
messageField_
=
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
CreateBuilder
(
result
.
messageField_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -10248,6 +10328,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetStringPieceField
(
value
);
}
}
public
Builder
SetStringPieceField
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasStringPieceField
=
true
;
result
.
stringPieceField_
=
value
;
return
this
;
...
...
@@ -10266,6 +10347,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetCordField
(
value
);
}
}
public
Builder
SetCordField
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasCordField
=
true
;
result
.
cordField_
=
value
;
return
this
;
...
...
@@ -10312,10 +10394,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedStringField
(
index
);
}
public
Builder
SetRepeatedStringField
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedStringField_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedStringField
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedStringField_
.
Add
(
value
);
return
this
;
}
...
...
@@ -10364,18 +10448,22 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedMessageField
(
index
);
}
public
Builder
SetRepeatedMessageField
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedMessageField_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetRepeatedMessageField
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedMessageField_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddRepeatedMessageField
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedMessageField_
.
Add
(
value
);
return
this
;
}
public
Builder
AddRepeatedMessageField
(
global
::
Google
.
ProtocolBuffers
.
TestProtos
.
ForeignMessage
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
repeatedMessageField_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -10398,10 +10486,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedStringPieceField
(
index
);
}
public
Builder
SetRepeatedStringPieceField
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedStringPieceField_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedStringPieceField
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedStringPieceField_
.
Add
(
value
);
return
this
;
}
...
...
@@ -10424,10 +10514,12 @@ namespace Google.ProtocolBuffers.TestProtos {
return
result
.
GetRepeatedCordField
(
index
);
}
public
Builder
SetRepeatedCordField
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedCordField_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddRepeatedCordField
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
repeatedCordField_
.
Add
(
value
);
return
this
;
}
...
...
@@ -10671,6 +10763,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetMyString
(
value
);
}
}
public
Builder
SetMyString
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasMyString
=
true
;
result
.
myString_
=
value
;
return
this
;
...
...
@@ -11009,6 +11102,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetEscapedBytes
(
value
);
}
}
public
Builder
SetEscapedBytes
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasEscapedBytes
=
true
;
result
.
escapedBytes_
=
value
;
return
this
;
...
...
@@ -11099,6 +11193,7 @@ namespace Google.ProtocolBuffers.TestProtos {
set
{
SetUtf8String
(
value
);
}
}
public
Builder
SetUtf8String
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasUtf8String
=
true
;
result
.
utf8String_
=
value
;
return
this
;
...
...
src/ProtocolBuffers.Test/TestUtil.cs
View file @
642a8140
...
...
@@ -1383,5 +1383,14 @@ namespace Google.ProtocolBuffers {
}
return
bytes
;
}
internal
static
void
AssertArgumentNullException
(
Action
action
)
{
try
{
action
();
Assert
.
Fail
(
"Exception was not thrown"
);
}
catch
(
ArgumentNullException
)
{
// We expect this exception.
}
}
}
}
src/ProtocolBuffers.Test/TextFormatTest.cs
View file @
642a8140
...
...
@@ -499,5 +499,29 @@ namespace Google.ProtocolBuffers {
AssertFormatException
(()
=>
TextFormat
.
ParseUInt64
(
"-1"
));
AssertFormatException
(()
=>
TextFormat
.
ParseInt32
(
"abcd"
));
}
[
Test
]
public
void
ParseLongString
()
{
string
longText
=
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
+
"123456789012345678901234567890123456789012345678901234567890"
;
TestAllTypes
.
Builder
builder
=
TestAllTypes
.
CreateBuilder
();
TextFormat
.
Merge
(
"optional_string: \""
+
longText
+
"\""
,
builder
);
Assert
.
AreEqual
(
longText
,
builder
.
OptionalString
);
}
}
}
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
View file @
642a8140
...
...
@@ -192,6 +192,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetNamespace
(
value
);
}
}
public
Builder
SetNamespace
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasNamespace
=
true
;
result
.
namespace_
=
value
;
return
this
;
...
...
@@ -210,6 +211,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetUmbrellaClassname
(
value
);
}
}
public
Builder
SetUmbrellaClassname
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasUmbrellaClassname
=
true
;
result
.
umbrellaClassname_
=
value
;
return
this
;
...
...
@@ -381,6 +383,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetPropertyName
(
value
);
}
}
public
Builder
SetPropertyName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasPropertyName
=
true
;
result
.
propertyName_
=
value
;
return
this
;
...
...
src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
View file @
642a8140
...
...
@@ -379,18 +379,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetFile
(
index
);
}
public
Builder
SetFile
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
file_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetFile
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
file_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddFile
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
file_
.
Add
(
value
);
return
this
;
}
public
Builder
AddFile
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
file_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -782,6 +786,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -800,6 +805,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetPackage
(
value
);
}
}
public
Builder
SetPackage
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasPackage
=
true
;
result
.
package_
=
value
;
return
this
;
...
...
@@ -820,10 +826,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetDependency
(
index
);
}
public
Builder
SetDependency
(
int
index
,
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
dependency_
[
index
]
=
value
;
return
this
;
}
public
Builder
AddDependency
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
dependency_
.
Add
(
value
);
return
this
;
}
...
...
@@ -846,18 +854,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetMessageType
(
index
);
}
public
Builder
SetMessageType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
messageType_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetMessageType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
messageType_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddMessageType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
messageType_
.
Add
(
value
);
return
this
;
}
public
Builder
AddMessageType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
messageType_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -880,18 +892,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetEnumType
(
index
);
}
public
Builder
SetEnumType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
enumType_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetEnumType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
enumType_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddEnumType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
enumType_
.
Add
(
value
);
return
this
;
}
public
Builder
AddEnumType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
enumType_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -914,18 +930,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetService
(
index
);
}
public
Builder
SetService
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
service_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetService
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
service_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddService
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
service_
.
Add
(
value
);
return
this
;
}
public
Builder
AddService
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
service_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -948,18 +968,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetExtension
(
index
);
}
public
Builder
SetExtension
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
extension_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetExtension
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
extension_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddExtension
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
extension_
.
Add
(
value
);
return
this
;
}
public
Builder
AddExtension
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
extension_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -980,16 +1004,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FileOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -1601,6 +1628,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -1621,18 +1649,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetField
(
index
);
}
public
Builder
SetField
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetField
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
field_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddField
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
field_
.
Add
(
value
);
return
this
;
}
public
Builder
AddField
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
field_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -1655,18 +1687,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetExtension
(
index
);
}
public
Builder
SetExtension
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
extension_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetExtension
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
extension_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddExtension
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
extension_
.
Add
(
value
);
return
this
;
}
public
Builder
AddExtension
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
extension_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -1689,18 +1725,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetNestedType
(
index
);
}
public
Builder
SetNestedType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
nestedType_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetNestedType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
nestedType_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddNestedType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
nestedType_
.
Add
(
value
);
return
this
;
}
public
Builder
AddNestedType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
nestedType_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -1723,18 +1763,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetEnumType
(
index
);
}
public
Builder
SetEnumType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
enumType_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetEnumType
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
enumType_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddEnumType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
enumType_
.
Add
(
value
);
return
this
;
}
public
Builder
AddEnumType
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
enumType_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -1757,18 +1801,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetExtensionRange
(
index
);
}
public
Builder
SetExtensionRange
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Types
.
ExtensionRange
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
extensionRange_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetExtensionRange
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Types
.
ExtensionRange
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
extensionRange_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddExtensionRange
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Types
.
ExtensionRange
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
extensionRange_
.
Add
(
value
);
return
this
;
}
public
Builder
AddExtensionRange
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
DescriptorProto
.
Types
.
ExtensionRange
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
extensionRange_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -1789,16 +1837,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MessageOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MessageOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MessageOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MessageOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MessageOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -2200,6 +2251,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -2272,6 +2324,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetTypeName
(
value
);
}
}
public
Builder
SetTypeName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasTypeName
=
true
;
result
.
typeName_
=
value
;
return
this
;
...
...
@@ -2290,6 +2343,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetExtendee
(
value
);
}
}
public
Builder
SetExtendee
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasExtendee
=
true
;
result
.
extendee_
=
value
;
return
this
;
...
...
@@ -2308,6 +2362,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetDefaultValue
(
value
);
}
}
public
Builder
SetDefaultValue
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasDefaultValue
=
true
;
result
.
defaultValue_
=
value
;
return
this
;
...
...
@@ -2326,16 +2381,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
FieldOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -2593,6 +2651,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -2613,18 +2672,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetValue
(
index
);
}
public
Builder
SetValue
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
value_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetValue
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
value_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddValue
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
value_
.
Add
(
value
);
return
this
;
}
public
Builder
AddValue
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
value_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -2645,16 +2708,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -2904,6 +2970,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -2940,16 +3007,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
EnumValueOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -3207,6 +3277,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -3227,18 +3298,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetMethod
(
index
);
}
public
Builder
SetMethod
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
method_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetMethod
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
method_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddMethod
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodDescriptorProto
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
method_
.
Add
(
value
);
return
this
;
}
public
Builder
AddMethod
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodDescriptorProto
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
method_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -3259,16 +3334,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
ServiceOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -3540,6 +3618,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetName
(
value
);
}
}
public
Builder
SetName
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasName
=
true
;
result
.
name_
=
value
;
return
this
;
...
...
@@ -3558,6 +3637,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetInputType
(
value
);
}
}
public
Builder
SetInputType
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasInputType
=
true
;
result
.
inputType_
=
value
;
return
this
;
...
...
@@ -3576,6 +3656,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOutputType
(
value
);
}
}
public
Builder
SetOutputType
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOutputType
=
true
;
result
.
outputType_
=
value
;
return
this
;
...
...
@@ -3594,16 +3675,19 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetOptions
(
value
);
}
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasOptions
=
true
;
result
.
options_
=
value
;
return
this
;
}
public
Builder
SetOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodOptions
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
hasOptions
=
true
;
result
.
options_
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
MergeOptions
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodOptions
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
if
(
result
.
HasOptions
&&
result
.
options_
!=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodOptions
.
DefaultInstance
)
{
result
.
options_
=
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
MethodOptions
.
CreateBuilder
(
result
.
options_
).
MergeFrom
(
value
).
BuildPartial
();
...
...
@@ -3916,6 +4000,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetJavaPackage
(
value
);
}
}
public
Builder
SetJavaPackage
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasJavaPackage
=
true
;
result
.
javaPackage_
=
value
;
return
this
;
...
...
@@ -3934,6 +4019,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetJavaOuterClassname
(
value
);
}
}
public
Builder
SetJavaOuterClassname
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasJavaOuterClassname
=
true
;
result
.
javaOuterClassname_
=
value
;
return
this
;
...
...
@@ -3990,18 +4076,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -4250,18 +4340,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -4545,6 +4639,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetExperimentalMapKey
(
value
);
}
}
public
Builder
SetExperimentalMapKey
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasExperimentalMapKey
=
true
;
result
.
experimentalMapKey_
=
value
;
return
this
;
...
...
@@ -4565,18 +4660,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -4785,18 +4884,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -5005,18 +5108,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -5225,18 +5332,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -5445,18 +5556,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetUninterpretedOption
(
index
);
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetUninterpretedOption
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
uninterpretedOption_
.
Add
(
value
);
return
this
;
}
public
Builder
AddUninterpretedOption
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
uninterpretedOption_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -5699,6 +5814,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetNamePart_
(
value
);
}
}
public
Builder
SetNamePart_
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasNamePart_
=
true
;
result
.
namePart_
=
value
;
return
this
;
...
...
@@ -6010,18 +6126,22 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
return
result
.
GetName
(
index
);
}
public
Builder
SetName
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Types
.
NamePart
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
name_
[
index
]
=
value
;
return
this
;
}
public
Builder
SetName
(
int
index
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Types
.
NamePart
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
name_
[
index
]
=
builderForValue
.
Build
();
return
this
;
}
public
Builder
AddName
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Types
.
NamePart
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
name_
.
Add
(
value
);
return
this
;
}
public
Builder
AddName
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
UninterpretedOption
.
Types
.
NamePart
.
Builder
builderForValue
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
builderForValue
,
"builderForValue"
);
result
.
name_
.
Add
(
builderForValue
.
Build
());
return
this
;
}
...
...
@@ -6042,6 +6162,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetIdentifierValue
(
value
);
}
}
public
Builder
SetIdentifierValue
(
string
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasIdentifierValue
=
true
;
result
.
identifierValue_
=
value
;
return
this
;
...
...
@@ -6114,6 +6235,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
set
{
SetStringValue
(
value
);
}
}
public
Builder
SetStringValue
(
pb
::
ByteString
value
)
{
pb
::
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
result
.
hasStringValue
=
true
;
result
.
stringValue_
=
value
;
return
this
;
...
...
src/ProtocolBuffers/FieldAccess/RepeatedEnumAccessor.cs
View file @
642a8140
...
...
@@ -66,10 +66,12 @@ namespace Google.ProtocolBuffers.FieldAccess {
}
public
override
void
AddRepeated
(
TBuilder
builder
,
object
value
)
{
base
.
AddRepeated
(
builder
,
((
EnumValueDescriptor
)
value
).
Number
);
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
base
.
AddRepeated
(
builder
,
((
EnumValueDescriptor
)
value
).
Number
);
}
public
override
void
SetRepeated
(
TBuilder
builder
,
int
index
,
object
value
)
{
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
base
.
SetRepeated
(
builder
,
index
,
((
EnumValueDescriptor
)
value
).
Number
);
}
}
...
...
src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs
View file @
642a8140
...
...
@@ -64,7 +64,7 @@ namespace Google.ProtocolBuffers.FieldAccess {
/// which may already be of the right type or may be a dynamic message.
/// </summary>
private
object
CoerceType
(
object
value
)
{
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
// If it's already of the right type, we're done
if
(
ClrType
.
IsInstanceOfType
(
value
))
{
return
value
;
...
...
src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs
View file @
642a8140
...
...
@@ -122,10 +122,12 @@ namespace Google.ProtocolBuffers.FieldAccess {
}
public
virtual
void
SetRepeated
(
TBuilder
builder
,
int
index
,
object
value
)
{
setElementMethod
.
Invoke
(
builder
,
new
object
[]
{
index
,
value
}
);
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
setElementMethod
.
Invoke
(
builder
,
new
object
[]
{
index
,
value
});
}
public
virtual
void
AddRepeated
(
TBuilder
builder
,
object
value
)
{
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
addValueDelegate
(
builder
,
value
);
}
...
...
src/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs
View file @
642a8140
...
...
@@ -63,6 +63,7 @@ namespace Google.ProtocolBuffers.FieldAccess {
/// from an EnumValueDescriptor parameter.
/// </summary>
public
override
void
SetValue
(
TBuilder
builder
,
object
value
)
{
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
EnumValueDescriptor
valueDescriptor
=
(
EnumValueDescriptor
)
value
;
base
.
SetValue
(
builder
,
valueDescriptor
.
Number
);
}
...
...
src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs
View file @
642a8140
...
...
@@ -60,7 +60,7 @@ namespace Google.ProtocolBuffers.FieldAccess {
/// which may already be of the right type or may be a dynamic message.
/// </summary>
private
object
CoerceType
(
object
value
)
{
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
// If it's already of the right type, we're done
if
(
ClrType
.
IsInstanceOfType
(
value
))
{
return
value
;
...
...
src/ProtocolBuffers/FieldSet.cs
View file @
642a8140
...
...
@@ -413,7 +413,9 @@ namespace Google.ProtocolBuffers {
/// element type, not whether it's a list.
/// </remarks>
/// <exception cref="ArgumentException">The value is not of the right type.</exception>
/// <exception cref="ArgumentNullException">The value is null.</exception>
private
static
void
VerifyType
(
FieldDescriptor
field
,
object
value
)
{
ThrowHelper
.
ThrowIfNull
(
value
,
"value"
);
bool
isValid
=
false
;
switch
(
field
.
MappedType
)
{
case
MappedType
.
Int32
:
isValid
=
value
is
int
;
break
;
...
...
src/ProtocolBuffers/GeneratedBuilder.cs
View file @
642a8140
...
...
@@ -78,7 +78,13 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Adds all of the specified values to the given collection.
/// </summary>
/// <exception cref="ArgumentNullException">Any element of the list is null</exception>
protected
void
AddRange
<
T
>(
IEnumerable
<
T
>
source
,
IList
<
T
>
destination
)
{
ThrowHelper
.
ThrowIfNull
(
source
);
// We only need to check this for nullable types.
if
(
default
(
T
)
==
null
)
{
ThrowHelper
.
ThrowIfAnyNull
(
source
);
}
List
<
T
>
list
=
destination
as
List
<
T
>;
if
(
list
!=
null
)
{
list
.
AddRange
(
source
);
...
...
src/ProtocolBuffers/ProtocolBuffers.csproj
View file @
642a8140
...
...
@@ -104,6 +104,7 @@
<Compile
Include=
"TextFormat.cs"
/>
<Compile
Include=
"TextGenerator.cs"
/>
<Compile
Include=
"TextTokenizer.cs"
/>
<Compile
Include=
"ThrowHelper.cs"
/>
<Compile
Include=
"UninitializedMessageException.cs"
/>
<Compile
Include=
"UnknownField.cs"
/>
<Compile
Include=
"UnknownFieldSet.cs"
/>
...
...
src/ProtocolBuffers/ThrowHelper.cs
0 → 100644
View file @
642a8140
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Google.ProtocolBuffers
{
/// <summary>
/// Helper methods for throwing exceptions
/// </summary>
public
static
class
ThrowHelper
{
/// <summary>
/// Throws an ArgumentNullException if the given value is null.
/// </summary>
public
static
void
ThrowIfNull
(
object
value
,
string
name
)
{
if
(
value
==
null
)
{
throw
new
ArgumentNullException
(
name
);
}
}
/// <summary>
/// Throws an ArgumentNullException if the given value is null.
/// </summary>
public
static
void
ThrowIfNull
(
object
value
)
{
if
(
value
==
null
)
{
throw
new
ArgumentNullException
();
}
}
/// <summary>
/// Throws an ArgumentNullException if the given value or any element within it is null.
/// </summary>
public
static
void
ThrowIfAnyNull
<
T
>(
IEnumerable
<
T
>
sequence
)
{
foreach
(
T
t
in
sequence
)
{
if
(
t
==
null
)
{
throw
new
ArgumentNullException
();
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment