31 package com.google.protobuf;
33 import java.io.IOException;
34 import java.util.AbstractMap;
47 static class Metadata<
K, V> {
49 public final K defaultKey;
51 public final V defaultValue;
58 this.keyType = keyType;
59 this.defaultKey = defaultKey;
60 this.valueType = valueType;
61 this.defaultValue = defaultValue;
75 this.metadata =
new Metadata<K, V>(keyType, defaultKey, valueType, defaultValue);
76 this.key = defaultKey;
77 this.value = defaultValue;
113 static <K, V>
int computeSerializedSize(Metadata<K, V>
metadata,
K key, V
value) {
118 @SuppressWarnings(
"unchecked")
119 static <
T>
T parseField(
120 CodedInputStream
input,
121 ExtensionRegistryLite extensionRegistry,
127 MessageLite.Builder subBuilder = ((MessageLite)
value).toBuilder();
128 input.readMessage(subBuilder, extensionRegistry);
129 return (
T) subBuilder.buildPartial();
133 throw new RuntimeException(
"Groups are not allowed in maps.");
135 return (
T) FieldSet.readPrimitiveField(
input,
type,
true);
177 int tag =
input.readTag();
186 if (!
input.skipField(tag)) {
191 return new AbstractMap.SimpleImmutableEntry<
K, V>(
key,
value);
207 int tag =
input.readTag();
216 if (!
input.skipField(tag)) {
222 input.checkLastTagWas(0);
223 input.popLimit(oldLimit);
228 Metadata<K, V> getMetadata() {