public static final class Field.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder> implements FieldOrBuilder
A single field of a message type.Protobuf type
google.protobuf.Field| Modifier and Type | Method and Description |
|---|---|
Field.Builder |
addAllOptions(java.lang.Iterable<? extends Option> values)
The protocol buffer options.
|
Field.Builder |
addOptions(int index,
Option.Builder builderForValue)
The protocol buffer options.
|
Field.Builder |
addOptions(int index,
Option value)
The protocol buffer options.
|
Field.Builder |
addOptions(Option.Builder builderForValue)
The protocol buffer options.
|
Field.Builder |
addOptions(Option value)
The protocol buffer options.
|
Option.Builder |
addOptionsBuilder()
The protocol buffer options.
|
Option.Builder |
addOptionsBuilder(int index)
The protocol buffer options.
|
Field.Builder |
addRepeatedField(Descriptors.FieldDescriptor field,
java.lang.Object value)
Like
setRepeatedField, but appends the value as a new element. |
Field |
build()
Constructs the message based on the state of the Builder.
|
Field |
buildPartial()
Like
MessageLite.Builder.build(), but does not throw an exception if the message is missing required
fields. |
Field.Builder |
clear()
Called by the initialization and clear code paths to allow subclasses to
reset any of their builtin fields back to the initial values.
|
Field.Builder |
clearCardinality()
The field cardinality.
|
Field.Builder |
clearDefaultValue()
The string value of the default value of this field.
|
Field.Builder |
clearField(Descriptors.FieldDescriptor field)
Clears the field.
|
Field.Builder |
clearJsonName()
The field JSON name.
|
Field.Builder |
clearKind()
The field type.
|
Field.Builder |
clearName()
The field name.
|
Field.Builder |
clearNumber()
The field number.
|
Field.Builder |
clearOneof(Descriptors.OneofDescriptor oneof)
|
Field.Builder |
clearOneofIndex()
The index of the field type in `Type.oneofs`, for message or enumeration
types.
|
Field.Builder |
clearOptions()
The protocol buffer options.
|
Field.Builder |
clearPacked()
Whether to use alternative packed wire representation.
|
Field.Builder |
clearTypeUrl()
The field type URL, without the scheme, for message or enumeration
types.
|
Field.Builder |
clone()
Clones the Builder.
|
Field.Cardinality |
getCardinality()
The field cardinality.
|
int |
getCardinalityValue()
The field cardinality.
|
Field |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
java.lang.String |
getDefaultValue()
The string value of the default value of this field.
|
ByteString |
getDefaultValueBytes()
The string value of the default value of this field.
|
static Descriptors.Descriptor |
getDescriptor() |
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor.
|
java.lang.String |
getJsonName()
The field JSON name.
|
ByteString |
getJsonNameBytes()
The field JSON name.
|
Field.Kind |
getKind()
The field type.
|
int |
getKindValue()
The field type.
|
java.lang.String |
getName()
The field name.
|
ByteString |
getNameBytes()
The field name.
|
int |
getNumber()
The field number.
|
int |
getOneofIndex()
The index of the field type in `Type.oneofs`, for message or enumeration
types.
|
Option |
getOptions(int index)
The protocol buffer options.
|
Option.Builder |
getOptionsBuilder(int index)
The protocol buffer options.
|
java.util.List<Option.Builder> |
getOptionsBuilderList()
The protocol buffer options.
|
int |
getOptionsCount()
The protocol buffer options.
|
java.util.List<Option> |
getOptionsList()
The protocol buffer options.
|
OptionOrBuilder |
getOptionsOrBuilder(int index)
The protocol buffer options.
|
java.util.List<? extends OptionOrBuilder> |
getOptionsOrBuilderList()
The protocol buffer options.
|
boolean |
getPacked()
Whether to use alternative packed wire representation.
|
java.lang.String |
getTypeUrl()
The field type URL, without the scheme, for message or enumeration
types.
|
ByteString |
getTypeUrlBytes()
The field type URL, without the scheme, for message or enumeration
types.
|
boolean |
isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false
otherwise.
|
Field.Builder |
mergeFrom(CodedInputStream input,
ExtensionRegistryLite extensionRegistry)
Like
MessageLite.Builder.mergeFrom(CodedInputStream), but also parses extensions. |
Field.Builder |
mergeFrom(Field other) |
Field.Builder |
mergeFrom(Message other)
Merge
other into the message being built. |
Field.Builder |
mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
Merge some unknown fields into the
UnknownFieldSet for this message. |
Field.Builder |
removeOptions(int index)
The protocol buffer options.
|
Field.Builder |
setCardinality(Field.Cardinality value)
The field cardinality.
|
Field.Builder |
setCardinalityValue(int value)
The field cardinality.
|
Field.Builder |
setDefaultValue(java.lang.String value)
The string value of the default value of this field.
|
Field.Builder |
setDefaultValueBytes(ByteString value)
The string value of the default value of this field.
|
Field.Builder |
setField(Descriptors.FieldDescriptor field,
java.lang.Object value)
Sets a field to the given value.
|
Field.Builder |
setJsonName(java.lang.String value)
The field JSON name.
|
Field.Builder |
setJsonNameBytes(ByteString value)
The field JSON name.
|
Field.Builder |
setKind(Field.Kind value)
The field type.
|
Field.Builder |
setKindValue(int value)
The field type.
|
Field.Builder |
setName(java.lang.String value)
The field name.
|
Field.Builder |
setNameBytes(ByteString value)
The field name.
|
Field.Builder |
setNumber(int value)
The field number.
|
Field.Builder |
setOneofIndex(int value)
The index of the field type in `Type.oneofs`, for message or enumeration
types.
|
Field.Builder |
setOptions(int index,
Option.Builder builderForValue)
The protocol buffer options.
|
Field.Builder |
setOptions(int index,
Option value)
The protocol buffer options.
|
Field.Builder |
setPacked(boolean value)
Whether to use alternative packed wire representation.
|
Field.Builder |
setRepeatedField(Descriptors.FieldDescriptor field,
int index,
java.lang.Object value)
Sets an element of a repeated field to the given value.
|
Field.Builder |
setTypeUrl(java.lang.String value)
The field type URL, without the scheme, for message or enumeration
types.
|
Field.Builder |
setTypeUrlBytes(ByteString value)
The field type URL, without the scheme, for message or enumeration
types.
|
Field.Builder |
setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
Set the
UnknownFieldSet for this message. |
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, newBuilderForFieldfindInitializationErrors, getInitializationErrorString, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, toStringmergeFromequals, getClass, hashCode, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneofmergeFrompublic static final Descriptors.Descriptor getDescriptor()
public Field.Builder clear()
com.google.protobuf.GeneratedMessageV3.Builderclear in interface Message.Builderclear in interface MessageLite.Builderclear in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Descriptors.Descriptor getDescriptorForType()
Message.BuilderMessageOrBuilder.getDescriptorForType().getDescriptorForType in interface Message.BuildergetDescriptorForType in interface MessageOrBuildergetDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field getDefaultInstanceForType()
MessageLiteOrBuildergetDefaultInstance() method of generated
message classes in that this method is an abstract method of the MessageLite interface
whereas getDefaultInstance() is a static method of a specific class. They return the
same thing.getDefaultInstanceForType in interface MessageLiteOrBuildergetDefaultInstanceForType in interface MessageOrBuilderpublic Field build()
MessageLite.Builderbuild in interface Message.Builderbuild in interface MessageLite.Builderpublic Field buildPartial()
MessageLite.BuilderMessageLite.Builder.build(), but does not throw an exception if the message is missing required
fields. Instead, a partial message is returned. Subsequent changes to the Builder will not
affect the returned message.buildPartial in interface Message.BuilderbuildPartial in interface MessageLite.Builderpublic Field.Builder clone()
MessageLite.Builderclone in interface Message.Builderclone in interface MessageLite.Builderclone in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>Object.clone()public Field.Builder setField(Descriptors.FieldDescriptor field, java.lang.Object value)
Message.BuilderMessageOrBuilder.getField(Descriptors.FieldDescriptor) would return.setField in interface Message.BuildersetField in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field.Builder clearField(Descriptors.FieldDescriptor field)
Message.BuilderclearField in interface Message.BuilderclearField in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field.Builder clearOneof(Descriptors.OneofDescriptor oneof)
AbstractMessage.BuilderclearOneof in interface Message.BuilderclearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, java.lang.Object value)
Message.BuilderMessageOrBuilder.getRepeatedField(Descriptors.FieldDescriptor,int) would return.setRepeatedField in interface Message.BuildersetRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field.Builder addRepeatedField(Descriptors.FieldDescriptor field, java.lang.Object value)
Message.BuildersetRepeatedField, but appends the value as a new element.addRepeatedField in interface Message.BuilderaddRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field.Builder mergeFrom(Message other)
Message.Builderother into the message being built. other must have the exact same type
as this (i.e. getDescriptorForType() == other.getDescriptorForType()).
Merging occurs as follows. For each field:
* For singular primitive fields, if the field is set in other, then other's
value overwrites the value in this message.
* For singular message fields, if the field is set in other, it is merged into the
corresponding sub-message of this message using the same merging rules.
* For repeated fields, the elements in other are concatenated with the elements in
this message.
* For oneof groups, if the other message has one of the fields set, the group of this message
is cleared and replaced by the field of the other message, so that the oneof constraint is
preserved.
This is equivalent to the Message::MergeFrom method in C++.
mergeFrom in interface Message.BuildermergeFrom in class AbstractMessage.Builder<Field.Builder>public Field.Builder mergeFrom(Field other)
public final boolean isInitialized()
MessageLiteOrBuilderisInitialized in interface MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public Field.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.IOException
MessageLite.BuilderMessageLite.Builder.mergeFrom(CodedInputStream), but also parses extensions. The extensions
that you want to be able to parse must be registered in extensionRegistry. Extensions
not in the registry will be treated as unknown fields.mergeFrom in interface Message.BuildermergeFrom in interface MessageLite.BuildermergeFrom in class AbstractMessage.Builder<Field.Builder>java.io.IOExceptionpublic int getKindValue()
The field type.
.google.protobuf.Field.Kind kind = 1;getKindValue in interface FieldOrBuilderpublic Field.Builder setKindValue(int value)
The field type.
.google.protobuf.Field.Kind kind = 1;value - The enum numeric value on the wire for kind to set.public Field.Kind getKind()
The field type.
.google.protobuf.Field.Kind kind = 1;getKind in interface FieldOrBuilderpublic Field.Builder setKind(Field.Kind value)
The field type.
.google.protobuf.Field.Kind kind = 1;value - The kind to set.public Field.Builder clearKind()
The field type.
.google.protobuf.Field.Kind kind = 1;public int getCardinalityValue()
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;getCardinalityValue in interface FieldOrBuilderpublic Field.Builder setCardinalityValue(int value)
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;value - The enum numeric value on the wire for cardinality to set.public Field.Cardinality getCardinality()
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;getCardinality in interface FieldOrBuilderpublic Field.Builder setCardinality(Field.Cardinality value)
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;value - The cardinality to set.public Field.Builder clearCardinality()
The field cardinality.
.google.protobuf.Field.Cardinality cardinality = 2;public int getNumber()
The field number.
int32 number = 3;getNumber in interface FieldOrBuilderpublic Field.Builder setNumber(int value)
The field number.
int32 number = 3;value - The number to set.public Field.Builder clearNumber()
The field number.
int32 number = 3;public java.lang.String getName()
The field name.
string name = 4;getName in interface FieldOrBuilderpublic ByteString getNameBytes()
The field name.
string name = 4;getNameBytes in interface FieldOrBuilderpublic Field.Builder setName(java.lang.String value)
The field name.
string name = 4;value - The name to set.public Field.Builder clearName()
The field name.
string name = 4;public Field.Builder setNameBytes(ByteString value)
The field name.
string name = 4;value - The bytes for name to set.public java.lang.String getTypeUrl()
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;getTypeUrl in interface FieldOrBuilderpublic ByteString getTypeUrlBytes()
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;getTypeUrlBytes in interface FieldOrBuilderpublic Field.Builder setTypeUrl(java.lang.String value)
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;value - The typeUrl to set.public Field.Builder clearTypeUrl()
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;public Field.Builder setTypeUrlBytes(ByteString value)
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
string type_url = 6;value - The bytes for typeUrl to set.public int getOneofIndex()
The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list.
int32 oneof_index = 7;getOneofIndex in interface FieldOrBuilderpublic Field.Builder setOneofIndex(int value)
The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list.
int32 oneof_index = 7;value - The oneofIndex to set.public Field.Builder clearOneofIndex()
The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list.
int32 oneof_index = 7;public boolean getPacked()
Whether to use alternative packed wire representation.
bool packed = 8;getPacked in interface FieldOrBuilderpublic Field.Builder setPacked(boolean value)
Whether to use alternative packed wire representation.
bool packed = 8;value - The packed to set.public Field.Builder clearPacked()
Whether to use alternative packed wire representation.
bool packed = 8;public java.util.List<Option> getOptionsList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;getOptionsList in interface FieldOrBuilderpublic int getOptionsCount()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;getOptionsCount in interface FieldOrBuilderpublic Option getOptions(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;getOptions in interface FieldOrBuilderpublic Field.Builder setOptions(int index, Option value)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder setOptions(int index, Option.Builder builderForValue)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder addOptions(Option value)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder addOptions(int index, Option value)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder addOptions(Option.Builder builderForValue)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder addOptions(int index, Option.Builder builderForValue)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder addAllOptions(java.lang.Iterable<? extends Option> values)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder clearOptions()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Field.Builder removeOptions(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Option.Builder getOptionsBuilder(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public OptionOrBuilder getOptionsOrBuilder(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;getOptionsOrBuilder in interface FieldOrBuilderpublic java.util.List<? extends OptionOrBuilder> getOptionsOrBuilderList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;getOptionsOrBuilderList in interface FieldOrBuilderpublic Option.Builder addOptionsBuilder()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public Option.Builder addOptionsBuilder(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public java.util.List<Option.Builder> getOptionsBuilderList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;public java.lang.String getJsonName()
The field JSON name.
string json_name = 10;getJsonName in interface FieldOrBuilderpublic ByteString getJsonNameBytes()
The field JSON name.
string json_name = 10;getJsonNameBytes in interface FieldOrBuilderpublic Field.Builder setJsonName(java.lang.String value)
The field JSON name.
string json_name = 10;value - The jsonName to set.public Field.Builder clearJsonName()
The field JSON name.
string json_name = 10;public Field.Builder setJsonNameBytes(ByteString value)
The field JSON name.
string json_name = 10;value - The bytes for jsonName to set.public java.lang.String getDefaultValue()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;getDefaultValue in interface FieldOrBuilderpublic ByteString getDefaultValueBytes()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;getDefaultValueBytes in interface FieldOrBuilderpublic Field.Builder setDefaultValue(java.lang.String value)
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;value - The defaultValue to set.public Field.Builder clearDefaultValue()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;public Field.Builder setDefaultValueBytes(ByteString value)
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;value - The bytes for defaultValue to set.public final Field.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
Message.BuilderUnknownFieldSet for this message.setUnknownFields in interface Message.BuildersetUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>public final Field.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
Message.BuilderUnknownFieldSet for this message.mergeUnknownFields in interface Message.BuildermergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>