Package com.google.protobuf
Class MapEntryLite<K,V>
- java.lang.Object
-
- com.google.protobuf.MapEntryLite<K,V>
-
public class MapEntryLite<K,V> extends java.lang.Object
Implements the lite version of map entry messages.This class serves as an utility class to help do serialization/parsing of map entries. It's used in generated code and also in the full version MapEntry message.
Protobuf internal. Users shouldn't use.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
computeMessageSize(int fieldNumber, K key, V value)
Computes the message size for the provided key and value as though they were wrapped by aMapEntryLite
.K
getKey()
V
getValue()
static <K,V>
MapEntryLite<K,V>newDefaultInstance(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue)
Creates a default MapEntryLite message instance.java.util.Map.Entry<K,V>
parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry)
Parses an entry off of the input as aMap.Entry
.void
parseInto(MapFieldLite<K,V> map, CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parses an entry off of the input into the map.void
serializeTo(CodedOutputStream output, int fieldNumber, K key, V value)
Serializes the provided key and value as though they were wrapped by aMapEntryLite
to the output stream.
-
-
-
Method Detail
-
getKey
public K getKey()
-
getValue
public V getValue()
-
newDefaultInstance
public static <K,V> MapEntryLite<K,V> newDefaultInstance(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue)
Creates a default MapEntryLite message instance.This method is used by generated code to create the default instance for a map entry message. The created default instance should be used to create new map entry messages of the same type. For each map entry message, only one default instance should be created.
-
serializeTo
public void serializeTo(CodedOutputStream output, int fieldNumber, K key, V value) throws java.io.IOException
Serializes the provided key and value as though they were wrapped by aMapEntryLite
to the output stream. This helper method avoids allocation of aMapEntryLite
built with a key and value and is called from generated code directly.- Throws:
java.io.IOException
-
computeMessageSize
public int computeMessageSize(int fieldNumber, K key, V value)
Computes the message size for the provided key and value as though they were wrapped by aMapEntryLite
. This helper method avoids allocation of aMapEntryLite
built with a key and value and is called from generated code directly.
-
parseEntry
public java.util.Map.Entry<K,V> parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
Parses an entry off of the input as aMap.Entry
. This helper requires an allocation so usingparseInto(com.google.protobuf.MapFieldLite<K, V>, com.google.protobuf.CodedInputStream, com.google.protobuf.ExtensionRegistryLite)
is preferred if possible.- Throws:
java.io.IOException
-
parseInto
public void parseInto(MapFieldLite<K,V> map, CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
Parses an entry off of the input into the map. This helper avoids allocation of aMapEntryLite
by parsing directly into the providedMapFieldLite
.- Throws:
java.io.IOException
-
-