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, newBuilderForField
findInitializationErrors, getInitializationErrorString, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, toString
mergeFrom
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
mergeFrom
public static final Descriptors.Descriptor getDescriptor()
public Field.Builder clear()
com.google.protobuf.GeneratedMessageV3.Builder
clear
in interface Message.Builder
clear
in interface MessageLite.Builder
clear
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public Descriptors.Descriptor getDescriptorForType()
Message.Builder
MessageOrBuilder.getDescriptorForType()
.getDescriptorForType
in interface Message.Builder
getDescriptorForType
in interface MessageOrBuilder
getDescriptorForType
in class com.google.protobuf.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 com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
Object.clone()
public Field.Builder setField(Descriptors.FieldDescriptor field, java.lang.Object value)
Message.Builder
MessageOrBuilder.getField(Descriptors.FieldDescriptor)
would return.setField
in interface Message.Builder
setField
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder clearField(Descriptors.FieldDescriptor field)
Message.Builder
clearField
in interface Message.Builder
clearField
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder clearOneof(Descriptors.OneofDescriptor oneof)
AbstractMessage.Builder
clearOneof
in interface Message.Builder
clearOneof
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, java.lang.Object value)
Message.Builder
MessageOrBuilder.getRepeatedField(Descriptors.FieldDescriptor,int)
would return.setRepeatedField
in interface Message.Builder
setRepeatedField
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder addRepeatedField(Descriptors.FieldDescriptor field, java.lang.Object value)
Message.Builder
setRepeatedField
, but appends the value as a new element.addRepeatedField
in interface Message.Builder
addRepeatedField
in class com.google.protobuf.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 com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public Field.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws java.io.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>
java.io.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 java.lang.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(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 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(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 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 java.util.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(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 FieldOrBuilder
public java.util.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 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 FieldOrBuilder
public ByteString getJsonNameBytes()
The field JSON name.
string json_name = 10;
getJsonNameBytes
in interface FieldOrBuilder
public 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 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(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.Builder
UnknownFieldSet
for this message.setUnknownFields
in interface Message.Builder
setUnknownFields
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>
public final Field.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
Message.Builder
UnknownFieldSet
for this message.mergeUnknownFields
in interface Message.Builder
mergeUnknownFields
in class com.google.protobuf.GeneratedMessageV3.Builder<Field.Builder>