Package com.google.protobuf
Class MapEntryLite<K,V>
java.lang.Object
com.google.protobuf.MapEntryLite<K,V>
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final K
private static final int
private final MapEntryLite.Metadata
<K, V> private final V
private static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MapEntryLite
(MapEntryLite.Metadata<K, V> metadata, K key, V value) Creates a new MapEntryLite message.private
MapEntryLite
(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) Creates a default MapEntryLite message instance. -
Method Summary
Modifier and TypeMethodDescriptionint
computeMessageSize
(int fieldNumber, K key, V value) Computes the message size for the provided key and value as though they were wrapped by aMapEntryLite
.(package private) static <K,
V> int computeSerializedSize
(MapEntryLite.Metadata<K, V> metadata, K key, V value) getKey()
(package private) MapEntryLite.Metadata
<K, V> For experimental runtime internal use only.getValue()
static <K,
V> MapEntryLite <K, V> newDefaultInstance
(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) Creates a default MapEntryLite message instance.parseEntry
(ByteString bytes, ExtensionRegistryLite extensionRegistry) Parses an entry off of the input as aMap.Entry
.(package private) static <K,
V> Map.Entry <K, V> parseEntry
(CodedInputStream input, MapEntryLite.Metadata<K, V> metadata, ExtensionRegistryLite extensionRegistry) (package private) static <T> T
parseField
(CodedInputStream input, ExtensionRegistryLite extensionRegistry, WireFormat.FieldType type, T value) 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.(package private) static <K,
V> void writeTo
(CodedOutputStream output, MapEntryLite.Metadata<K, V> metadata, K key, V value)
-
Field Details
-
KEY_FIELD_NUMBER
private static final int KEY_FIELD_NUMBER- See Also:
-
VALUE_FIELD_NUMBER
private static final int VALUE_FIELD_NUMBER- See Also:
-
metadata
-
key
-
value
-
-
Constructor Details
-
MapEntryLite
private MapEntryLite(WireFormat.FieldType keyType, K defaultKey, WireFormat.FieldType valueType, V defaultValue) Creates a default MapEntryLite message instance. -
MapEntryLite
Creates a new MapEntryLite message.
-
-
Method Details
-
getKey
-
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.
-
writeTo
static <K,V> void writeTo(CodedOutputStream output, MapEntryLite.Metadata<K, V> metadata, K key, V value) throws IOException- Throws:
IOException
-
computeSerializedSize
-
parseField
static <T> T parseField(CodedInputStream input, ExtensionRegistryLite extensionRegistry, WireFormat.FieldType type, T value) throws IOException - Throws:
IOException
-
serializeTo
public void serializeTo(CodedOutputStream output, int fieldNumber, K key, V value) throws 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:
IOException
-
computeMessageSize
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 Map.Entry<K,V> parseEntry(ByteString bytes, ExtensionRegistryLite extensionRegistry) throws 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:
IOException
-
parseEntry
static <K,V> Map.Entry<K,V> parseEntry(CodedInputStream input, MapEntryLite.Metadata<K, V> metadata, ExtensionRegistryLite extensionRegistry) throws IOException- Throws:
IOException
-
parseInto
public void parseInto(MapFieldLite<K, V> map, CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOExceptionParses an entry off of the input into the map. This helper avoids allocation of aMapEntryLite
by parsing directly into the providedMapFieldLite
.- Throws:
IOException
-
getMetadata
MapEntryLite.Metadata<K,V> getMetadata()For experimental runtime internal use only.
-