public static final class DescriptorProtos.OneofDescriptorProto.Builder extends GeneratedMessageV3.Builder<DescriptorProtos.OneofDescriptorProto.Builder> implements DescriptorProtos.OneofDescriptorProtoOrBuilder
Describes a oneof.
Protobuf type google.protobuf.OneofDescriptorProto
Inheritance
Object > AbstractMessageLite.Builder<MessageType,BuilderType> > AbstractMessage.Builder<BuilderType> > GeneratedMessageV3.Builder > DescriptorProtos.OneofDescriptorProto.BuilderStatic Methods
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns | |
---|---|
Type | Description |
Descriptors.Descriptor |
Methods
addRepeatedField(Descriptors.FieldDescriptor field, Object value)
public DescriptorProtos.OneofDescriptorProto.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters | |
---|---|
Name | Description |
field |
Descriptors.FieldDescriptor |
value |
Object |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
build()
public DescriptorProtos.OneofDescriptorProto build()
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto |
buildPartial()
public DescriptorProtos.OneofDescriptorProto buildPartial()
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto |
clear()
public DescriptorProtos.OneofDescriptorProto.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 | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
clearField(Descriptors.FieldDescriptor field)
public DescriptorProtos.OneofDescriptorProto.Builder clearField(Descriptors.FieldDescriptor field)
Parameter | |
---|---|
Name | Description |
field |
Descriptors.FieldDescriptor |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
clearName()
public DescriptorProtos.OneofDescriptorProto.Builder clearName()
optional string name = 1;
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
This builder for chaining. |
clearOneof(Descriptors.OneofDescriptor oneof)
public DescriptorProtos.OneofDescriptorProto.Builder clearOneof(Descriptors.OneofDescriptor oneof)
TODO(jieluo): Clear it when all subclasses have implemented this method.
Parameter | |
---|---|
Name | Description |
oneof |
Descriptors.OneofDescriptor |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
clearOptions()
public DescriptorProtos.OneofDescriptorProto.Builder clearOptions()
optional .google.protobuf.OneofOptions options = 2;
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
clone()
public DescriptorProtos.OneofDescriptorProto.Builder clone()
Clones the Builder.
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
getDefaultInstanceForType()
public DescriptorProtos.OneofDescriptorProto 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 | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto |
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 | |
---|---|
Type | Description |
Descriptors.Descriptor |
getName()
public String getName()
optional string name = 1;
Returns | |
---|---|
Type | Description |
String |
The name. |
getNameBytes()
public ByteString getNameBytes()
optional string name = 1;
Returns | |
---|---|
Type | Description |
ByteString |
The bytes for name. |
getOptions()
public DescriptorProtos.OneofOptions getOptions()
optional .google.protobuf.OneofOptions options = 2;
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofOptions |
The options. |
getOptionsBuilder()
public DescriptorProtos.OneofOptions.Builder getOptionsBuilder()
optional .google.protobuf.OneofOptions options = 2;
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofOptions.Builder |
getOptionsOrBuilder()
public DescriptorProtos.OneofOptionsOrBuilder getOptionsOrBuilder()
optional .google.protobuf.OneofOptions options = 2;
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofOptionsOrBuilder |
hasName()
public boolean hasName()
optional string name = 1;
Returns | |
---|---|
Type | Description |
boolean |
Whether the name field is set. |
hasOptions()
public boolean hasOptions()
optional .google.protobuf.OneofOptions options = 2;
Returns | |
---|---|
Type | Description |
boolean |
Whether the options 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 | |
---|---|
Type | Description |
GeneratedMessageV3.FieldAccessorTable |
isInitialized()
public final boolean isInitialized()
Returns true if all required fields in the message and all embedded messages are set, false otherwise.
Returns | |
---|---|
Type | Description |
boolean |
mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
public DescriptorProtos.OneofDescriptorProto.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 | |
---|---|
Name | Description |
input |
CodedInputStream |
extensionRegistry |
ExtensionRegistryLite |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
Exceptions | |
---|---|
Type | Description |
IOException |
mergeFrom(DescriptorProtos.OneofDescriptorProto other)
public DescriptorProtos.OneofDescriptorProto.Builder mergeFrom(DescriptorProtos.OneofDescriptorProto other)
Parameter | |
---|---|
Name | Description |
other |
DescriptorProtos.OneofDescriptorProto |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
mergeFrom(Message other)
public DescriptorProtos.OneofDescriptorProto.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
, thenother
'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 | |
---|---|
Name | Description |
other |
Message |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
mergeOptions(DescriptorProtos.OneofOptions value)
public DescriptorProtos.OneofDescriptorProto.Builder mergeOptions(DescriptorProtos.OneofOptions value)
optional .google.protobuf.OneofOptions options = 2;
Parameter | |
---|---|
Name | Description |
value |
DescriptorProtos.OneofOptions |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
mergeUnknownFields(UnknownFieldSet unknownFields)
public final DescriptorProtos.OneofDescriptorProto.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Merge some unknown fields into the UnknownFieldSet for this message.
Parameter | |
---|---|
Name | Description |
unknownFields |
UnknownFieldSet |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
setField(Descriptors.FieldDescriptor field, Object value)
public DescriptorProtos.OneofDescriptorProto.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters | |
---|---|
Name | Description |
field |
Descriptors.FieldDescriptor |
value |
Object |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
setName(String value)
public DescriptorProtos.OneofDescriptorProto.Builder setName(String value)
optional string name = 1;
Parameter | |
---|---|
Name | Description |
value |
String The name to set. |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
This builder for chaining. |
setNameBytes(ByteString value)
public DescriptorProtos.OneofDescriptorProto.Builder setNameBytes(ByteString value)
optional string name = 1;
Parameter | |
---|---|
Name | Description |
value |
ByteString The bytes for name to set. |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
This builder for chaining. |
setOptions(DescriptorProtos.OneofOptions value)
public DescriptorProtos.OneofDescriptorProto.Builder setOptions(DescriptorProtos.OneofOptions value)
optional .google.protobuf.OneofOptions options = 2;
Parameter | |
---|---|
Name | Description |
value |
DescriptorProtos.OneofOptions |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
setOptions(DescriptorProtos.OneofOptions.Builder builderForValue)
public DescriptorProtos.OneofDescriptorProto.Builder setOptions(DescriptorProtos.OneofOptions.Builder builderForValue)
optional .google.protobuf.OneofOptions options = 2;
Parameter | |
---|---|
Name | Description |
builderForValue |
DescriptorProtos.OneofOptions.Builder |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
public DescriptorProtos.OneofDescriptorProto.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters | |
---|---|
Name | Description |
field |
Descriptors.FieldDescriptor |
index |
int |
value |
Object |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |
setUnknownFields(UnknownFieldSet unknownFields)
public final DescriptorProtos.OneofDescriptorProto.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter | |
---|---|
Name | Description |
unknownFields |
UnknownFieldSet |
Returns | |
---|---|
Type | Description |
DescriptorProtos.OneofDescriptorProto.Builder |