public class MapField<K,V>
extends java.lang.Object
This class supports accessing the map field as a Map to be used in generated API and
also supports accessing the field as a List to be used in reflection API. It keeps track
of where the data is currently stored and do necessary conversions between map and list.
This class is a protobuf implementation detail. Users shouldn't use this class directly.
THREAD-SAFETY NOTE: Read-only access is thread-safe. Users can call getMap() and getList() concurrently in multiple threads. If write-access is needed, all access must be synchronized.
| Modifier and Type | Field and Description |
|---|---|
static com.google.protobuf.MutabilityOracle |
IMMUTABLE |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
MapField<K,V> |
copy()
Returns a deep copy of this MapField.
|
static <K,V> MapField<K,V> |
emptyMapField(com.google.protobuf.MapEntry<K,V> defaultEntry)
Returns an immutable empty MapField.
|
void |
ensureMutable()
Throws an
UnsupportedOperationException if not mutable. |
boolean |
equals(java.lang.Object object) |
java.util.Map<K,V> |
getMap()
Returns the content of this MapField as a read-only Map.
|
java.util.Map<K,V> |
getMutableMap()
Gets a mutable Map view of this MapField.
|
int |
hashCode() |
boolean |
isMutable()
Returns whether this field can be modified.
|
void |
makeImmutable()
Makes this list immutable.
|
void |
mergeFrom(MapField<K,V> other) |
static <K,V> MapField<K,V> |
newMapField(com.google.protobuf.MapEntry<K,V> defaultEntry)
Creates a new mutable empty MapField.
|
public static <K,V> MapField<K,V> emptyMapField(com.google.protobuf.MapEntry<K,V> defaultEntry)
public static <K,V> MapField<K,V> newMapField(com.google.protobuf.MapEntry<K,V> defaultEntry)
public void clear()
public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void makeImmutable()
UnsupportedOperationException.public boolean isMutable()
public void ensureMutable()
UnsupportedOperationException if not mutable.