public
final
class
MapEntry<K
,
V
>
extends
AbstractMessage
Implements MapEntry messages.
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.
Type Parameters
K
V
Static Methods
<K,V>newDefaultInstance(Descriptors.Descriptor descriptor, WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue)
public
static
MapEntry<K
,
V
>
< K
,
V>newDefaultInstance
(
Descriptors
.
Descriptor
descriptor
,
WireFormat
.
FieldType
keyType
,
K
defaultKey
,
WireFormat
.
FieldType
valueType
,
V
defaultValue
)
Create a default MapEntry instance. A default MapEntry instance should be created only once for each map entry message type. Generated code should store the created default instance and use it later to create new MapEntry messages of the same type.
descriptor
keyType
defaultKey
K
valueType
defaultValue
V
Methods
getAllFields()
public
Map<Descriptors
.
FieldDescriptor
,
Object
>
getAllFields
()
getDefaultInstanceForType()
public
MapEntry<K
,
V
>
getDefaultInstanceForType
()
getDescriptorForType()
public
Descriptors
.
Descriptor
getDescriptorForType
()
getField(Descriptors.FieldDescriptor field)
public
Object
getField
(
Descriptors
.
FieldDescriptor
field
)
getKey()
public
K
getKey
()
K
getParserForType()
public
Parser<MapEntry<K
,
V
>>
getParserForType
()
getRepeatedField(Descriptors.FieldDescriptor field, int index)
public
Object
getRepeatedField
(
Descriptors
.
FieldDescriptor
field
,
int
index
)
getRepeatedFieldCount(Descriptors.FieldDescriptor field)
public
int
getRepeatedFieldCount
(
Descriptors
.
FieldDescriptor
field
)
getSerializedSize()
public
int
getSerializedSize
()
Get the number of bytes required to encode this message. The result is only computed on the first call and memoized after that.
If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will be smaller than the actual number of bytes required and might be negative.
getUnknownFields()
public
UnknownFieldSet
getUnknownFields
()
getValue()
public
V
getValue
()
V
hasField(Descriptors.FieldDescriptor field)
public
boolean
hasField
(
Descriptors
.
FieldDescriptor
field
)
isInitialized()
public
boolean
isInitialized
()
Returns true if all required fields in the message and all embedded messages are set, false otherwise.
newBuilderForType()
public
MapEntry
.
Builder<K
,
V
>
newBuilderForType
()
toBuilder()
public
MapEntry
.
Builder<K
,
V
>
toBuilder
()
writeTo(CodedOutputStream output)
public
void
writeTo
(
CodedOutputStream
output
)
Serializes the message and writes it to output
. This does not flush or close the
stream.

