Class: ProtobufDescriptor::MessageDescriptor
- Inherits:
-
Object
- Object
- ProtobufDescriptor::MessageDescriptor
- Includes:
- NamedChild
- Defined in:
- lib/protobuf_descriptor/message_descriptor.rb
Overview
Describes a message type.
See DescriptorProto
Defined Under Namespace
Classes: FieldDescriptor
Instance Attribute Summary collapse
-
#enum_type ⇒ Object
(also: #enum_types, #enums)
readonly
The enums that are defined at the top level of this message, as a NamedCollection of EnumDescriptors.
-
#field ⇒ Object
(also: #fields)
readonly
The fields of this message, as a NamedCollection of FieldDescriptors.
-
#message_descriptor_proto ⇒ Object
readonly
The
MessageDescriptorProto
thisMessageDescriptor
is wrapping. -
#nested_type ⇒ Object
(also: #nested_types, #messages)
readonly
The messages that are defined at the top level of this message, as a NamedCollection of MessageDescriptors.
-
#parent ⇒ Object
readonly
The containing FileDescriptor or MessageDescriptor that defines this message.
Instance Method Summary collapse
-
#children ⇒ Object
Set of all top-level messages ahnd enums that are defined within this message.
-
#extension ⇒ Object
(also: #extensions)
The extensions defined for this message.
-
#extension_range ⇒ Object
(also: #extension_ranges)
The extension ranges defined for this message.
-
#initialize(parent, message_descriptor_proto) ⇒ MessageDescriptor
constructor
A new instance of MessageDescriptor.
-
#name ⇒ Object
The name of the message.
-
#options ⇒ Object
The
MessageOptions
defined for this message.
Methods included from NamedChild
#fully_qualified_java_name, #fully_qualified_name, #fully_qualified_ruby_name, #fully_qualified_wire_name
Constructor Details
#initialize(parent, message_descriptor_proto) ⇒ MessageDescriptor
Returns a new instance of MessageDescriptor.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 113 def initialize(parent, ) @parent = parent @message_descriptor_proto = @nested_type = ProtobufDescriptor::NamedCollection.new( .nested_type.map { |m| ProtobufDescriptor::MessageDescriptor.new(self, m) }) @enum_type = ProtobufDescriptor::NamedCollection.new( .enum_type.map { |m| ProtobufDescriptor::EnumDescriptor.new(self, m) }) @field = ProtobufDescriptor::NamedCollection.new( .field.map { |m| ProtobufDescriptor::MessageDescriptor::FieldDescriptor.new(self, m) }) end |
Instance Attribute Details
#enum_type ⇒ Object (readonly) Also known as: enum_types, enums
The enums that are defined at the top level of this message, as a NamedCollection of EnumDescriptors
107 108 109 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 107 def enum_type @enum_type end |
#field ⇒ Object (readonly) Also known as: fields
The fields of this message, as a NamedCollection of FieldDescriptors
111 112 113 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 111 def field @field end |
#message_descriptor_proto ⇒ Object (readonly)
The MessageDescriptorProto
this MessageDescriptor
is wrapping.
99 100 101 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 99 def @message_descriptor_proto end |
#nested_type ⇒ Object (readonly) Also known as: nested_types, messages
The messages that are defined at the top level of this message, as a NamedCollection of MessageDescriptors
103 104 105 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 103 def nested_type @nested_type end |
#parent ⇒ Object (readonly)
The containing FileDescriptor or MessageDescriptor that defines this message.
96 97 98 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 96 def parent @parent end |
Instance Method Details
#children ⇒ Object
Set of all top-level messages ahnd enums that are defined within this message.
162 163 164 165 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 162 def children @children ||= ProtobufDescriptor::NamedCollection.new( @nested_type.collection + @enum_type.collection) end |
#extension ⇒ Object Also known as: extensions
The extensions defined for this message
141 142 143 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 141 def extension .extension end |
#extension_range ⇒ Object Also known as: extension_ranges
The extension ranges defined for this message
136 137 138 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 136 def extension_range .extension_range end |
#name ⇒ Object
The name of the message
146 147 148 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 146 def name .name end |
#options ⇒ Object
The MessageOptions
defined for this message.
131 132 133 |
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 131 def . end |