MapEntry.Builder
Date: 2017-07-08

com.google.protobuf

## Class MapEntry.Builder<K,V>

- java.lang.Object
- - com.google.protobuf.AbstractMessageLite.Builder
  - - com.google.protobuf.AbstractMessage.Builder<MapEntry.Builder<K,V>>
    - - com.google.protobuf.MapEntry.Builder<K,V>

- All Implemented Interfaces:
    Message.Builder, MessageLite.Builder, MessageLiteOrBuilder, MessageOrBuilder, java.lang.Cloneable
  Enclosing class:
    MapEntry<K,V>

      public static class MapEntry.Builder<K,V>
      extends AbstractMessage.Builder<MapEntry.Builder<K,V>>

  Builder to create `MapEntry` messages.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `MapEntry.Builder<K,V>` | `addRepeatedField(Descriptors.FieldDescriptor field, java.lang.Object value)` Like `setRepeatedField`, but appends the value as a new element.
    `MapEntry<K,V>` | `build()` Constructs the message based on the state of the Builder.
    `MapEntry<K,V>` | `buildPartial()` Like `MessageLite.Builder.build()`, but does not throw an exception if the message is missing required fields.
    `MapEntry.Builder<K,V>` | `clearField(Descriptors.FieldDescriptor field)` Clears the field.
    `MapEntry.Builder<K,V>` | `clearKey()`
    `MapEntry.Builder<K,V>` | `clearValue()`
    `MapEntry.Builder<K,V>` | `clone()` Clones the Builder.
    `java.util.Map<Descriptors.FieldDescriptor,java.lang.Object>` | `getAllFields()` Returns a collection of all the fields in this message which are set and their corresponding values.
    `MapEntry<K,V>` | `getDefaultInstanceForType()` Get an instance of the type with no fields set.
    `Descriptors.Descriptor` | `getDescriptorForType()` Get the message's type's descriptor.
    `java.lang.Object` | `getField(Descriptors.FieldDescriptor field)` Obtains the value of the given field, or the default value if it is not set.
    `K` | `getKey()`
    `java.lang.Object` | `getRepeatedField(Descriptors.FieldDescriptor field, int index)` Gets an element of a repeated field.
    `int` | `getRepeatedFieldCount(Descriptors.FieldDescriptor field)` Gets the number of elements of a repeated field.
    `UnknownFieldSet` | `getUnknownFields()` Get the `UnknownFieldSet` for this message.
    `V` | `getValue()`
    `boolean` | `hasField(Descriptors.FieldDescriptor field)` Returns true if the given field is set.
    `boolean` | `isInitialized()` Returns true if all required fields in the message and all embedded messages are set, false otherwise.
    `Message.Builder` | `newBuilderForField(Descriptors.FieldDescriptor field)` Create a Builder for messages of the appropriate type for the given field.
    `MapEntry.Builder<K,V>` | `setField(Descriptors.FieldDescriptor field, java.lang.Object value)` Sets a field to the given value.
    `MapEntry.Builder<K,V>` | `setKey(K key)`
    `MapEntry.Builder<K,V>` | `setRepeatedField(Descriptors.FieldDescriptor field, int index, java.lang.Object value)` Sets an element of a repeated field to the given value.
    `MapEntry.Builder<K,V>` | `setUnknownFields(UnknownFieldSet unknownFields)` Set the `UnknownFieldSet` for this message.
    `MapEntry.Builder<K,V>` | `setValue(V value)`

    - ### Methods inherited from class com.google.protobuf.AbstractMessage.Builder

      `clear, clearOneof, findInitializationErrors, getFieldBuilder, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedFieldBuilder, hasOneof, internalMergeFrom, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeUnknownFields, newUninitializedMessageException, toString`

    - ### Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

      `addAll, mergeFrom, newUninitializedMessageException`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.google.protobuf.MessageLite.Builder

      `mergeFrom`

- - ### Method Detail

    - #### getKey

          public K getKey()

    - #### getValue

          public V getValue()

    - #### setKey

          public MapEntry.Builder<K,V> setKey(K key)

    - #### clearKey

          public MapEntry.Builder<K,V> clearKey()

    - #### setValue

          public MapEntry.Builder<K,V> setValue(V value)

    - #### clearValue

          public MapEntry.Builder<K,V> clearValue()

    - #### build

          public MapEntry<K,V> build()

      Description copied from interface: `MessageLite.Builder`
      Constructs the message based on the state of the Builder. Subsequent changes to the Builder will not affect the returned message.

    - #### buildPartial

          public MapEntry<K,V> buildPartial()

      Description copied from interface: `MessageLite.Builder`
      Like `MessageLite.Builder.build()`, but does not throw an exception if the message is missing required fields. Instead, a partial message is returned. Subsequent changes to the Builder will not affect the returned message.

    - #### getDescriptorForType

          public Descriptors.Descriptor getDescriptorForType()

      Description copied from interface: `Message.Builder`
      Get the message's type's descriptor. See `MessageOrBuilder.getDescriptorForType()`.

    - #### newBuilderForField

          public Message.Builder newBuilderForField(Descriptors.FieldDescriptor field)

      Description copied from interface: `Message.Builder`
      Create a Builder for messages of the appropriate type for the given field. Messages built with this can then be passed to setField(), setRepeatedField(), or addRepeatedField().

    - #### setField

          public MapEntry.Builder<K,V> setField(Descriptors.FieldDescriptor field,
                                       java.lang.Object value)

      Description copied from interface: `Message.Builder`
      Sets a field to the given value. The value must be of the correct type for this field, i.e. the same type that `MessageOrBuilder.getField(Descriptors.FieldDescriptor)` would return.

    - #### clearField

          public MapEntry.Builder<K,V> clearField(Descriptors.FieldDescriptor field)

      Description copied from interface: `Message.Builder`
      Clears the field. This is exactly equivalent to calling the generated "clear" accessor method corresponding to the field.

    - #### setRepeatedField

          public MapEntry.Builder<K,V> setRepeatedField(Descriptors.FieldDescriptor field,
                                               int index,
                                               java.lang.Object value)

      Description copied from interface: `Message.Builder`
      Sets an element of a repeated field to the given value. The value must be of the correct type for this field, i.e. the same type that `MessageOrBuilder.getRepeatedField(Descriptors.FieldDescriptor,int)` would return.

    - #### addRepeatedField

          public MapEntry.Builder<K,V> addRepeatedField(Descriptors.FieldDescriptor field,
                                               java.lang.Object value)

      Description copied from interface: `Message.Builder`
      Like `setRepeatedField`, but appends the value as a new element.

    - #### setUnknownFields

          public MapEntry.Builder<K,V> setUnknownFields(UnknownFieldSet unknownFields)

      Description copied from interface: `Message.Builder`
      Set the `UnknownFieldSet` for this message.

    - #### getDefaultInstanceForType

          public MapEntry<K,V> getDefaultInstanceForType()

      Description copied from interface: `MessageLiteOrBuilder`
      Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the `getDefaultInstance()` method of generated message classes in that this method is an abstract method of the `MessageLite` interface whereas `getDefaultInstance()` is a static method of a specific class. They return the same thing.

    - #### isInitialized

          public boolean isInitialized()

      Description copied from interface: `MessageLiteOrBuilder`
      Returns true if all required fields in the message and all embedded messages are set, false otherwise.

      See also: `MessageOrBuilder.getInitializationErrorString()`

    - #### getAllFields

          public java.util.Map<Descriptors.FieldDescriptor,java.lang.Object> getAllFields()

      Description copied from interface: `MessageOrBuilder`
      Returns a collection of all the fields in this message which are set and their corresponding values. A singular ("required" or "optional") field is set iff hasField() returns true for that field. A "repeated" field is set iff getRepeatedFieldCount() is greater than zero. The values are exactly what would be returned by calling `MessageOrBuilder.getField(Descriptors.FieldDescriptor)` for each field. The map is guaranteed to be a sorted map, so iterating over it will return fields in order by field number.
      If this is for a builder, the returned map may or may not reflect future changes to the builder. Either way, the returned map is itself unmodifiable.

    - #### hasField

          public boolean hasField(Descriptors.FieldDescriptor field)

      Description copied from interface: `MessageOrBuilder`
      Returns true if the given field is set. This is exactly equivalent to calling the generated "has" accessor method corresponding to the field.

    - #### getField

          public java.lang.Object getField(Descriptors.FieldDescriptor field)

      Description copied from interface: `MessageOrBuilder`
      Obtains the value of the given field, or the default value if it is not set. For primitive fields, the boxed primitive value is returned. For enum fields, the EnumValueDescriptor for the value is returned. For embedded message fields, the sub-message is returned. For repeated fields, a java.util.List is returned.

    - #### getRepeatedFieldCount

          public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)

      Description copied from interface: `MessageOrBuilder`
      Gets the number of elements of a repeated field. This is exactly equivalent to calling the generated "Count" accessor method corresponding to the field.

    - #### getRepeatedField

          public java.lang.Object getRepeatedField(Descriptors.FieldDescriptor field,
                                          int index)

      Description copied from interface: `MessageOrBuilder`
      Gets an element of a repeated field. For primitive fields, the boxed primitive value is returned. For enum fields, the EnumValueDescriptor for the value is returned. For embedded message fields, the sub-message is returned.

    - #### getUnknownFields

          public UnknownFieldSet getUnknownFields()

      Description copied from interface: `MessageOrBuilder`
      Get the `UnknownFieldSet` for this message.

    - #### clone

          public MapEntry.Builder<K,V> clone()

      Description copied from interface: `MessageLite.Builder`
      Clones the Builder.
      Specified by:
        `clone` in interface `Message.Builder`
      Specified by:
        `clone` in interface `MessageLite.Builder`
      Overrides:
        `clone` in class `AbstractMessage.Builder<MapEntry.Builder<K,V>>`
      See Also:
        `Object.clone()`