public static final class Field.Builder extends GeneratedMessage.Builder<Field.Builder> implements FieldOrBuilder
google.protobuf.Field
Field represents a single field of a message type.
| Modifier and Type | Method and Description |
|---|---|
Field.Builder |
addAllOptions(java.lang.Iterable<? extends Option> values)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(int index,
Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(int index,
Option value)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
addOptions(Option value)
repeated .google.protobuf.Option options = 9; |
Option.Builder |
addOptionsBuilder()
repeated .google.protobuf.Option options = 9; |
Option.Builder |
addOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9; |
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()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field.Builder |
clearJsonName()
optional string json_name = 10; |
Field.Builder |
clearKind()
optional .google.protobuf.Field.Kind kind = 1; |
Field.Builder |
clearName()
optional string name = 4; |
Field.Builder |
clearNumber()
optional int32 number = 3; |
Field.Builder |
clearOneofIndex()
optional int32 oneof_index = 7; |
Field.Builder |
clearOptions()
repeated .google.protobuf.Option options = 9; |
Field.Builder |
clearPacked()
optional bool packed = 8; |
Field.Builder |
clearTypeUrl()
optional string type_url = 6; |
Field.Cardinality |
getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
int |
getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field |
getDefaultInstanceForType()
Get an instance of the type with no fields set.
|
static Descriptors.Descriptor |
getDescriptor() |
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor.
|
java.lang.String |
getJsonName()
optional string json_name = 10; |
ByteString |
getJsonNameBytes()
optional string json_name = 10; |
Field.Kind |
getKind()
optional .google.protobuf.Field.Kind kind = 1; |
int |
getKindValue()
optional .google.protobuf.Field.Kind kind = 1; |
java.lang.String |
getName()
optional string name = 4; |
ByteString |
getNameBytes()
optional string name = 4; |
int |
getNumber()
optional int32 number = 3; |
int |
getOneofIndex()
optional int32 oneof_index = 7; |
Option |
getOptions(int index)
repeated .google.protobuf.Option options = 9; |
Option.Builder |
getOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9; |
java.util.List<Option.Builder> |
getOptionsBuilderList()
repeated .google.protobuf.Option options = 9; |
int |
getOptionsCount()
repeated .google.protobuf.Option options = 9; |
java.util.List<Option> |
getOptionsList()
repeated .google.protobuf.Option options = 9; |
OptionOrBuilder |
getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9; |
java.util.List<? extends OptionOrBuilder> |
getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9; |
boolean |
getPacked()
optional bool packed = 8; |
java.lang.String |
getTypeUrl()
optional string type_url = 6; |
ByteString |
getTypeUrlBytes()
optional string type_url = 6; |
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(UnknownFieldSet unknownFields)
Merge some unknown fields into the
UnknownFieldSet for this
message. |
Field.Builder |
removeOptions(int index)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
setCardinality(Field.Cardinality value)
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field.Builder |
setCardinalityValue(int value)
optional .google.protobuf.Field.Cardinality cardinality = 2; |
Field.Builder |
setJsonName(java.lang.String value)
optional string json_name = 10; |
Field.Builder |
setJsonNameBytes(ByteString value)
optional string json_name = 10; |
Field.Builder |
setKind(Field.Kind value)
optional .google.protobuf.Field.Kind kind = 1; |
Field.Builder |
setKindValue(int value)
optional .google.protobuf.Field.Kind kind = 1; |
Field.Builder |
setName(java.lang.String value)
optional string name = 4; |
Field.Builder |
setNameBytes(ByteString value)
optional string name = 4; |
Field.Builder |
setNumber(int value)
optional int32 number = 3; |
Field.Builder |
setOneofIndex(int value)
optional int32 oneof_index = 7; |
Field.Builder |
setOptions(int index,
Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
setOptions(int index,
Option value)
repeated .google.protobuf.Option options = 9; |
Field.Builder |
setPacked(boolean value)
optional bool packed = 8; |
Field.Builder |
setTypeUrl(java.lang.String value)
optional string type_url = 6; |
Field.Builder |
setTypeUrlBytes(ByteString value)
optional string type_url = 6; |
Field.Builder |
setUnknownFields(UnknownFieldSet unknownFields)
Set the
UnknownFieldSet for this message. |
addRepeatedField, clearField, clearOneof, clone, getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, newBuilderForField, setField, setRepeatedFieldfindInitializationErrors, getInitializationErrorString, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneofpublic static final Descriptors.Descriptor getDescriptor()
public Field.Builder clear()
GeneratedMessage.Builderclear in interface Message.Builderclear in interface MessageLite.Builderclear in class GeneratedMessage.Builder<Field.Builder>public Descriptors.Descriptor getDescriptorForType()
Message.BuilderMessageOrBuilder.getDescriptorForType().getDescriptorForType in interface Message.BuildergetDescriptorForType in interface MessageOrBuildergetDescriptorForType in class GeneratedMessage.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 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:other,
then other's value overwrites the value in this message.other,
it is merged into the corresponding sub-message of this message
using the same merging rules.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 GeneratedMessage.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()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
getKindValue in interface FieldOrBuilderpublic Field.Builder setKindValue(int value)
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
public Field.Kind getKind()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
getKind in interface FieldOrBuilderpublic Field.Builder setKind(Field.Kind value)
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
public Field.Builder clearKind()
optional .google.protobuf.Field.Kind kind = 1;
The field kind.
public int getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
getCardinalityValue in interface FieldOrBuilderpublic Field.Builder setCardinalityValue(int value)
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
public Field.Cardinality getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
getCardinality in interface FieldOrBuilderpublic Field.Builder setCardinality(Field.Cardinality value)
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
public Field.Builder clearCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality, i.e. optional/required/repeated.
public int getNumber()
optional int32 number = 3;
The proto field number.
getNumber in interface FieldOrBuilderpublic Field.Builder setNumber(int value)
optional int32 number = 3;
The proto field number.
public Field.Builder clearNumber()
optional int32 number = 3;
The proto field number.
public java.lang.String getName()
optional string name = 4;
The field name.
getName in interface FieldOrBuilderpublic ByteString getNameBytes()
optional string name = 4;
The field name.
getNameBytes in interface FieldOrBuilderpublic Field.Builder setName(java.lang.String value)
optional string name = 4;
The field name.
public Field.Builder clearName()
optional string name = 4;
The field name.
public Field.Builder setNameBytes(ByteString value)
optional string name = 4;
The field name.
public java.lang.String getTypeUrl()
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
getTypeUrl in interface FieldOrBuilderpublic ByteString getTypeUrlBytes()
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
getTypeUrlBytes in interface FieldOrBuilderpublic Field.Builder setTypeUrl(java.lang.String value)
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
public Field.Builder clearTypeUrl()
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
public Field.Builder setTypeUrlBytes(ByteString value)
optional string type_url = 6;
The type URL (without the scheme) when the type is MESSAGE or ENUM, such as `type.googleapis.com/google.protobuf.Empty`.
public int getOneofIndex()
optional int32 oneof_index = 7;
Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
getOneofIndex in interface FieldOrBuilderpublic Field.Builder setOneofIndex(int value)
optional int32 oneof_index = 7;
Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
public Field.Builder clearOneofIndex()
optional int32 oneof_index = 7;
Index in Type.oneofs. Starts at 1. Zero means no oneof mapping.
public boolean getPacked()
optional bool packed = 8;
Whether to use alternative packed wire representation.
getPacked in interface FieldOrBuilderpublic Field.Builder setPacked(boolean value)
optional bool packed = 8;
Whether to use alternative packed wire representation.
public Field.Builder clearPacked()
optional bool packed = 8;
Whether to use alternative packed wire representation.
public java.util.List<Option> getOptionsList()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsList in interface FieldOrBuilderpublic int getOptionsCount()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsCount in interface FieldOrBuilderpublic Option getOptions(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
getOptions in interface FieldOrBuilderpublic Field.Builder setOptions(int index, Option value)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder setOptions(int index, Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(Option value)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(int index, Option value)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addOptions(int index, Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder addAllOptions(java.lang.Iterable<? extends Option> values)
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder clearOptions()
repeated .google.protobuf.Option options = 9;
The proto options.
public Field.Builder removeOptions(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
public Option.Builder getOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
public OptionOrBuilder getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsOrBuilder in interface FieldOrBuilderpublic java.util.List<? extends OptionOrBuilder> getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9;
The proto options.
getOptionsOrBuilderList in interface FieldOrBuilderpublic Option.Builder addOptionsBuilder()
repeated .google.protobuf.Option options = 9;
The proto options.
public Option.Builder addOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9;
The proto options.
public java.util.List<Option.Builder> getOptionsBuilderList()
repeated .google.protobuf.Option options = 9;
The proto options.
public java.lang.String getJsonName()
optional string json_name = 10;
The JSON name for this field.
getJsonName in interface FieldOrBuilderpublic ByteString getJsonNameBytes()
optional string json_name = 10;
The JSON name for this field.
getJsonNameBytes in interface FieldOrBuilderpublic Field.Builder setJsonName(java.lang.String value)
optional string json_name = 10;
The JSON name for this field.
public Field.Builder clearJsonName()
optional string json_name = 10;
The JSON name for this field.
public Field.Builder setJsonNameBytes(ByteString value)
optional string json_name = 10;
The JSON name for this field.
public final Field.Builder setUnknownFields(UnknownFieldSet unknownFields)
Message.BuilderUnknownFieldSet for this message.setUnknownFields in interface Message.BuildersetUnknownFields in class GeneratedMessage.Builder<Field.Builder>public final Field.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Message.BuilderUnknownFieldSet for this
message.mergeUnknownFields in interface Message.BuildermergeUnknownFields in class GeneratedMessage.Builder<Field.Builder>