@Generated(value="proto") public final class MapEntry<K,V> extends AbstractMessage
In reflection API, map fields will be treated as repeated message fields and each map entry is accessed as a message. This MapEntry class is used to represent these map entry messages in reflection API.
Protobuf internal. Users shouldn't use this class.
Modifier and Type | Class and Description |
---|---|
static class |
MapEntry.Builder<K,V>
Builder to create
MapEntry messages. |
AbstractMessage.BuilderParent
memoizedSize
memoizedHashCode
Modifier and Type | Method and Description |
---|---|
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() |
Parser<MapEntry<K,V>> |
getParserForType()
Gets the parser for a message of the same type as this message.
|
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.
|
int |
getSerializedSize()
Get the number of bytes required to encode this message.
|
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.
|
MapEntry.Builder<K,V> |
newBuilderForType()
Constructs a new builder for a message of the same type as this message.
|
static <K,V> MapEntry<K,V> |
newDefaultInstance(Descriptors.Descriptor descriptor,
WireFormat.FieldType keyType,
K defaultKey,
WireFormat.FieldType valueType,
V defaultValue)
Create a default MapEntry instance.
|
MapEntry.Builder<K,V> |
toBuilder()
Constructs a builder initialized with the current message.
|
void |
writeTo(CodedOutputStream output)
Serializes the message and writes it to
output . |
equals, findInitializationErrors, getInitializationErrorString, getOneofFieldDescriptor, hashBoolean, hashCode, hashEnum, hashEnumList, hashFields, hashLong, hasOneof, newBuilderForType, toString
addAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
toByteArray, toByteString, writeDelimitedTo, writeTo
public static <K,V> MapEntry<K,V> newDefaultInstance(Descriptors.Descriptor descriptor, WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue)
public K getKey()
public V getValue()
public int getSerializedSize()
MessageLite
getSerializedSize
in interface MessageLite
getSerializedSize
in class AbstractMessage
public void writeTo(CodedOutputStream output) throws java.io.IOException
MessageLite
output
. This does not flush or close the
stream.writeTo
in interface MessageLite
writeTo
in class AbstractMessage
java.io.IOException
public boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class AbstractMessage
public Parser<MapEntry<K,V>> getParserForType()
MessageLite
public MapEntry.Builder<K,V> newBuilderForType()
MessageLite
public MapEntry.Builder<K,V> toBuilder()
MessageLite
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 Descriptors.Descriptor getDescriptorForType()
MessageOrBuilder
getDescriptor()
method of
generated message classes in that this method is an abstract method of the Message
interface whereas getDescriptor()
is a static method of a specific class. They return
the same thing.public java.util.Map<Descriptors.FieldDescriptor,java.lang.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 java.lang.Object getField(Descriptors.FieldDescriptor field)
MessageOrBuilder
public int getRepeatedFieldCount(Descriptors.FieldDescriptor field)
MessageOrBuilder
public java.lang.Object getRepeatedField(Descriptors.FieldDescriptor field, int index)
MessageOrBuilder
public UnknownFieldSet getUnknownFields()
MessageOrBuilder
UnknownFieldSet
for this message.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.