Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
com.google.protobuf.MapField< K, V > Class Template Reference
Inheritance diagram for com.google.protobuf.MapField< K, V >:
Inheritance graph
[legend]

Classes

interface  Converter
 
class  ImmutableMessageConverter
 
class  MutatabilityAwareMap
 
enum  StorageMode
 

Public Member Functions

void clear ()
 
MapField< K, V > copy ()
 
void ensureMutable ()
 
boolean equals (Object object)
 
Map< K, V > getMap ()
 
Map< K, V > getMutableMap ()
 
int hashCode ()
 
boolean isMutable ()
 
void makeImmutable ()
 
void mergeFrom (MapField< K, V > other)
 

Static Public Member Functions

static< K, V > MapField< K, V > emptyMapField (MapEntry< K, V > defaultEntry)
 
static< K, V > MapField< K, V > newMapField (MapEntry< K, V > defaultEntry)
 

Private Member Functions

Message convertKeyAndValueToMessage (K key, V value)
 
MutatabilityAwareMap< K, V > convertListToMap (List< Message > listData)
 
List< MessageconvertMapToList (MutatabilityAwareMap< K, V > mapData)
 
void convertMessageToKeyAndValue (Message message, Map< K, V > map)
 
 MapField (Converter< K, V > converter, StorageMode mode, Map< K, V > mapData)
 
 MapField (MapEntry< K, V > defaultEntry, StorageMode mode, Map< K, V > mapData)
 

Private Attributes

final Converter< K, V > converter
 
volatile boolean isMutable
 
List< MessagelistData
 
MutatabilityAwareMap< K, V > mapData
 
volatile StorageMode mode
 

Detailed Description

Internal representation of map fields in generated messages.

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.

Definition at line 56 of file MapField.java.

Constructor & Destructor Documentation

◆ MapField() [1/2]

com.google.protobuf.MapField< K, V >.MapField ( Converter< K, V >  converter,
StorageMode  mode,
Map< K, V >  mapData 
)
inlineprivate

Definition at line 128 of file MapField.java.

◆ MapField() [2/2]

com.google.protobuf.MapField< K, V >.MapField ( MapEntry< K, V >  defaultEntry,
StorageMode  mode,
Map< K, V >  mapData 
)
inlineprivate

Definition at line 136 of file MapField.java.

Member Function Documentation

◆ clear()

void com.google.protobuf.MapField< K, V >.clear ( )
inline

Definition at line 207 of file MapField.java.

◆ convertKeyAndValueToMessage()

Message com.google.protobuf.MapField< K, V >.convertKeyAndValueToMessage ( K  key,
value 
)
inlineprivate

Definition at line 153 of file MapField.java.

◆ convertListToMap()

MutatabilityAwareMap<K, V> com.google.protobuf.MapField< K, V >.convertListToMap ( List< Message listData)
inlineprivate

Definition at line 170 of file MapField.java.

◆ convertMapToList()

List<Message> com.google.protobuf.MapField< K, V >.convertMapToList ( MutatabilityAwareMap< K, V >  mapData)
inlineprivate

Definition at line 162 of file MapField.java.

◆ convertMessageToKeyAndValue()

void com.google.protobuf.MapField< K, V >.convertMessageToKeyAndValue ( Message  message,
Map< K, V >  map 
)
inlineprivate

Definition at line 158 of file MapField.java.

◆ copy()

MapField<K, V> com.google.protobuf.MapField< K, V >.copy ( )
inline

Returns a deep copy of this MapField.

Definition at line 228 of file MapField.java.

◆ emptyMapField()

static <K, V> MapField<K, V> com.google.protobuf.MapField< K, V >.emptyMapField ( MapEntry< K, V >  defaultEntry)
inlinestatic

Returns an immutable empty MapField.

Definition at line 142 of file MapField.java.

◆ ensureMutable()

void com.google.protobuf.MapField< K, V >.ensureMutable ( )
inline

Definition at line 279 of file MapField.java.

◆ equals()

boolean com.google.protobuf.MapField< K, V >.equals ( Object  object)
inline

Definition at line 214 of file MapField.java.

◆ getMap()

Map<K, V> com.google.protobuf.MapField< K, V >.getMap ( )
inline

Returns the content of this MapField as a read-only Map.

Definition at line 179 of file MapField.java.

◆ getMutableMap()

Map<K, V> com.google.protobuf.MapField< K, V >.getMutableMap ( )
inline

Gets a mutable Map view of this MapField.

Definition at line 192 of file MapField.java.

◆ hashCode()

int com.google.protobuf.MapField< K, V >.hashCode ( )
inline

Definition at line 223 of file MapField.java.

◆ isMutable()

boolean com.google.protobuf.MapField< K, V >.isMutable ( )
inline

Returns whether this field can be modified.

Definition at line 271 of file MapField.java.

◆ makeImmutable()

void com.google.protobuf.MapField< K, V >.makeImmutable ( )
inline

Makes this list immutable. All subsequent modifications will throw an {}.

Definition at line 266 of file MapField.java.

◆ mergeFrom()

void com.google.protobuf.MapField< K, V >.mergeFrom ( MapField< K, V >  other)
inline

Definition at line 203 of file MapField.java.

◆ newMapField()

static <K, V> MapField<K, V> com.google.protobuf.MapField< K, V >.newMapField ( MapEntry< K, V >  defaultEntry)
inlinestatic

Creates a new mutable empty MapField.

Definition at line 148 of file MapField.java.

Member Data Documentation

◆ converter

final Converter<K, V> com.google.protobuf.MapField< K, V >.converter
private

Definition at line 126 of file MapField.java.

◆ isMutable

volatile boolean com.google.protobuf.MapField< K, V >.isMutable
private

Definition at line 86 of file MapField.java.

◆ listData

List<Message> com.google.protobuf.MapField< K, V >.listData
private

Definition at line 89 of file MapField.java.

◆ mapData

Definition at line 88 of file MapField.java.

◆ mode

Definition at line 87 of file MapField.java.


The documentation for this class was generated from the following file:


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:07