Class: Gapic::Schema::Message
- Extended by:
- Forwardable
- Defined in:
- lib/gapic/schema/wrappers.rb
Overview
Wrapper for a protobuf Message.
Instance Attribute Summary collapse
-
#extensions ⇒ Object
readonly
@ return [Enumerable
] The extensions of a message. -
#fields ⇒ Object
readonly
@ return [Enumerable
] The fields of a message. -
#nested_enums ⇒ Object
readonly
@ return [Enumerable
] The nested enum declarations of a message. -
#nested_messages ⇒ Object
readonly
@ return [Enumerable
] The nested message declarations of a message. -
#resource ⇒ Object
readonly
@ return [Resource,nil] A representation of the resource.
Attributes inherited from Proto
#address, #descriptor, #docs, #parent
Instance Method Summary collapse
-
#full_name ⇒ String
The full name for this message (e.g.
google.example.Message). -
#initialize(descriptor, address, docs, fields, extensions, resource, nested_messages, nested_enums) ⇒ Message
constructor
Initializes a message object.
-
#map_entry? ⇒ Boolean
Whether this type is a map entry.
-
#name ⇒ String
The unqualified name of the message.
-
#oneof_decl ⇒ Array<Google::Protobuf::OneofDescriptorProto>
The oneofs declared in this message.
-
#options ⇒ Array<Google::Protobuf::MessageOptions>
The options of this meessage.
Methods inherited from Proto
#containing_api, #containing_file, #docs_leading_comments, #leading_comments, #leading_detached_comments, #path, #span, #trailing_comments
Constructor Details
#initialize(descriptor, address, docs, fields, extensions, resource, nested_messages, nested_enums) ⇒ Message
Initializes a message object.
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
# File 'lib/gapic/schema/wrappers.rb', line 596 def initialize descriptor, address, docs, fields, extensions, resource, , nested_enums super descriptor, address, docs @fields = fields || [] @extensions = extensions || [] @resource = resource @nested_messages = || [] @nested_enums = nested_enums || [] @fields.each { |f| f.parent = self } @extensions.each { |x| x.parent = self } @nested_messages.each { |m| m.parent = self } @nested_enums.each { |e| e.parent = self } @resource.parent = self if @resource end |
Instance Attribute Details
#extensions ⇒ Object (readonly)
@ return [Enumerable
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/gapic/schema/wrappers.rb', line 573 class Message < Proto extend Forwardable attr_reader :fields attr_reader :extensions attr_reader :resource attr_reader :nested_messages attr_reader :nested_enums # Initializes a message object. # @param descriptor [Google::Protobuf::DescriptorProto] the protobuf # representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param fields [Enumerable<Field>] The fields of this message. # @param extensions [Enumerable<Field>] The extensions of this message. # @param resource [Resource,nil] The resource of this message, or nil if none. # @param nested_messages [Enumerable<Message>] The nested message # declarations of this message. # @param nested_enums [Enumerable<Enum>] The nested enum declarations # of this message. def initialize descriptor, address, docs, fields, extensions, resource, , nested_enums super descriptor, address, docs @fields = fields || [] @extensions = extensions || [] @resource = resource @nested_messages = || [] @nested_enums = nested_enums || [] @fields.each { |f| f.parent = self } @extensions.each { |x| x.parent = self } @nested_messages.each { |m| m.parent = self } @nested_enums.each { |e| e.parent = self } @resource.parent = self if @resource end # @return [Boolean] whether this type is a map entry def map_entry? descriptor.&.map_entry end # @return [String] The full name for this message # (e.g. `google.example.Message`). # Useful when matching against other pieces of information # which also reference full proto name. def full_name @address.join "." end # @!method name # @return [String] the unqualified name of the message. # @!method oneof_decl # @return [Array<Google::Protobuf::OneofDescriptorProto>] # The oneofs declared in this message. # @!method options # @return [Array<Google::Protobuf::MessageOptions>] # The options of this meessage. def_delegators( :descriptor, :name, :oneof_decl, :options ) end |
#fields ⇒ Object (readonly)
@ return [Enumerable
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/gapic/schema/wrappers.rb', line 573 class Message < Proto extend Forwardable attr_reader :fields attr_reader :extensions attr_reader :resource attr_reader :nested_messages attr_reader :nested_enums # Initializes a message object. # @param descriptor [Google::Protobuf::DescriptorProto] the protobuf # representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param fields [Enumerable<Field>] The fields of this message. # @param extensions [Enumerable<Field>] The extensions of this message. # @param resource [Resource,nil] The resource of this message, or nil if none. # @param nested_messages [Enumerable<Message>] The nested message # declarations of this message. # @param nested_enums [Enumerable<Enum>] The nested enum declarations # of this message. def initialize descriptor, address, docs, fields, extensions, resource, , nested_enums super descriptor, address, docs @fields = fields || [] @extensions = extensions || [] @resource = resource @nested_messages = || [] @nested_enums = nested_enums || [] @fields.each { |f| f.parent = self } @extensions.each { |x| x.parent = self } @nested_messages.each { |m| m.parent = self } @nested_enums.each { |e| e.parent = self } @resource.parent = self if @resource end # @return [Boolean] whether this type is a map entry def map_entry? descriptor.&.map_entry end # @return [String] The full name for this message # (e.g. `google.example.Message`). # Useful when matching against other pieces of information # which also reference full proto name. def full_name @address.join "." end # @!method name # @return [String] the unqualified name of the message. # @!method oneof_decl # @return [Array<Google::Protobuf::OneofDescriptorProto>] # The oneofs declared in this message. # @!method options # @return [Array<Google::Protobuf::MessageOptions>] # The options of this meessage. def_delegators( :descriptor, :name, :oneof_decl, :options ) end |
#nested_enums ⇒ Object (readonly)
@ return [Enumerable
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/gapic/schema/wrappers.rb', line 573 class Message < Proto extend Forwardable attr_reader :fields attr_reader :extensions attr_reader :resource attr_reader :nested_messages attr_reader :nested_enums # Initializes a message object. # @param descriptor [Google::Protobuf::DescriptorProto] the protobuf # representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param fields [Enumerable<Field>] The fields of this message. # @param extensions [Enumerable<Field>] The extensions of this message. # @param resource [Resource,nil] The resource of this message, or nil if none. # @param nested_messages [Enumerable<Message>] The nested message # declarations of this message. # @param nested_enums [Enumerable<Enum>] The nested enum declarations # of this message. def initialize descriptor, address, docs, fields, extensions, resource, , nested_enums super descriptor, address, docs @fields = fields || [] @extensions = extensions || [] @resource = resource @nested_messages = || [] @nested_enums = nested_enums || [] @fields.each { |f| f.parent = self } @extensions.each { |x| x.parent = self } @nested_messages.each { |m| m.parent = self } @nested_enums.each { |e| e.parent = self } @resource.parent = self if @resource end # @return [Boolean] whether this type is a map entry def map_entry? descriptor.&.map_entry end # @return [String] The full name for this message # (e.g. `google.example.Message`). # Useful when matching against other pieces of information # which also reference full proto name. def full_name @address.join "." end # @!method name # @return [String] the unqualified name of the message. # @!method oneof_decl # @return [Array<Google::Protobuf::OneofDescriptorProto>] # The oneofs declared in this message. # @!method options # @return [Array<Google::Protobuf::MessageOptions>] # The options of this meessage. def_delegators( :descriptor, :name, :oneof_decl, :options ) end |
#nested_messages ⇒ Object (readonly)
@ return [Enumerable
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/gapic/schema/wrappers.rb', line 573 class Message < Proto extend Forwardable attr_reader :fields attr_reader :extensions attr_reader :resource attr_reader :nested_messages attr_reader :nested_enums # Initializes a message object. # @param descriptor [Google::Protobuf::DescriptorProto] the protobuf # representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param fields [Enumerable<Field>] The fields of this message. # @param extensions [Enumerable<Field>] The extensions of this message. # @param resource [Resource,nil] The resource of this message, or nil if none. # @param nested_messages [Enumerable<Message>] The nested message # declarations of this message. # @param nested_enums [Enumerable<Enum>] The nested enum declarations # of this message. def initialize descriptor, address, docs, fields, extensions, resource, , nested_enums super descriptor, address, docs @fields = fields || [] @extensions = extensions || [] @resource = resource @nested_messages = || [] @nested_enums = nested_enums || [] @fields.each { |f| f.parent = self } @extensions.each { |x| x.parent = self } @nested_messages.each { |m| m.parent = self } @nested_enums.each { |e| e.parent = self } @resource.parent = self if @resource end # @return [Boolean] whether this type is a map entry def map_entry? descriptor.&.map_entry end # @return [String] The full name for this message # (e.g. `google.example.Message`). # Useful when matching against other pieces of information # which also reference full proto name. def full_name @address.join "." end # @!method name # @return [String] the unqualified name of the message. # @!method oneof_decl # @return [Array<Google::Protobuf::OneofDescriptorProto>] # The oneofs declared in this message. # @!method options # @return [Array<Google::Protobuf::MessageOptions>] # The options of this meessage. def_delegators( :descriptor, :name, :oneof_decl, :options ) end |
#resource ⇒ Object (readonly)
@ return [Resource,nil] A representation of the resource.
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/gapic/schema/wrappers.rb', line 573 class Message < Proto extend Forwardable attr_reader :fields attr_reader :extensions attr_reader :resource attr_reader :nested_messages attr_reader :nested_enums # Initializes a message object. # @param descriptor [Google::Protobuf::DescriptorProto] the protobuf # representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param fields [Enumerable<Field>] The fields of this message. # @param extensions [Enumerable<Field>] The extensions of this message. # @param resource [Resource,nil] The resource of this message, or nil if none. # @param nested_messages [Enumerable<Message>] The nested message # declarations of this message. # @param nested_enums [Enumerable<Enum>] The nested enum declarations # of this message. def initialize descriptor, address, docs, fields, extensions, resource, , nested_enums super descriptor, address, docs @fields = fields || [] @extensions = extensions || [] @resource = resource @nested_messages = || [] @nested_enums = nested_enums || [] @fields.each { |f| f.parent = self } @extensions.each { |x| x.parent = self } @nested_messages.each { |m| m.parent = self } @nested_enums.each { |e| e.parent = self } @resource.parent = self if @resource end # @return [Boolean] whether this type is a map entry def map_entry? descriptor.&.map_entry end # @return [String] The full name for this message # (e.g. `google.example.Message`). # Useful when matching against other pieces of information # which also reference full proto name. def full_name @address.join "." end # @!method name # @return [String] the unqualified name of the message. # @!method oneof_decl # @return [Array<Google::Protobuf::OneofDescriptorProto>] # The oneofs declared in this message. # @!method options # @return [Array<Google::Protobuf::MessageOptions>] # The options of this meessage. def_delegators( :descriptor, :name, :oneof_decl, :options ) end |
Instance Method Details
#full_name ⇒ String
Returns The full name for this message
(e.g. google.example.Message).
Useful when matching against other pieces of information
which also reference full proto name.
621 622 623 |
# File 'lib/gapic/schema/wrappers.rb', line 621 def full_name @address.join "." end |
#map_entry? ⇒ Boolean
Returns whether this type is a map entry.
613 614 615 |
# File 'lib/gapic/schema/wrappers.rb', line 613 def map_entry? descriptor.&.map_entry end |
#name ⇒ String
Returns the unqualified name of the message.
633 634 635 636 637 638 |
# File 'lib/gapic/schema/wrappers.rb', line 633 def_delegators( :descriptor, :name, :oneof_decl, :options ) |
#oneof_decl ⇒ Array<Google::Protobuf::OneofDescriptorProto>
Returns The oneofs declared in this message.
633 634 635 636 637 638 |
# File 'lib/gapic/schema/wrappers.rb', line 633 def_delegators( :descriptor, :name, :oneof_decl, :options ) |
#options ⇒ Array<Google::Protobuf::MessageOptions>
Returns The options of this meessage.
633 634 635 636 637 638 |
# File 'lib/gapic/schema/wrappers.rb', line 633 def_delegators( :descriptor, :name, :oneof_decl, :options ) |