public static final class Field.Builder extends GeneratedMessage.Builder<Field.Builder> implements FieldOrBuilder
google.protobuf.Field
A single field of a message type.
| Modifier and Type | Method and Description |
|---|---|
Field.Builder |
addAllOptions(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 |
clearDefaultValue()
optional string default_value = 11; |
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.
|
String |
getDefaultValue()
optional string default_value = 11; |
ByteString |
getDefaultValueBytes()
optional string default_value = 11; |
static Descriptors.Descriptor |
getDescriptor() |
Descriptors.Descriptor |
getDescriptorForType()
Get the message's type's descriptor.
|
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; |
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; |
List<Option.Builder> |
getOptionsBuilderList()
repeated .google.protobuf.Option options = 9; |
int |
getOptionsCount()
repeated .google.protobuf.Option options = 9; |
List<Option> |
getOptionsList()
repeated .google.protobuf.Option options = 9; |
OptionOrBuilder |
getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9; |
List<? extends OptionOrBuilder> |
getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9; |
boolean |
getPacked()
optional bool packed = 8; |
String |
getTypeUrl()
optional string type_url = 6; |
ByteString |
getTypeUrlBytes()
optional string type_url = 6; |
protected GeneratedMessage.FieldAccessorTable |
internalGetFieldAccessorTable()
Get the FieldAccessorTable for this type.
|
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 |
setDefaultValue(String value)
optional string default_value = 11; |
Field.Builder |
setDefaultValueBytes(ByteString value)
optional string default_value = 11; |
Field.Builder |
setJsonName(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(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(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, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, parseUnknownField, setField, setRepeatedFieldfindInitializationErrors, getInitializationErrorString, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toStringaddAll, newUninitializedMessageExceptionequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfindInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneofpublic static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
GeneratedMessage.BuilderinternalGetFieldAccessorTable in class GeneratedMessage.Builder<Field.Builder>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 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>IOExceptionpublic int getKindValue()
optional .google.protobuf.Field.Kind kind = 1;
The field type.
getKindValue in interface FieldOrBuilderpublic Field.Builder setKindValue(int value)
optional .google.protobuf.Field.Kind kind = 1;
The field type.
public Field.Kind getKind()
optional .google.protobuf.Field.Kind kind = 1;
The field type.
getKind in interface FieldOrBuilderpublic Field.Builder setKind(Field.Kind value)
optional .google.protobuf.Field.Kind kind = 1;
The field type.
public Field.Builder clearKind()
optional .google.protobuf.Field.Kind kind = 1;
The field type.
public int getCardinalityValue()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
getCardinalityValue in interface FieldOrBuilderpublic Field.Builder setCardinalityValue(int value)
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
public Field.Cardinality getCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
getCardinality in interface FieldOrBuilderpublic Field.Builder setCardinality(Field.Cardinality value)
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
public Field.Builder clearCardinality()
optional .google.protobuf.Field.Cardinality cardinality = 2;
The field cardinality.
public int getNumber()
optional int32 number = 3;
The field number.
getNumber in interface FieldOrBuilderpublic Field.Builder setNumber(int value)
optional int32 number = 3;
The field number.
public Field.Builder clearNumber()
optional int32 number = 3;
The field number.
public 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(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 String getTypeUrl()
optional string type_url = 6;
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
getTypeUrl in interface FieldOrBuilderpublic ByteString getTypeUrlBytes()
optional string type_url = 6;
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
getTypeUrlBytes in interface FieldOrBuilderpublic Field.Builder setTypeUrl(String value)
optional string type_url = 6;
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
public Field.Builder clearTypeUrl()
optional string type_url = 6;
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
public Field.Builder setTypeUrlBytes(ByteString value)
optional string type_url = 6;
The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
public int getOneofIndex()
optional int32 oneof_index = 7;
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.
getOneofIndex in interface FieldOrBuilderpublic Field.Builder setOneofIndex(int value)
optional int32 oneof_index = 7;
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.
public Field.Builder clearOneofIndex()
optional int32 oneof_index = 7;
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.
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 List<Option> getOptionsList()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsList in interface FieldOrBuilderpublic int getOptionsCount()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsCount in interface FieldOrBuilderpublic Option getOptions(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptions in interface FieldOrBuilderpublic Field.Builder setOptions(int index, Option value)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder setOptions(int index, Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder addOptions(Option value)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder addOptions(int index, Option value)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder addOptions(Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder addOptions(int index, Option.Builder builderForValue)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder addAllOptions(Iterable<? extends Option> values)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder clearOptions()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Field.Builder removeOptions(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Option.Builder getOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public OptionOrBuilder getOptionsOrBuilder(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsOrBuilder in interface FieldOrBuilderpublic List<? extends OptionOrBuilder> getOptionsOrBuilderList()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
getOptionsOrBuilderList in interface FieldOrBuilderpublic Option.Builder addOptionsBuilder()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public Option.Builder addOptionsBuilder(int index)
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public List<Option.Builder> getOptionsBuilderList()
repeated .google.protobuf.Option options = 9;
The protocol buffer options.
public String getJsonName()
optional string json_name = 10;
The field JSON name.
getJsonName in interface FieldOrBuilderpublic ByteString getJsonNameBytes()
optional string json_name = 10;
The field JSON name.
getJsonNameBytes in interface FieldOrBuilderpublic Field.Builder setJsonName(String value)
optional string json_name = 10;
The field JSON name.
public Field.Builder clearJsonName()
optional string json_name = 10;
The field JSON name.
public Field.Builder setJsonNameBytes(ByteString value)
optional string json_name = 10;
The field JSON name.
public String getDefaultValue()
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
getDefaultValue in interface FieldOrBuilderpublic ByteString getDefaultValueBytes()
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
getDefaultValueBytes in interface FieldOrBuilderpublic Field.Builder setDefaultValue(String value)
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
public Field.Builder clearDefaultValue()
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
public Field.Builder setDefaultValueBytes(ByteString value)
optional string default_value = 11;
The string value of the default value of this field. Proto2 syntax only.
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>Copyright © 2008–2016 Google. All rights reserved.