Class PluginProtos.CodeGeneratorResponse.Builder (3.19.4)

public static final class PluginProtos.CodeGeneratorResponse.Builder extends GeneratedMessageV3.Builder<PluginProtos.CodeGeneratorResponse.Builder> implements PluginProtos.CodeGeneratorResponseOrBuilder

The plugin writes an encoded CodeGeneratorResponse to stdout.

Protobuf type google.protobuf.compiler.CodeGeneratorResponse

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptors.Descriptor

Methods

addAllFile(Iterable<? extends PluginProtos.CodeGeneratorResponse.File> values)

public PluginProtos.CodeGeneratorResponse.Builder addAllFile(Iterable<? extends PluginProtos.CodeGeneratorResponse.File> values)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
values Iterable<? extends com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.File>
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

addFile(PluginProtos.CodeGeneratorResponse.File value)

public PluginProtos.CodeGeneratorResponse.Builder addFile(PluginProtos.CodeGeneratorResponse.File value)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
value PluginProtos.CodeGeneratorResponse.File
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

addFile(PluginProtos.CodeGeneratorResponse.File.Builder builderForValue)

public PluginProtos.CodeGeneratorResponse.Builder addFile(PluginProtos.CodeGeneratorResponse.File.Builder builderForValue)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
builderForValue PluginProtos.CodeGeneratorResponse.File.Builder
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

addFile(int index, PluginProtos.CodeGeneratorResponse.File value)

public PluginProtos.CodeGeneratorResponse.Builder addFile(int index, PluginProtos.CodeGeneratorResponse.File value)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameters
Name Description
index int
value PluginProtos.CodeGeneratorResponse.File
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

addFile(int index, PluginProtos.CodeGeneratorResponse.File.Builder builderForValue)

public PluginProtos.CodeGeneratorResponse.Builder addFile(int index, PluginProtos.CodeGeneratorResponse.File.Builder builderForValue)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameters
Name Description
index int
builderForValue PluginProtos.CodeGeneratorResponse.File.Builder
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

addFileBuilder()

public PluginProtos.CodeGeneratorResponse.File.Builder addFileBuilder()

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Returns
Type Description
PluginProtos.CodeGeneratorResponse.File.Builder

addFileBuilder(int index)

public PluginProtos.CodeGeneratorResponse.File.Builder addFileBuilder(int index)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
index int
Returns
Type Description
PluginProtos.CodeGeneratorResponse.File.Builder

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public PluginProtos.CodeGeneratorResponse.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field Descriptors.FieldDescriptor
value Object
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

build()

public PluginProtos.CodeGeneratorResponse build()
Returns
Type Description
PluginProtos.CodeGeneratorResponse

buildPartial()

public PluginProtos.CodeGeneratorResponse buildPartial()
Returns
Type Description
PluginProtos.CodeGeneratorResponse

clear()

public PluginProtos.CodeGeneratorResponse.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
PluginProtos.CodeGeneratorResponse.Builder
Overrides

clearError()

public PluginProtos.CodeGeneratorResponse.Builder clearError()

Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code.

optional string error = 1;

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public PluginProtos.CodeGeneratorResponse.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field Descriptors.FieldDescriptor
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

clearFile()

public PluginProtos.CodeGeneratorResponse.Builder clearFile()

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public PluginProtos.CodeGeneratorResponse.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
PluginProtos.CodeGeneratorResponse.Builder
Overrides

clearSupportedFeatures()

public PluginProtos.CodeGeneratorResponse.Builder clearSupportedFeatures()

A bitmask of supported features that the code generator supports. This is a bitwise "or" of values from the Feature enum.

optional uint64 supported_features = 2;

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

This builder for chaining.

clone()

public PluginProtos.CodeGeneratorResponse.Builder clone()

Clones the Builder.

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

getDefaultInstanceForType()

public PluginProtos.CodeGeneratorResponse 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
PluginProtos.CodeGeneratorResponse

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
Overrides

getError()

public String getError()

Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code.

optional string error = 1;

Returns
Type Description
String

The error.

getErrorBytes()

public ByteString getErrorBytes()

Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code.

optional string error = 1;

Returns
Type Description
ByteString

The bytes for error.

getFile(int index)

public PluginProtos.CodeGeneratorResponse.File getFile(int index)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
index int
Returns
Type Description
PluginProtos.CodeGeneratorResponse.File

getFileBuilder(int index)

public PluginProtos.CodeGeneratorResponse.File.Builder getFileBuilder(int index)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
index int
Returns
Type Description
PluginProtos.CodeGeneratorResponse.File.Builder

getFileBuilderList()

public List<PluginProtos.CodeGeneratorResponse.File.Builder> getFileBuilderList()

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Returns
Type Description
List<Builder>

getFileCount()

public int getFileCount()

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Returns
Type Description
int

getFileList()

public List<PluginProtos.CodeGeneratorResponse.File> getFileList()

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Returns
Type Description
List<File>

getFileOrBuilder(int index)

public PluginProtos.CodeGeneratorResponse.FileOrBuilder getFileOrBuilder(int index)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
index int
Returns
Type Description
PluginProtos.CodeGeneratorResponse.FileOrBuilder

getFileOrBuilderList()

public List<? extends PluginProtos.CodeGeneratorResponse.FileOrBuilder> getFileOrBuilderList()

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Returns
Type Description
List<? extends com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.FileOrBuilder>

getSupportedFeatures()

public long getSupportedFeatures()

A bitmask of supported features that the code generator supports. This is a bitwise "or" of values from the Feature enum.

optional uint64 supported_features = 2;

Returns
Type Description
long

The supportedFeatures.

hasError()

public boolean hasError()

Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code.

optional string error = 1;

Returns
Type Description
boolean

Whether the error field is set.

hasSupportedFeatures()

public boolean hasSupportedFeatures()

A bitmask of supported features that the code generator supports. This is a bitwise "or" of values from the Feature enum.

optional uint64 supported_features = 2;

Returns
Type Description
boolean

Whether the supportedFeatures 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
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
Type Description
boolean
Overrides

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public PluginProtos.CodeGeneratorResponse.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
PluginProtos.CodeGeneratorResponse.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public PluginProtos.CodeGeneratorResponse.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
Name Description
other Message
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

mergeFrom(PluginProtos.CodeGeneratorResponse other)

public PluginProtos.CodeGeneratorResponse.Builder mergeFrom(PluginProtos.CodeGeneratorResponse other)
Parameter
Name Description
other PluginProtos.CodeGeneratorResponse
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final PluginProtos.CodeGeneratorResponse.Builder mergeUnknownFields(UnknownFieldSet unknownFields)

Merge some unknown fields into the UnknownFieldSet for this message.

Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

removeFile(int index)

public PluginProtos.CodeGeneratorResponse.Builder removeFile(int index)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameter
Name Description
index int
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

setError(String value)

public PluginProtos.CodeGeneratorResponse.Builder setError(String value)

Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code.

optional string error = 1;

Parameter
Name Description
value String

The error to set.

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

This builder for chaining.

setErrorBytes(ByteString value)

public PluginProtos.CodeGeneratorResponse.Builder setErrorBytes(ByteString value)

Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code.

optional string error = 1;

Parameter
Name Description
value ByteString

The bytes for error to set.

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public PluginProtos.CodeGeneratorResponse.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field Descriptors.FieldDescriptor
value Object
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

setFile(int index, PluginProtos.CodeGeneratorResponse.File value)

public PluginProtos.CodeGeneratorResponse.Builder setFile(int index, PluginProtos.CodeGeneratorResponse.File value)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameters
Name Description
index int
value PluginProtos.CodeGeneratorResponse.File
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

setFile(int index, PluginProtos.CodeGeneratorResponse.File.Builder builderForValue)

public PluginProtos.CodeGeneratorResponse.Builder setFile(int index, PluginProtos.CodeGeneratorResponse.File.Builder builderForValue)

repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;

Parameters
Name Description
index int
builderForValue PluginProtos.CodeGeneratorResponse.File.Builder
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

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

public PluginProtos.CodeGeneratorResponse.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field Descriptors.FieldDescriptor
index int
value Object
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides

setSupportedFeatures(long value)

public PluginProtos.CodeGeneratorResponse.Builder setSupportedFeatures(long value)

A bitmask of supported features that the code generator supports. This is a bitwise "or" of values from the Feature enum.

optional uint64 supported_features = 2;

Parameter
Name Description
value long

The supportedFeatures to set.

Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final PluginProtos.CodeGeneratorResponse.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
PluginProtos.CodeGeneratorResponse.Builder
Overrides