The goog.proto2.FieldDescriptor Class

goog.proto2.FieldDescriptor(messageType, tag, metadata)

A class which describes a field in a Protocol Buffer 2 Message.

messageType {Function}
Constructor for the message class to which the field described by this class belongs.
tag {number|string}
The field's tag index.
metadata {Object}
The metadata about this field that will be used to construct this descriptor.

The goog.proto2.FieldDescriptor.FieldType Enum

An enumeration defining the possible field types. Should be a mirror of that defined in descriptor.h. … more

.deserializationConversionPermitted()

Returns true if simple conversions between numbers and strings are permitted during deserialization for this field.

returns {boolean}
Whether conversion is permitted.

.getContainingType()

Returns the descriptor describing the message that defined this field.

returns {goog.proto2.Descriptor}
The descriptor.

.getDefaultValue()

Returns the default value of this field.

returns {*}
The default value.

.getFieldMessageType()

Returns the descriptor of the message type of this field. Only valid for fields of type GROUP and MESSAGE.

returns {goog.proto2.Descriptor}
The message descriptor.

.getFieldType()

Returns the field type of the field described by this descriptor.

returns {goog.proto2.FieldDescriptor.FieldType}
The field type.

.getName()

Returns the name of the field that this descriptor represents.

returns {string}
The name.

.getNativeType()

Returns the native (i.e. ECMAScript) type of the field described by this descriptor.

returns {Object}
The native type.

.getTag()

Returns the tag of the field that this descriptor represents.

returns {number}
The tag number.

.isCompositeType()

returns {boolean}
True if the field stores composite data or repeated composite data (message or group).

.isOptional()

Returns whether the field described by this descriptor is optional.

returns {boolean}
Whether the field is optional.

.isRepeated()

Returns whether the field described by this descriptor is repeating.

returns {boolean}
Whether the field is repeated.

.isRequired()

Returns whether the field described by this descriptor is required.

returns {boolean}
Whether the field is required.