• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 package com.google.protobuf;
9 
10 import java.util.Map;
11 
12 @CheckReturnValue
13 interface MapFieldSchema {
14   /** Returns the map data for mutation. */
forMutableMapData(Object mapField)15   Map<?, ?> forMutableMapData(Object mapField);
16 
17   /** Returns the map data for read. */
forMapData(Object mapField)18   Map<?, ?> forMapData(Object mapField);
19 
20   /** Whether toImmutable() has been called on this map field. */
isImmutable(Object mapField)21   boolean isImmutable(Object mapField);
22 
23   /**
24    * Returns an immutable instance of the map field. It may make the parameter immutable and return
25    * the parameter, or create an immutable copy. The status of the parameter after the call is
26    * undefined.
27    */
toImmutable(Object mapField)28   Object toImmutable(Object mapField);
29 
30   /** Returns a new instance of the map field given a map default entry. */
newMapField(Object mapDefaultEntry)31   Object newMapField(Object mapDefaultEntry);
32 
33   /** Returns the metadata from a default entry. */
forMapMetadata(Object mapDefaultEntry)34   MapEntryLite.Metadata<?, ?> forMapMetadata(Object mapDefaultEntry);
35 
36   /** Merges {@code srcMapField} into {@code destMapField}, and returns the merged instance. */
37   @CanIgnoreReturnValue
mergeFrom(Object destMapField, Object srcMapField)38   Object mergeFrom(Object destMapField, Object srcMapField);
39 
40   /** Compute the serialized size for the map with a given field number. */
getSerializedSize(int fieldNumber, Object mapField, Object mapDefaultEntry)41   int getSerializedSize(int fieldNumber, Object mapField, Object mapDefaultEntry);
42 }
43