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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Type Description
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
Name Description
value Any
Returns
Type Description
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
Name Description
value String

The name to set.

Returns
Type Description
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
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
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
Name Description
value Any
Returns
Type Description
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
Name Description
builderForValue Any.Builder
Returns
Type Description
Option.Builder