Class Struct.Builder

All Implemented Interfaces:
MessageLite.Builder, MessageLiteOrBuilder, StructOrBuilder, Cloneable
Enclosing class:
Struct

public static final class Struct.Builder extends GeneratedMessageLite.Builder<Struct, Struct.Builder> implements StructOrBuilder
Represents a JSON object.

An unordered key-value map, intending to perfectly capture the semantics of a
JSON object. This enables parsing any arbitrary JSON payload as a message
field in ProtoJSON format.

This follows RFC 8259 guidelines for interoperable JSON: notably this type
cannot represent large Int64 values or `NaN`/`Infinity` numbers,
since the JSON format generally does not support those values in its number
type.

If you do not intend to parse arbitrary JSON into your message, a custom
typed message should be preferred instead of using this type.
Protobuf type google.protobuf.Struct
  • Constructor Details

    • Builder

      private Builder()
  • Method Details

    • getFieldsCount

      public int getFieldsCount()
      Description copied from interface: StructOrBuilder
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
      Specified by:
      getFieldsCount in interface StructOrBuilder
    • containsFields

      public boolean containsFields(String key)
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
      Specified by:
      containsFields in interface StructOrBuilder
    • clearFields

      public Struct.Builder clearFields()
    • removeFields

      public Struct.Builder removeFields(String key)
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
    • getFields

      @Deprecated public Map<String,Value> getFields()
      Deprecated.
      Use getFieldsMap() instead.
      Specified by:
      getFields in interface StructOrBuilder
    • getFieldsMap

      public Map<String,Value> getFieldsMap()
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
      Specified by:
      getFieldsMap in interface StructOrBuilder
    • getFieldsOrDefault

      public Value getFieldsOrDefault(String key, Value defaultValue)
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
      Specified by:
      getFieldsOrDefault in interface StructOrBuilder
    • getFieldsOrThrow

      public Value getFieldsOrThrow(String key)
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
      Specified by:
      getFieldsOrThrow in interface StructOrBuilder
    • putFields

      public Struct.Builder putFields(String key, Value value)
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;
    • putAllFields

      public Struct.Builder putAllFields(Map<String,Value> values)
      Unordered map of dynamically typed values.
      
      map<string, .google.protobuf.Value> fields = 1;