goog.proto2.Message
Provided By |
---|
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.
new Message()
Parameters | None. |
---|
Instance Methods
this.add( field, value ) → void
void
Adds the given value to the field specified by the given field descriptor. Note that the field must be repeated.
Parameters |
|
---|
this.add$Value( tag, value ) → void
void
Adds the value to the repeating field indicated by the given tag.
GENERATED CODE USE ONLY. Basis of the add{Field} methods.
Parameters |
|
---|
this.array$Values( tag ) → Array<?>
Array<?>
this.arrayOf( field ) → Array<?>
Array<?>
Returns the array of values found for the given repeated field.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.clear( field ) → void
void
Clears the field specified.
Parameters |
|
---|
this.clear$Field( tag ) → void
void
Clears the field specified by tag.
GENERATED CODE USE ONLY. Basis of the clear{Field} methods.
Parameters |
|
---|
this.clone() → goog.proto2.Message
goog.proto2.Message
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.copyFrom( message ) → void
void
Recursively copies the known fields from the given message to this message. Removes the fields which are not present in the source message.
Parameters |
|
---|
this.count$Values( tag ) → number
number
this.countOf( field ) → number
number
Returns the number of values stored in the given field.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.equals( other ) → boolean
boolean
Compares this message with another one ignoring the unknown fields.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.forEachUnknown<T>( callback, opt_scope ) → void
void
Iterates over all the unknown fields in the message.
Parameters |
|
---|
this.get( field, opt_index ) → ?
?
Returns the value stored at the field specified by the given field descriptor.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.get$Value( tag, opt_index ) → ?
?
this.get$ValueOrDefault( tag, opt_index ) → ?
?
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.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.getDescriptor() → goog.proto2.Descriptor
goog.proto2.Descriptor
Returns the descriptor which describes the current message.
This only works if we assume people never subclass protobufs.
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.getOrDefault( field, opt_index ) → ?
?
Returns the value stored at the field specified by the given field descriptor or the default value if none exists.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|
this.has( field ) → boolean
boolean
Returns whether there is a value stored at the field specified by the given field descriptor.
Parameters |
| ||||
---|---|---|---|---|---|
Returns |
|
this.has$Value( tag ) → boolean
boolean
this.initDefaults( simpleFieldsToo ) → void
void
Fills in the protocol buffer with default values. Any fields that are already set will not be overridden.
Parameters |
|
---|
this.initializeForLazyDeserializer( deserializer, data ) → void
void
Initializes the message with a lazy deserializer and its associated data. This method should be called by internal methods ONLY.
Parameters |
|
---|
this.mergeFrom( message ) → void
void
Merges the given message into this message.
Singular fields will be overwritten, except for embedded messages which will be merged. Repeated fields will be concatenated.
Parameters |
|
---|
this.set( field, value ) → void
void
Stores the given value to the field specified by the given field descriptor. Note that the field must not be repeated.
Parameters |
|
---|
this.set$Value( tag, value ) → void
void
Sets the value of the non-repeating field indicated by the given tag.
GENERATED CODE USE ONLY. Basis of the set{Field} methods.
Parameters |
|
---|
this.setUnknown( tag, value ) → void
void
Sets the value of an unknown field, by tag.
Parameters |
|
---|
Static Functions
Message.createDescriptor( messageType, metadataObj ) → goog.proto2.Descriptor
goog.proto2.Descriptor
Creates the metadata descriptor representing the definition of this message.
Parameters |
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Returns |
|