public static class MapEntry.Builder<K,V> extends AbstractMessage.Builder<MapEntry.Builder<K,V>>
MapEntry
messages.Modifier and Type | Method and Description |
---|---|
MapEntry.Builder<K,V> |
addRepeatedField(Descriptors.FieldDescriptor field,
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.
|
Map<Descriptors.FieldDescriptor,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.
|
Object |
getField(Descriptors.FieldDescriptor field)
Obtains the value of the given field, or the default value if it is not set.
|
K |
getKey() |
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,
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,
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) |
clear, clearOneof, findInitializationErrors, getFieldBuilder, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedFieldBuilder, getUnknownFieldSetBuilder, hasOneof, internalMergeFrom, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeUnknownFields, newUninitializedMessageException, setUnknownFieldSetBuilder, toString
addAll, addAll, mergeFrom, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
mergeFrom
public K getKey()
public V getValue()
public MapEntry.Builder<K,V> setKey(K key)
public MapEntry.Builder<K,V> clearKey()
public MapEntry.Builder<K,V> setValue(V value)
public MapEntry.Builder<K,V> clearValue()
public MapEntry<K,V> build()
MessageLite.Builder
public MapEntry<K,V> buildPartial()
MessageLite.Builder
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.public Descriptors.Descriptor getDescriptorForType()
Message.Builder
MessageOrBuilder.getDescriptorForType()
.public Message.Builder newBuilderForField(Descriptors.FieldDescriptor field)
Message.Builder
Message.Builder.setField(Descriptors.FieldDescriptor, Object)
,
Message.Builder.setRepeatedField(Descriptors.FieldDescriptor, int, Object)
, or
Message.Builder.addRepeatedField(Descriptors.FieldDescriptor, Object)
method of the current builder.
To obtain a builder nested in the current builder, use
Message.Builder.getFieldBuilder(Descriptors.FieldDescriptor)
instead.
public MapEntry.Builder<K,V> setField(Descriptors.FieldDescriptor field, Object value)
Message.Builder
MessageOrBuilder.getField(Descriptors.FieldDescriptor)
would return.public MapEntry.Builder<K,V> clearField(Descriptors.FieldDescriptor field)
Message.Builder
public MapEntry.Builder<K,V> setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Message.Builder
MessageOrBuilder.getRepeatedField(Descriptors.FieldDescriptor,int)
would return.public MapEntry.Builder<K,V> addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Message.Builder
setRepeatedField
, but appends the value as a new element.public MapEntry.Builder<K,V> setUnknownFields(UnknownFieldSet unknownFields)
Message.Builder
UnknownFieldSet
for this message.public MapEntry<K,V> getDefaultInstanceForType()
MessageLiteOrBuilder
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.public boolean isInitialized()
MessageLiteOrBuilder
public Map<Descriptors.FieldDescriptor,Object> getAllFields()
MessageOrBuilder
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. public boolean hasField(Descriptors.FieldDescriptor field)
MessageOrBuilder
public Object getField(Descriptors.FieldDescriptor field)
MessageOrBuilder
public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
MessageOrBuilder
public Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
MessageOrBuilder
public UnknownFieldSet getUnknownFields()
MessageOrBuilder
UnknownFieldSet
for this message.public MapEntry.Builder<K,V> clone()
MessageLite.Builder
clone
in interface Message.Builder
clone
in interface MessageLite.Builder
clone
in class AbstractMessage.Builder<MapEntry.Builder<K,V>>
Object.clone()
Copyright © 2008–2022. All rights reserved.