Class DescriptorProtos.FieldDescriptorProto.Builder

public static final class DescriptorProtos.FieldDescriptorProto.Builder extends GeneratedMessageV3.Builder<DescriptorProtos.FieldDescriptorProto.Builder> implements DescriptorProtos.FieldDescriptorProtoOrBuilder

Describes a field within a message.

Protobuf type google.protobuf.FieldDescriptorProto

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
TypeDescription
Descriptors.Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public DescriptorProtos.FieldDescriptorProto.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldDescriptors.FieldDescriptor
valueObject
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

build()

public DescriptorProtos.FieldDescriptorProto build()
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto

buildPartial()

public DescriptorProtos.FieldDescriptorProto buildPartial()
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto

clear()

public DescriptorProtos.FieldDescriptorProto.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.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

clearDefaultValue()

public DescriptorProtos.FieldDescriptorProto.Builder clearDefaultValue()

For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. TODO(kenton): Base-64 encode?

optional string default_value = 7;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearExtendee()

public DescriptorProtos.FieldDescriptorProto.Builder clearExtendee()

For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.

optional string extendee = 2;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public DescriptorProtos.FieldDescriptorProto.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldDescriptors.FieldDescriptor
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

clearJsonName()

public DescriptorProtos.FieldDescriptorProto.Builder clearJsonName()

JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.

optional string json_name = 10;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearLabel()

public DescriptorProtos.FieldDescriptorProto.Builder clearLabel()

optional .google.protobuf.FieldDescriptorProto.Label label = 4;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearName()

public DescriptorProtos.FieldDescriptorProto.Builder clearName()

optional string name = 1;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearNumber()

public DescriptorProtos.FieldDescriptorProto.Builder clearNumber()

optional int32 number = 3;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearOneof(Descriptors.OneofDescriptor oneof)

public DescriptorProtos.FieldDescriptorProto.Builder clearOneof(Descriptors.OneofDescriptor oneof)

TODO(jieluo): Clear it when all subclasses have implemented this method.

Parameter
NameDescription
oneofDescriptors.OneofDescriptor
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

clearOneofIndex()

public DescriptorProtos.FieldDescriptorProto.Builder clearOneofIndex()

If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof.

optional int32 oneof_index = 9;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearOptions()

public DescriptorProtos.FieldDescriptorProto.Builder clearOptions()

optional .google.protobuf.FieldOptions options = 8;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

clearProto3Optional()

public DescriptorProtos.FieldDescriptorProto.Builder clearProto3Optional()

If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with LABEL_OPTIONAL.

optional bool proto3_optional = 17;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearType()

public DescriptorProtos.FieldDescriptorProto.Builder clearType()

If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.

optional .google.protobuf.FieldDescriptorProto.Type type = 5;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clearTypeName()

public DescriptorProtos.FieldDescriptorProto.Builder clearTypeName()

For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).

optional string type_name = 6;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

clone()

public DescriptorProtos.FieldDescriptorProto.Builder clone()

Clones the Builder.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

getDefaultInstanceForType()

public DescriptorProtos.FieldDescriptorProto getDefaultInstanceForType()

Get an instance of the type with no fields set. Because no fields are set, all getters for singular fields will return default values and repeated fields will appear empty. This may or may not be a singleton. This differs from the 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.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto

getDefaultValue()

public String getDefaultValue()

For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. TODO(kenton): Base-64 encode?

optional string default_value = 7;

Returns
TypeDescription
String

The defaultValue.

getDefaultValueBytes()

public ByteString getDefaultValueBytes()

For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. TODO(kenton): Base-64 encode?

optional string default_value = 7;

Returns
TypeDescription
ByteString

The bytes for defaultValue.

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()

Get the message's type's descriptor. This differs from the getDescriptor() method of generated message classes in that this method is an abstract method of the Message interface whereas getDescriptor() is a static method of a specific class. They return the same thing.

Returns
TypeDescription
Descriptors.Descriptor
Overrides

getExtendee()

public String getExtendee()

For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.

optional string extendee = 2;

Returns
TypeDescription
String

The extendee.

getExtendeeBytes()

public ByteString getExtendeeBytes()

For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.

optional string extendee = 2;

Returns
TypeDescription
ByteString

The bytes for extendee.

getJsonName()

public String getJsonName()

JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.

optional string json_name = 10;

Returns
TypeDescription
String

The jsonName.

getJsonNameBytes()

public ByteString getJsonNameBytes()

JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.

optional string json_name = 10;

Returns
TypeDescription
ByteString

The bytes for jsonName.

getLabel()

public DescriptorProtos.FieldDescriptorProto.Label getLabel()

optional .google.protobuf.FieldDescriptorProto.Label label = 4;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Label

The label.

getName()

public String getName()

optional string name = 1;

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

optional string name = 1;

Returns
TypeDescription
ByteString

The bytes for name.

getNumber()

public int getNumber()

optional int32 number = 3;

Returns
TypeDescription
int

The number.

getOneofIndex()

public int getOneofIndex()

If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof.

optional int32 oneof_index = 9;

Returns
TypeDescription
int

The oneofIndex.

getOptions()

public DescriptorProtos.FieldOptions getOptions()

optional .google.protobuf.FieldOptions options = 8;

Returns
TypeDescription
DescriptorProtos.FieldOptions

The options.

getOptionsBuilder()

public DescriptorProtos.FieldOptions.Builder getOptionsBuilder()

optional .google.protobuf.FieldOptions options = 8;

Returns
TypeDescription
DescriptorProtos.FieldOptions.Builder

getOptionsOrBuilder()

public DescriptorProtos.FieldOptionsOrBuilder getOptionsOrBuilder()

optional .google.protobuf.FieldOptions options = 8;

Returns
TypeDescription
DescriptorProtos.FieldOptionsOrBuilder

getProto3Optional()

public boolean getProto3Optional()

If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with LABEL_OPTIONAL.

optional bool proto3_optional = 17;

Returns
TypeDescription
boolean

The proto3Optional.

getType()

public DescriptorProtos.FieldDescriptorProto.Type getType()

If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.

optional .google.protobuf.FieldDescriptorProto.Type type = 5;

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Type

The type.

getTypeName()

public String getTypeName()

For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).

optional string type_name = 6;

Returns
TypeDescription
String

The typeName.

getTypeNameBytes()

public ByteString getTypeNameBytes()

For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).

optional string type_name = 6;

Returns
TypeDescription
ByteString

The bytes for typeName.

hasDefaultValue()

public boolean hasDefaultValue()

For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. TODO(kenton): Base-64 encode?

optional string default_value = 7;

Returns
TypeDescription
boolean

Whether the defaultValue field is set.

hasExtendee()

public boolean hasExtendee()

For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.

optional string extendee = 2;

Returns
TypeDescription
boolean

Whether the extendee field is set.

hasJsonName()

public boolean hasJsonName()

JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.

optional string json_name = 10;

Returns
TypeDescription
boolean

Whether the jsonName field is set.

hasLabel()

public boolean hasLabel()

optional .google.protobuf.FieldDescriptorProto.Label label = 4;

Returns
TypeDescription
boolean

Whether the label field is set.

hasName()

public boolean hasName()

optional string name = 1;

Returns
TypeDescription
boolean

Whether the name field is set.

hasNumber()

public boolean hasNumber()

optional int32 number = 3;

Returns
TypeDescription
boolean

Whether the number field is set.

hasOneofIndex()

public boolean hasOneofIndex()

If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof.

optional int32 oneof_index = 9;

Returns
TypeDescription
boolean

Whether the oneofIndex field is set.

hasOptions()

public boolean hasOptions()

optional .google.protobuf.FieldOptions options = 8;

Returns
TypeDescription
boolean

Whether the options field is set.

hasProto3Optional()

public boolean hasProto3Optional()

If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with LABEL_OPTIONAL.

optional bool proto3_optional = 17;

Returns
TypeDescription
boolean

Whether the proto3Optional field is set.

hasType()

public boolean hasType()

If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.

optional .google.protobuf.FieldDescriptorProto.Type type = 5;

Returns
TypeDescription
boolean

Whether the type field is set.

hasTypeName()

public boolean hasTypeName()

For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).

optional string type_name = 6;

Returns
TypeDescription
boolean

Whether the typeName field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()

Get the FieldAccessorTable for this type. We can't have the message class pass this in to the constructor because of bootstrapping trouble with DescriptorProtos.

Returns
TypeDescription
GeneratedMessageV3.FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()

Returns true if all required fields in the message and all embedded messages are set, false otherwise.

See also: MessageOrBuilder#getInitializationErrorString()

Returns
TypeDescription
boolean
Overrides

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public DescriptorProtos.FieldDescriptorProto.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

Like 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.

Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides Exceptions
TypeDescription
IOException

mergeFrom(DescriptorProtos.FieldDescriptorProto other)

public DescriptorProtos.FieldDescriptorProto.Builder mergeFrom(DescriptorProtos.FieldDescriptorProto other)
Parameter
NameDescription
otherDescriptorProtos.FieldDescriptorProto
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

mergeFrom(Message other)

public DescriptorProtos.FieldDescriptorProto.Builder mergeFrom(Message other)

Merge 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++.

Parameter
NameDescription
otherMessage
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

mergeOptions(DescriptorProtos.FieldOptions value)

public DescriptorProtos.FieldDescriptorProto.Builder mergeOptions(DescriptorProtos.FieldOptions value)

optional .google.protobuf.FieldOptions options = 8;

Parameter
NameDescription
valueDescriptorProtos.FieldOptions
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final DescriptorProtos.FieldDescriptorProto.Builder mergeUnknownFields(UnknownFieldSet unknownFields)

Merge some unknown fields into the UnknownFieldSet for this message.

Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

setDefaultValue(String value)

public DescriptorProtos.FieldDescriptorProto.Builder setDefaultValue(String value)

For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. TODO(kenton): Base-64 encode?

optional string default_value = 7;

Parameter
NameDescription
valueString

The defaultValue to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setDefaultValueBytes(ByteString value)

public DescriptorProtos.FieldDescriptorProto.Builder setDefaultValueBytes(ByteString value)

For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. TODO(kenton): Base-64 encode?

optional string default_value = 7;

Parameter
NameDescription
valueByteString

The bytes for defaultValue to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setExtendee(String value)

public DescriptorProtos.FieldDescriptorProto.Builder setExtendee(String value)

For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.

optional string extendee = 2;

Parameter
NameDescription
valueString

The extendee to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setExtendeeBytes(ByteString value)

public DescriptorProtos.FieldDescriptorProto.Builder setExtendeeBytes(ByteString value)

For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name.

optional string extendee = 2;

Parameter
NameDescription
valueByteString

The bytes for extendee to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public DescriptorProtos.FieldDescriptorProto.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldDescriptors.FieldDescriptor
valueObject
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

setJsonName(String value)

public DescriptorProtos.FieldDescriptorProto.Builder setJsonName(String value)

JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.

optional string json_name = 10;

Parameter
NameDescription
valueString

The jsonName to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setJsonNameBytes(ByteString value)

public DescriptorProtos.FieldDescriptorProto.Builder setJsonNameBytes(ByteString value)

JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase.

optional string json_name = 10;

Parameter
NameDescription
valueByteString

The bytes for jsonName to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setLabel(DescriptorProtos.FieldDescriptorProto.Label value)

public DescriptorProtos.FieldDescriptorProto.Builder setLabel(DescriptorProtos.FieldDescriptorProto.Label value)

optional .google.protobuf.FieldDescriptorProto.Label label = 4;

Parameter
NameDescription
valueDescriptorProtos.FieldDescriptorProto.Label

The label to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setName(String value)

public DescriptorProtos.FieldDescriptorProto.Builder setName(String value)

optional string name = 1;

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setNameBytes(ByteString value)

public DescriptorProtos.FieldDescriptorProto.Builder setNameBytes(ByteString value)

optional string name = 1;

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setNumber(int value)

public DescriptorProtos.FieldDescriptorProto.Builder setNumber(int value)

optional int32 number = 3;

Parameter
NameDescription
valueint

The number to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setOneofIndex(int value)

public DescriptorProtos.FieldDescriptorProto.Builder setOneofIndex(int value)

If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof.

optional int32 oneof_index = 9;

Parameter
NameDescription
valueint

The oneofIndex to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setOptions(DescriptorProtos.FieldOptions value)

public DescriptorProtos.FieldDescriptorProto.Builder setOptions(DescriptorProtos.FieldOptions value)

optional .google.protobuf.FieldOptions options = 8;

Parameter
NameDescription
valueDescriptorProtos.FieldOptions
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

setOptions(DescriptorProtos.FieldOptions.Builder builderForValue)

public DescriptorProtos.FieldDescriptorProto.Builder setOptions(DescriptorProtos.FieldOptions.Builder builderForValue)

optional .google.protobuf.FieldOptions options = 8;

Parameter
NameDescription
builderForValueDescriptorProtos.FieldOptions.Builder
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

setProto3Optional(boolean value)

public DescriptorProtos.FieldDescriptorProto.Builder setProto3Optional(boolean value)

If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with LABEL_OPTIONAL.

optional bool proto3_optional = 17;

Parameter
NameDescription
valueboolean

The proto3Optional to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public DescriptorProtos.FieldDescriptorProto.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
NameDescription
fieldDescriptors.FieldDescriptor
indexint
valueObject
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides

setType(DescriptorProtos.FieldDescriptorProto.Type value)

public DescriptorProtos.FieldDescriptorProto.Builder setType(DescriptorProtos.FieldDescriptorProto.Type value)

If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP.

optional .google.protobuf.FieldDescriptorProto.Type type = 5;

Parameter
NameDescription
valueDescriptorProtos.FieldDescriptorProto.Type

The type to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setTypeName(String value)

public DescriptorProtos.FieldDescriptorProto.Builder setTypeName(String value)

For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).

optional string type_name = 6;

Parameter
NameDescription
valueString

The typeName to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setTypeNameBytes(ByteString value)

public DescriptorProtos.FieldDescriptorProto.Builder setTypeNameBytes(ByteString value)

For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace).

optional string type_name = 6;

Parameter
NameDescription
valueByteString

The bytes for typeName to set.

Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final DescriptorProtos.FieldDescriptorProto.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
DescriptorProtos.FieldDescriptorProto.Builder
Overrides