The goog.proto2.Descriptor Class

goog.proto2.Descriptor(messageType, metadata, fields)

A class which describes a Protocol Buffer 2 Message.

messageType {function(new:goog.proto2.Message)}
Constructor for the message class that this descriptor describes.
metadata {!goog.proto2.Metadata}
The metadata about the message that will be used to construct this descriptor.
fields {Array.<!goog.proto2.FieldDescriptor>}
The fields of the message described by this descriptor.

.createMessageInstance()

Creates an instance of the message type that this descriptor describes.

returns {!goog.proto2.Message}
The instance of the message.

.findFieldByName(name)

Returns the field matching the given name, if any. Note that this method searches over the *original* name of the field, not the camelCase version.

name {string}
The field name for which to search.
returns {goog.proto2.FieldDescriptor}
The field found, if any.

.findFieldByTag(tag)

Returns the field matching the given tag number, if any.

tag {number|string}
The field tag number for which to search.
returns {goog.proto2.FieldDescriptor}
The field found, if any.

.getContainingType()

Returns the descriptor of the containing message type or null if none.

returns {goog.proto2.Descriptor}
The descriptor.

.getFields()

Returns the fields in the message described by this descriptor ordered by tag.

returns {!Array.<!goog.proto2.FieldDescriptor>}
The array of field descriptors.

.getFieldsMap()

Returns the fields in the message as a key/value map, where the key is the tag number of the field. DO NOT MODIFY THE RETURNED OBJECT. We return the actual, internal, fields map for performance reasons, and changing the map can result in undefined behavior of this library.

returns {!Object.<number, !goog.proto2.FieldDescriptor>}
The field map.

.getFullName()

Returns the full name of the message, if any.

returns {?string}
The name.

.getName()

Returns the name of the message, if any.

returns {?string}
The name.