public static final class Field.Builder extends 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(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,
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)
TODO(jieluo): Clear it when all subclasses have implemented this method.
|
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.
|
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.
|
String |
getJsonName()
The field JSON name.
|
ByteString |
getJsonNameBytes()
The field JSON name.
|
Field.Kind |
getKind()
The field type.
|
int |
getKindValue()
The field type.
|
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.
|
List<Option.Builder> |
getOptionsBuilderList()
The protocol buffer options.
|
int |
getOptionsCount()
The protocol buffer options.
|
List<Option> |
getOptionsList()
The protocol buffer options.
|
OptionOrBuilder |
getOptionsOrBuilder(int index)
The protocol buffer options.
|
List<? extends OptionOrBuilder> |
getOptionsOrBuilderList()
The protocol buffer options.
|
boolean |
getPacked()
Whether to use alternative packed wire representation.
|
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.
|
protected GeneratedMessageV3.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)
The protocol buffer options.
|
Field.Builder |
setCardinality(Field.Cardinality value)
The field cardinality.
|
Field.Builder |
setCardinalityValue(int value)
The field cardinality.
|
Field.Builder |
setDefaultValue(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,
Object value)
Sets a field to the given value.
|
Field.Builder |
setJsonName(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(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,
Object value)
Sets an element of a repeated field to the given value.
|
Field.Builder |
setTypeUrl(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(UnknownFieldSet unknownFields)
Set the
UnknownFieldSet for this message. |
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, setUnknownFieldsProto3
findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString
addAll, addAll, mergeFrom, newUninitializedMessageException
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
mergeFrom
public static final Descriptors.Descriptor getDescriptor()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
GeneratedMessageV3.Builder
internalGetFieldAccessorTable
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder clear()
GeneratedMessageV3.Builder
clear
in interface Message.Builder
clear
in interface MessageLite.Builder
clear
in class GeneratedMessageV3.Builder<Field.Builder>
public Descriptors.Descriptor getDescriptorForType()
Message.Builder
MessageOrBuilder.getDescriptorForType()
.getDescriptorForType
in interface Message.Builder
getDescriptorForType
in interface MessageOrBuilder
getDescriptorForType
in class GeneratedMessageV3.Builder<Field.Builder>
public Field getDefaultInstanceForType()
MessageLiteOrBuilder
getDefaultInstance()
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 MessageLiteOrBuilder
getDefaultInstanceForType
in interface MessageOrBuilder
public Field build()
MessageLite.Builder
build
in interface Message.Builder
build
in interface MessageLite.Builder
public Field buildPartial()
MessageLite.Builder
MessageLite.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.Builder
buildPartial
in interface MessageLite.Builder
public Field.Builder clone()
MessageLite.Builder
clone
in interface Message.Builder
clone
in interface MessageLite.Builder
clone
in class GeneratedMessageV3.Builder<Field.Builder>
Object.clone()
public Field.Builder setField(Descriptors.FieldDescriptor field, Object value)
Message.Builder
MessageOrBuilder.getField(Descriptors.FieldDescriptor)
would return.setField
in interface Message.Builder
setField
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder clearField(Descriptors.FieldDescriptor field)
Message.Builder
clearField
in interface Message.Builder
clearField
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder clearOneof(Descriptors.OneofDescriptor oneof)
AbstractMessage.Builder
clearOneof
in interface Message.Builder
clearOneof
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Message.Builder
MessageOrBuilder.getRepeatedField(Descriptors.FieldDescriptor,int)
would return.setRepeatedField
in interface Message.Builder
setRepeatedField
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Message.Builder
setRepeatedField
, but appends the value as a new element.addRepeatedField
in interface Message.Builder
addRepeatedField
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder mergeFrom(Message other)
Message.Builder
other
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.Builder
mergeFrom
in class AbstractMessage.Builder<Field.Builder>
public Field.Builder mergeFrom(Field other)
public final boolean isInitialized()
MessageLiteOrBuilder
isInitialized
in interface MessageLiteOrBuilder
isInitialized
in class GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws IOException
MessageLite.Builder
MessageLite.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.Builder
mergeFrom
in interface MessageLite.Builder
mergeFrom
in class AbstractMessage.Builder<Field.Builder>
IOException
public int getKindValue()
The field type.
.google.protobuf.Field.Kind kind = 1;
getKindValue
in interface FieldOrBuilder
public 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 FieldOrBuilder
public 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 FieldOrBuilder
public 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 FieldOrBuilder
public 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 FieldOrBuilder
public 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 String getName()
The field name.
string name = 4;
getName
in interface FieldOrBuilder
public ByteString getNameBytes()
The field name.
string name = 4;
getNameBytes
in interface FieldOrBuilder
public Field.Builder setName(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 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 FieldOrBuilder
public 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 FieldOrBuilder
public Field.Builder setTypeUrl(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 FieldOrBuilder
public 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 FieldOrBuilder
public 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 List<Option> getOptionsList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsList
in interface FieldOrBuilder
public int getOptionsCount()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsCount
in interface FieldOrBuilder
public Option getOptions(int index)
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptions
in interface FieldOrBuilder
public 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(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 FieldOrBuilder
public List<? extends OptionOrBuilder> getOptionsOrBuilderList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
getOptionsOrBuilderList
in interface FieldOrBuilder
public 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 List<Option.Builder> getOptionsBuilderList()
The protocol buffer options.
repeated .google.protobuf.Option options = 9;
public String getJsonName()
The field JSON name.
string json_name = 10;
getJsonName
in interface FieldOrBuilder
public ByteString getJsonNameBytes()
The field JSON name.
string json_name = 10;
getJsonNameBytes
in interface FieldOrBuilder
public Field.Builder setJsonName(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 String getDefaultValue()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
getDefaultValue
in interface FieldOrBuilder
public ByteString getDefaultValueBytes()
The string value of the default value of this field. Proto2 syntax only.
string default_value = 11;
getDefaultValueBytes
in interface FieldOrBuilder
public Field.Builder setDefaultValue(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(UnknownFieldSet unknownFields)
Message.Builder
UnknownFieldSet
for this message.setUnknownFields
in interface Message.Builder
setUnknownFields
in class GeneratedMessageV3.Builder<Field.Builder>
public final Field.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Message.Builder
UnknownFieldSet
for this message.mergeUnknownFields
in interface Message.Builder
mergeUnknownFields
in class GeneratedMessageV3.Builder<Field.Builder>
Copyright © 2008–2020. All rights reserved.