Class: ProtobufDescriptor::MessageDescriptor

Inherits:
Object
  • Object
show all
Includes:
HasChildren, HasParent, NamedChild
Defined in:
lib/protobuf_descriptor/message_descriptor.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasChildren

#compute_source_code_info_path_component, included, #named_children

Methods included from NamedChild

#fully_qualified_java_name, #fully_qualified_name, #fully_qualified_ruby_name, #fully_qualified_wire_name, #inspect

Methods included from HasParent

#compute_source_code_info_path, #file_descriptor, #leading_comments, #protobuf_descriptor, #source_code_info_location, #source_code_info_locations, #source_code_info_span, #trailing_comments

Constructor Details

#initialize(parent, message_descriptor_proto) ⇒ MessageDescriptor

Returns a new instance of MessageDescriptor.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 41

def initialize(parent, message_descriptor_proto)
  @parent = parent
  @message_descriptor_proto = message_descriptor_proto

  @nested_type = ProtobufDescriptor::NamedCollection.new(
      message_descriptor_proto.nested_type.map { |m|
          ProtobufDescriptor::MessageDescriptor.new(self, m)
      })

  @enum_type = ProtobufDescriptor::NamedCollection.new(
      message_descriptor_proto.enum_type.map { |m|
          ProtobufDescriptor::EnumDescriptor.new(self, m)
      })

  @field = ProtobufDescriptor::NamedCollection.new(
      message_descriptor_proto.field.map { |m|
          ProtobufDescriptor::FieldDescriptor.new(self, m)
      })
end

Instance Attribute Details

#enum_typeObject (readonly) Also known as: enum_types, enums

The enums that are defined at the top level of this message, as a NamedCollection of EnumDescriptor



26
27
28
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 26

def enum_type
  @enum_type
end

#fieldObject (readonly) Also known as: fields

The fields of this message, as a NamedCollection of FieldDescriptor



32
33
34
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 32

def field
  @field
end

#message_descriptor_protoObject (readonly)

The +MessageDescriptorProto+ this +MessageDescriptor+ is wrapping.



16
17
18
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 16

def message_descriptor_proto
  @message_descriptor_proto
end

#nested_typeObject (readonly) Also known as: nested_types, messages

The messages that are defined at the top level of this message, as a NamedCollection of ProtobufDescriptor::MessageDescriptor



20
21
22
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 20

def nested_type
  @nested_type
end

#parentObject (readonly)

The containing FileDescriptor or ProtobufDescriptor::MessageDescriptor that defines this message.



13
14
15
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 13

def parent
  @parent
end

Instance Method Details

#extensionObject Also known as: extensions

The extensions defined for this message



73
74
75
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 73

def extension
  message_descriptor_proto.extension
end

#extension_rangeObject Also known as: extension_ranges

The extension ranges defined for this message



67
68
69
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 67

def extension_range
  message_descriptor_proto.extension_range
end

#nameObject

The name of the message



79
80
81
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 79

def name
  message_descriptor_proto.name
end

#optionsObject

The +MessageOptions+ defined for this message.



62
63
64
# File 'lib/protobuf_descriptor/message_descriptor.rb', line 62

def options
  message_descriptor_proto.options
end