diff --git a/Google.Protobuf/Reflection/FieldCollection.vb b/Google.Protobuf/Reflection/FieldCollection.vb
new file mode 100644
index 0000000..7d8852d
--- /dev/null
+++ b/Google.Protobuf/Reflection/FieldCollection.vb
@@ -0,0 +1,81 @@
+Namespace Google.Protobuf.Reflection
+
+ '''
+ ''' A collection to simplify retrieving the field accessor for a particular field.
+ '''
+ Public NotInheritable Class FieldCollection
+ Private ReadOnly messageDescriptor As MessageDescriptor
+
+ Friend Sub New(messageDescriptor As MessageDescriptor)
+ Me.messageDescriptor = messageDescriptor
+ End Sub
+
+ '''
+ ''' Returns the fields in the message as an immutable list, in the order in which they
+ ''' are declared in the source .proto file.
+ '''
+ Public Function InDeclarationOrder() As IList(Of FieldDescriptor)
+ Return messageDescriptor.fieldsInDeclarationOrder
+ End Function
+
+ '''
+ ''' Returns the fields in the message as an immutable list, in ascending field number
+ ''' order. Field numbers need not be contiguous, so there is no direct mapping from the
+ ''' index in the list to the field number; to retrieve a field by field number, it is better
+ ''' to use the indexer.
+ '''
+ Public Function InFieldNumberOrder() As IList(Of FieldDescriptor)
+ Return messageDescriptor.fieldsInNumberOrder
+ End Function
+
+ ' TODO: consider making this public in the future. (Being conservative for now...)
+
+ '''
+ ''' Returns a read-only dictionary mapping the field names in this message as they're available
+ ''' in the JSON representation to the field descriptors. For example, a field foo_bar
+ ''' in the message would result two entries, one with a key fooBar and one with a key
+ ''' foo_bar, both referring to the same field.
+ '''
+ Friend Function ByJsonName() As IDictionary(Of String, FieldDescriptor)
+ Return messageDescriptor.jsonFieldMap
+ End Function
+
+ '''
+ ''' Retrieves the descriptor for the field with the given number.
+ '''
+ ''' Number of the field to retrieve the descriptor for
+ ''' The accessor for the given field
+ ''' The message descriptor does not contain a field
+ ''' with the given number
+ Default Public ReadOnly Property Item(number As Integer) As FieldDescriptor
+ Get
+ Dim fieldDescriptor = messageDescriptor.FindFieldByNumber(number)
+
+ If fieldDescriptor Is Nothing Then
+ Throw New KeyNotFoundException("No such field number")
+ End If
+
+ Return fieldDescriptor
+ End Get
+ End Property
+
+ '''
+ ''' Retrieves the descriptor for the field with the given name.
+ '''
+ ''' Name of the field to retrieve the descriptor for
+ ''' The descriptor for the given field
+ ''' The message descriptor does not contain a field
+ ''' with the given name
+ Default Public ReadOnly Property Item(name As String) As FieldDescriptor
+ Get
+ Dim fieldDescriptor = messageDescriptor.FindFieldByName(name)
+
+ If fieldDescriptor Is Nothing Then
+ Throw New KeyNotFoundException("No such field name")
+ End If
+
+ Return fieldDescriptor
+ End Get
+ End Property
+ End Class
+End Namespace
\ No newline at end of file
diff --git a/Google.Protobuf/Reflection/MessageDescriptor.vb b/Google.Protobuf/Reflection/MessageDescriptor.vb
index dc00551..128c1cd 100644
--- a/Google.Protobuf/Reflection/MessageDescriptor.vb
+++ b/Google.Protobuf/Reflection/MessageDescriptor.vb
@@ -58,9 +58,9 @@ Namespace Google.Protobuf.Reflection
"google/protobuf/struct.proto",
"google/protobuf/type.proto"
}
- Private ReadOnly fieldsInDeclarationOrder As IList(Of FieldDescriptor)
- Private ReadOnly fieldsInNumberOrder As IList(Of FieldDescriptor)
- Private ReadOnly jsonFieldMap As IDictionary(Of String, FieldDescriptor)
+ Friend ReadOnly fieldsInDeclarationOrder As IList(Of FieldDescriptor)
+ Friend ReadOnly fieldsInNumberOrder As IList(Of FieldDescriptor)
+ Friend ReadOnly jsonFieldMap As IDictionary(Of String, FieldDescriptor)
Friend Sub New(proto As DescriptorProto, file As FileDescriptor, parent As MessageDescriptor, typeIndex As Integer, generatedCodeInfo As GeneratedClrTypeInfo)
MyBase.New(file, file.ComputeFullName(parent, proto.Name), typeIndex)
@@ -235,84 +235,5 @@ Namespace Google.Protobuf.Reflection
oneof.CrossLink()
Next
End Sub
-
- '''
- ''' A collection to simplify retrieving the field accessor for a particular field.
- '''
- Public NotInheritable Class FieldCollection
- Private ReadOnly messageDescriptor As MessageDescriptor
-
- Friend Sub New(messageDescriptor As MessageDescriptor)
- Me.messageDescriptor = messageDescriptor
- End Sub
-
- '''
- ''' Returns the fields in the message as an immutable list, in the order in which they
- ''' are declared in the source .proto file.
- '''
- Public Function InDeclarationOrder() As IList(Of FieldDescriptor)
- Return messageDescriptor.fieldsInDeclarationOrder
- End Function
-
- '''
- ''' Returns the fields in the message as an immutable list, in ascending field number
- ''' order. Field numbers need not be contiguous, so there is no direct mapping from the
- ''' index in the list to the field number; to retrieve a field by field number, it is better
- ''' to use the indexer.
- '''
- Public Function InFieldNumberOrder() As IList(Of FieldDescriptor)
- Return messageDescriptor.fieldsInNumberOrder
- End Function
-
- ' TODO: consider making this public in the future. (Being conservative for now...)
-
- '''
- ''' Returns a read-only dictionary mapping the field names in this message as they're available
- ''' in the JSON representation to the field descriptors. For example, a field foo_bar
- ''' in the message would result two entries, one with a key fooBar and one with a key
- ''' foo_bar, both referring to the same field.
- '''
- Friend Function ByJsonName() As IDictionary(Of String, FieldDescriptor)
- Return messageDescriptor.jsonFieldMap
- End Function
-
- '''
- ''' Retrieves the descriptor for the field with the given number.
- '''
- ''' Number of the field to retrieve the descriptor for
- ''' The accessor for the given field
- ''' The message descriptor does not contain a field
- ''' with the given number
- Default Public ReadOnly Property Item(number As Integer) As FieldDescriptor
- Get
- Dim fieldDescriptor = messageDescriptor.FindFieldByNumber(number)
-
- If fieldDescriptor Is Nothing Then
- Throw New KeyNotFoundException("No such field number")
- End If
-
- Return fieldDescriptor
- End Get
- End Property
-
- '''
- ''' Retrieves the descriptor for the field with the given name.
- '''
- ''' Name of the field to retrieve the descriptor for
- ''' The descriptor for the given field
- ''' The message descriptor does not contain a field
- ''' with the given name
- Default Public ReadOnly Property Item(name As String) As FieldDescriptor
- Get
- Dim fieldDescriptor = messageDescriptor.FindFieldByName(name)
-
- If fieldDescriptor Is Nothing Then
- Throw New KeyNotFoundException("No such field name")
- End If
-
- Return fieldDescriptor
- End Get
- End Property
- End Class
End Class
End Namespace