Class Option.Builder (3.19.4)

public static final class Option.Builder extends GeneratedMessageLite.Builder<Option,Option.Builder> implements OptionOrBuilder

A protocol buffer option, which can be attached to a message, field, enumeration, etc.

Protobuf type google.protobuf.Option

Implements

OptionOrBuilder

Methods

clearName()

public Option.Builder clearName()

The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, "map_entry". For custom options, it should be the fully-qualified name. For example, "google.api.http".

string name = 1;

Returns
TypeDescription
Option.Builder

This builder for chaining.

clearValue()

public Option.Builder clearValue()

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

.google.protobuf.Any value = 2;

Returns
TypeDescription
Option.Builder

getName()

public String getName()

The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, "map_entry". For custom options, it should be the fully-qualified name. For example, "google.api.http".

string name = 1;

Returns
TypeDescription
String

The name.

getNameBytes()

public ByteString getNameBytes()

The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, "map_entry". For custom options, it should be the fully-qualified name. For example, "google.api.http".

string name = 1;

Returns
TypeDescription
ByteString

The bytes for name.

getValue()

public Any getValue()

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

.google.protobuf.Any value = 2;

Returns
TypeDescription
Any

hasValue()

public boolean hasValue()

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

.google.protobuf.Any value = 2;

Returns
TypeDescription
boolean

mergeValue(Any value)

public Option.Builder mergeValue(Any value)

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

.google.protobuf.Any value = 2;

Parameter
NameDescription
valueAny
Returns
TypeDescription
Option.Builder

setName(String value)

public Option.Builder setName(String value)

The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, "map_entry". For custom options, it should be the fully-qualified name. For example, "google.api.http".

string name = 1;

Parameter
NameDescription
valueString

The name to set.

Returns
TypeDescription
Option.Builder

This builder for chaining.

setNameBytes(ByteString value)

public Option.Builder setNameBytes(ByteString value)

The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, "map_entry". For custom options, it should be the fully-qualified name. For example, "google.api.http".

string name = 1;

Parameter
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
Option.Builder

This builder for chaining.

setValue(Any value)

public Option.Builder setValue(Any value)

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

.google.protobuf.Any value = 2;

Parameter
NameDescription
valueAny
Returns
TypeDescription
Option.Builder

setValue(Any.Builder builderForValue)

public Option.Builder setValue(Any.Builder builderForValue)

The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type.

.google.protobuf.Any value = 2;

Parameter
NameDescription
builderForValueAny.Builder
Returns
TypeDescription
Option.Builder