Home

# Class goog.proto2.Message

Abstract base class for all Protocol Buffer 2 messages. It will be subclassed in the code generated by the Protocol Compiler. Any other subclasses are prohibited.

Instance Method Summary
| `add(?goog.proto2.FieldDescriptor field, <Any Type> value)` Adds the given value to the field specified by the given field descriptor. Note that the field must be repeated.
| `add$Value(number tag, <Any Type> value)` Adds the value to the *repeating* field indicated by the given tag. GENERATED CODE USE ONLY. Basis of the add{Field} methods.
| `array$Values(number tag) ⇒ !Array` Gets the values at the field indicated by the given tag. GENERATED CODE USE ONLY. Basis of the {field}Array methods.
| `arrayOf(?goog.proto2.FieldDescriptor field) ⇒ !Array` Returns the array of values found for the given repeated field.
| `checkFieldType_(!goog.proto2.FieldDescriptor field, <Any Type> value)` Ensures that the value being assigned to the given field is valid.
| `clear(?goog.proto2.FieldDescriptor field)` Clears the field specified.
| `clear$Field(number tag)` Clears the field specified by tag. GENERATED CODE USE ONLY. Basis of the clear{Field} methods.
| `clone() ⇒ !goog.proto2.Message`
| `copyFrom(!goog.proto2.Message message)` Recursively copies the known fields from the given message to this message. Removes the fields which are not present in the source message.
| `count$Values(number tag) ⇒ number` Returns the number of values stored in the field by the given tag. GENERATED CODE USE ONLY. Basis of the {field}Count methods.
| `countOf(?goog.proto2.FieldDescriptor field) ⇒ number` Returns the number of values stored in the given field.
| `equals(<Any Type> other) ⇒ boolean` Compares this message with another one ignoring the unknown fields.
| `forEachUnknown(function (number, *): ? callback, ?Object= opt_scope)` Iterates over all the unknown fields in the message.
| `get(?goog.proto2.FieldDescriptor field, number= opt_index) ⇒ <Any Type>` Returns the value stored at the field specified by the given field descriptor.
| `get$Value(number tag, number= opt_index) ⇒ <Any Type>` Gets the value at the field indicated by the given tag. GENERATED CODE USE ONLY. Basis of the get{Field} methods.
| `get$ValueOrDefault(number tag, number= opt_index) ⇒ <Any Type>` Gets the value at the field indicated by the given tag or the default value if none. GENERATED CODE USE ONLY. Basis of the get{Field} methods.
| `getDescriptor() ⇒ ?goog.proto2.Descriptor` Returns the descriptor which describes the current message.
| `getFieldByTag_(number tag) ⇒ !goog.proto2.FieldDescriptor` Returns the field in this message by the given tag number. If no such field exists, throws an exception.
| `getOrDefault(?goog.proto2.FieldDescriptor field, number= opt_index) ⇒ <Any Type>` Returns the value stored at the field specified by the given field descriptor or the default value if none exists.
| `has(?goog.proto2.FieldDescriptor field) ⇒ boolean` Returns whether there is a value stored at the field specified by the given field descriptor.
| `has$Value(number tag) ⇒ boolean` Returns the whether or not the field indicated by the given tag has a value. GENERATED CODE USE ONLY. Basis of the has{Field} methods.
| `initDefaults(boolean simpleFieldsToo)` Fills in the protocol buffer with default values. Any fields that are already set will not be overridden.
| `initializeForLazyDeserializer(?goog.proto2.LazyDeserializer deserializer, <Any Type> data)` Initializes the message with a lazy deserializer and its associated data. This method should be called by internal methods ONLY.
| `lazyDeserialize_(?goog.proto2.FieldDescriptor field)` If a lazy deserializer is instantiated, lazily deserializes the field if required.
| `set(?goog.proto2.FieldDescriptor field, <Any Type> value)` Stores the given value to the field specified by the given field descriptor. Note that the field must not be repeated.
| `set$Value(number tag, <Any Type> value)` Sets the value of the *non-repeating* field indicated by the given tag. GENERATED CODE USE ONLY. Basis of the set{Field} methods.
| `setUnknown(number tag, <Any Type> value)` Sets the value of an unknown field, by tag.

Static Method Summary
| `set$Metadata(?Function messageType, ?Object metadataObj)` Sets the metadata that represents the definition of this message. GENERATED CODE USE ONLY. Called when constructing message classes.