com.google.protobuf.FileOptions Maven / Gradle / Ivy
The newest version!
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: google/protobuf/descriptor.proto
package com.google.protobuf;
import com.squareup.wire.EnumAdapter;
import com.squareup.wire.FieldEncoding;
import com.squareup.wire.Message;
import com.squareup.wire.ProtoAdapter;
import com.squareup.wire.ProtoReader;
import com.squareup.wire.ProtoWriter;
import com.squareup.wire.ReverseProtoWriter;
import com.squareup.wire.Syntax;
import com.squareup.wire.WireEnum;
import com.squareup.wire.WireField;
import com.squareup.wire.internal.Internal;
import java.io.IOException;
import java.lang.Boolean;
import java.lang.Deprecated;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.List;
import okio.ByteString;
/**
* ===================================================================
* Options
* Each of the definitions above may have "options" attached. These are
* just annotations which may cause code to be generated slightly differently
* or may contain hints for code that manipulates protocol messages.
*
* Clients may define custom options as extensions of the *Options messages.
* These extensions may not yet be known at parsing time, so the parser cannot
* store the values in them. Instead it stores them in a field in the *Options
* message called uninterpreted_option. This field must have the same name
* across all *Options messages. We then use this field to populate the
* extensions when we build a descriptor, at which point all protos have been
* parsed and so all extensions are known.
*
* Extension numbers for custom options may be chosen as follows:
* * For options which will only be used within a single application or
* organization, or for experimental options, use field numbers 50000
* through 99999. It is up to you to ensure that you do not use the
* same number for multiple options.
* * For options which will be published and used publicly by multiple
* independent entities, e-mail [email protected]
* to reserve extension numbers. Simply provide your project name (e.g.
* Objective-C plugin) and your project website (if available) -- there's no
* need to explain how you intend to use them. Usually you only need one
* extension number. You can declare multiple options with only one extension
* number by putting them in a sub-message. See the Custom Options section of
* the docs for examples:
* https://developers.google.com/protocol-buffers/docs/proto#options
* If this turns out to be popular, a web service will be set up
* to automatically assign option numbers.
*/
public final class FileOptions extends Message {
public static final ProtoAdapter ADAPTER = new ProtoAdapter_FileOptions();
private static final long serialVersionUID = 0L;
public static final String DEFAULT_JAVA_PACKAGE = "";
public static final String DEFAULT_JAVA_OUTER_CLASSNAME = "";
public static final Boolean DEFAULT_JAVA_MULTIPLE_FILES = false;
public static final Boolean DEFAULT_JAVA_GENERATE_EQUALS_AND_HASH = false;
public static final Boolean DEFAULT_JAVA_STRING_CHECK_UTF8 = false;
public static final OptimizeMode DEFAULT_OPTIMIZE_FOR = OptimizeMode.SPEED;
public static final String DEFAULT_GO_PACKAGE = "";
public static final Boolean DEFAULT_CC_GENERIC_SERVICES = false;
public static final Boolean DEFAULT_JAVA_GENERIC_SERVICES = false;
public static final Boolean DEFAULT_PY_GENERIC_SERVICES = false;
public static final Boolean DEFAULT_PHP_GENERIC_SERVICES = false;
public static final Boolean DEFAULT_DEPRECATED = false;
public static final Boolean DEFAULT_CC_ENABLE_ARENAS = true;
public static final String DEFAULT_OBJC_CLASS_PREFIX = "";
public static final String DEFAULT_CSHARP_NAMESPACE = "";
public static final String DEFAULT_SWIFT_PREFIX = "";
public static final String DEFAULT_PHP_CLASS_PREFIX = "";
public static final String DEFAULT_PHP_NAMESPACE = "";
public static final String DEFAULT_PHP_METADATA_NAMESPACE = "";
public static final String DEFAULT_RUBY_PACKAGE = "";
public static final String DEFAULT_WIRE_PACKAGE = "";
/**
* Sets the Java package where classes generated from this .proto will be
* placed. By default, the proto package is used, but this is often
* inappropriate because proto packages do not normally start with backwards
* domain names.
*/
@WireField(
tag = 1,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String java_package;
/**
* Controls the name of the wrapper Java class generated for the .proto file.
* That class will always contain the .proto file's getDescriptor() method as
* well as any top-level extensions defined in the .proto file.
* If java_multiple_files is disabled, then all the other classes from the
* .proto file will be nested inside the single wrapper outer class.
*/
@WireField(
tag = 8,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String java_outer_classname;
/**
* If enabled, then the Java code generator will generate a separate .java
* file for each top-level message, enum, and service defined in the .proto
* file. Thus, these types will *not* be nested inside the wrapper class
* named by java_outer_classname. However, the wrapper class will still be
* generated to contain the file's getDescriptor() method as well as any
* top-level extensions defined in the file.
*/
@WireField(
tag = 10,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean java_multiple_files;
/**
* This option does nothing.
*/
@WireField(
tag = 20,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
@Deprecated
public final Boolean java_generate_equals_and_hash;
/**
* If set true, then the Java2 code generator will generate code that
* throws an exception whenever an attempt is made to assign a non-UTF-8
* byte sequence to a string field.
* Message reflection will do the same.
* However, an extension field still accepts non-UTF-8 byte sequences.
* This option has no effect on when used with the lite runtime.
*/
@WireField(
tag = 27,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean java_string_check_utf8;
@WireField(
tag = 9,
adapter = "com.google.protobuf.FileOptions$OptimizeMode#ADAPTER"
)
public final OptimizeMode optimize_for;
/**
* Sets the Go package where structs generated from this .proto will be
* placed. If omitted, the Go package will be derived from the following:
* - The basename of the package import path, if provided.
* - Otherwise, the package statement in the .proto file, if present.
* - Otherwise, the basename of the .proto file, without extension.
*/
@WireField(
tag = 11,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String go_package;
/**
* Should generic services be generated in each language? "Generic" services
* are not specific to any particular RPC system. They are generated by the
* main code generators in each language (without additional plugins).
* Generic services were the only kind of service generation supported by
* early versions of google.protobuf.
*
* Generic services are now considered deprecated in favor of using plugins
* that generate code specific to your particular RPC system. Therefore,
* these default to false. Old code which depends on generic services should
* explicitly set them to true.
*/
@WireField(
tag = 16,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean cc_generic_services;
@WireField(
tag = 17,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean java_generic_services;
@WireField(
tag = 18,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean py_generic_services;
@WireField(
tag = 42,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean php_generic_services;
/**
* Is this file deprecated?
* Depending on the target platform, this can emit Deprecated annotations
* for everything in the file, or it will be completely ignored; in the very
* least, this is a formalization for deprecating files.
*/
@WireField(
tag = 23,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean deprecated;
/**
* Enables the use of arenas for the proto messages in this file. This applies
* only to generated classes for C++.
*/
@WireField(
tag = 31,
adapter = "com.squareup.wire.ProtoAdapter#BOOL"
)
public final Boolean cc_enable_arenas;
/**
* Sets the objective c class prefix which is prepended to all objective c
* generated classes from this .proto. There is no default.
*/
@WireField(
tag = 36,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String objc_class_prefix;
/**
* Namespace for generated classes; defaults to the package.
*/
@WireField(
tag = 37,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String csharp_namespace;
/**
* By default Swift generators will take the proto package and CamelCase it
* replacing '.' with underscore and use that to prefix the types/symbols
* defined. When this options is provided, they will use this value instead
* to prefix the types/symbols defined.
*/
@WireField(
tag = 39,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String swift_prefix;
/**
* Sets the php class prefix which is prepended to all php generated classes
* from this .proto. Default is empty.
*/
@WireField(
tag = 40,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String php_class_prefix;
/**
* Use this option to change the namespace of php generated classes. Default
* is empty. When this option is empty, the package name will be used for
* determining the namespace.
*/
@WireField(
tag = 41,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String php_namespace;
/**
* Use this option to change the namespace of php generated metadata classes.
* Default is empty. When this option is empty, the proto file name will be
* used for determining the namespace.
*/
@WireField(
tag = 44,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String php_metadata_namespace;
/**
* Use this option to change the package of ruby generated classes. Default
* is empty. When this option is not set, the package name will be used for
* determining the ruby package.
*/
@WireField(
tag = 45,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String ruby_package;
/**
* Any features defined in the specific edition.
*/
@WireField(
tag = 50,
adapter = "com.google.protobuf.FeatureSet#ADAPTER"
)
public final FeatureSet features;
/**
* The parser stores options it doesn't recognize here.
* See the documentation for the "Options" section above.
*/
@WireField(
tag = 999,
adapter = "com.google.protobuf.UninterpretedOption#ADAPTER",
label = WireField.Label.REPEATED
)
public final List uninterpreted_option;
/**
* Sets the JVM package where classes generated from this .proto will be placed. `wire_package`
* takes precedence over `java_package` which itself takes precedence over the proto package.
* This option can be used to avoid collision when generating from both Wire and Protoc.
* Extension source: wire/extensions.proto
*/
@WireField(
tag = 1087,
adapter = "com.squareup.wire.ProtoAdapter#STRING"
)
public final String wire_package;
public FileOptions(Builder builder, ByteString unknownFields) {
super(ADAPTER, unknownFields);
this.java_package = builder.java_package;
this.java_outer_classname = builder.java_outer_classname;
this.java_multiple_files = builder.java_multiple_files;
this.java_generate_equals_and_hash = builder.java_generate_equals_and_hash;
this.java_string_check_utf8 = builder.java_string_check_utf8;
this.optimize_for = builder.optimize_for;
this.go_package = builder.go_package;
this.cc_generic_services = builder.cc_generic_services;
this.java_generic_services = builder.java_generic_services;
this.py_generic_services = builder.py_generic_services;
this.php_generic_services = builder.php_generic_services;
this.deprecated = builder.deprecated;
this.cc_enable_arenas = builder.cc_enable_arenas;
this.objc_class_prefix = builder.objc_class_prefix;
this.csharp_namespace = builder.csharp_namespace;
this.swift_prefix = builder.swift_prefix;
this.php_class_prefix = builder.php_class_prefix;
this.php_namespace = builder.php_namespace;
this.php_metadata_namespace = builder.php_metadata_namespace;
this.ruby_package = builder.ruby_package;
this.features = builder.features;
this.uninterpreted_option = Internal.immutableCopyOf("uninterpreted_option", builder.uninterpreted_option);
this.wire_package = builder.wire_package;
}
@Override
public Builder newBuilder() {
Builder builder = new Builder();
builder.java_package = java_package;
builder.java_outer_classname = java_outer_classname;
builder.java_multiple_files = java_multiple_files;
builder.java_generate_equals_and_hash = java_generate_equals_and_hash;
builder.java_string_check_utf8 = java_string_check_utf8;
builder.optimize_for = optimize_for;
builder.go_package = go_package;
builder.cc_generic_services = cc_generic_services;
builder.java_generic_services = java_generic_services;
builder.py_generic_services = py_generic_services;
builder.php_generic_services = php_generic_services;
builder.deprecated = deprecated;
builder.cc_enable_arenas = cc_enable_arenas;
builder.objc_class_prefix = objc_class_prefix;
builder.csharp_namespace = csharp_namespace;
builder.swift_prefix = swift_prefix;
builder.php_class_prefix = php_class_prefix;
builder.php_namespace = php_namespace;
builder.php_metadata_namespace = php_metadata_namespace;
builder.ruby_package = ruby_package;
builder.features = features;
builder.uninterpreted_option = Internal.copyOf(uninterpreted_option);
builder.wire_package = wire_package;
builder.addUnknownFields(unknownFields());
return builder;
}
@Override
public boolean equals(Object other) {
if (other == this) return true;
if (!(other instanceof FileOptions)) return false;
FileOptions o = (FileOptions) other;
return unknownFields().equals(o.unknownFields())
&& Internal.equals(java_package, o.java_package)
&& Internal.equals(java_outer_classname, o.java_outer_classname)
&& Internal.equals(java_multiple_files, o.java_multiple_files)
&& Internal.equals(java_generate_equals_and_hash, o.java_generate_equals_and_hash)
&& Internal.equals(java_string_check_utf8, o.java_string_check_utf8)
&& Internal.equals(optimize_for, o.optimize_for)
&& Internal.equals(go_package, o.go_package)
&& Internal.equals(cc_generic_services, o.cc_generic_services)
&& Internal.equals(java_generic_services, o.java_generic_services)
&& Internal.equals(py_generic_services, o.py_generic_services)
&& Internal.equals(php_generic_services, o.php_generic_services)
&& Internal.equals(deprecated, o.deprecated)
&& Internal.equals(cc_enable_arenas, o.cc_enable_arenas)
&& Internal.equals(objc_class_prefix, o.objc_class_prefix)
&& Internal.equals(csharp_namespace, o.csharp_namespace)
&& Internal.equals(swift_prefix, o.swift_prefix)
&& Internal.equals(php_class_prefix, o.php_class_prefix)
&& Internal.equals(php_namespace, o.php_namespace)
&& Internal.equals(php_metadata_namespace, o.php_metadata_namespace)
&& Internal.equals(ruby_package, o.ruby_package)
&& Internal.equals(features, o.features)
&& uninterpreted_option.equals(o.uninterpreted_option)
&& Internal.equals(wire_package, o.wire_package);
}
@Override
public int hashCode() {
int result = super.hashCode;
if (result == 0) {
result = unknownFields().hashCode();
result = result * 37 + (java_package != null ? java_package.hashCode() : 0);
result = result * 37 + (java_outer_classname != null ? java_outer_classname.hashCode() : 0);
result = result * 37 + (java_multiple_files != null ? java_multiple_files.hashCode() : 0);
result = result * 37 + (java_generate_equals_and_hash != null ? java_generate_equals_and_hash.hashCode() : 0);
result = result * 37 + (java_string_check_utf8 != null ? java_string_check_utf8.hashCode() : 0);
result = result * 37 + (optimize_for != null ? optimize_for.hashCode() : 0);
result = result * 37 + (go_package != null ? go_package.hashCode() : 0);
result = result * 37 + (cc_generic_services != null ? cc_generic_services.hashCode() : 0);
result = result * 37 + (java_generic_services != null ? java_generic_services.hashCode() : 0);
result = result * 37 + (py_generic_services != null ? py_generic_services.hashCode() : 0);
result = result * 37 + (php_generic_services != null ? php_generic_services.hashCode() : 0);
result = result * 37 + (deprecated != null ? deprecated.hashCode() : 0);
result = result * 37 + (cc_enable_arenas != null ? cc_enable_arenas.hashCode() : 0);
result = result * 37 + (objc_class_prefix != null ? objc_class_prefix.hashCode() : 0);
result = result * 37 + (csharp_namespace != null ? csharp_namespace.hashCode() : 0);
result = result * 37 + (swift_prefix != null ? swift_prefix.hashCode() : 0);
result = result * 37 + (php_class_prefix != null ? php_class_prefix.hashCode() : 0);
result = result * 37 + (php_namespace != null ? php_namespace.hashCode() : 0);
result = result * 37 + (php_metadata_namespace != null ? php_metadata_namespace.hashCode() : 0);
result = result * 37 + (ruby_package != null ? ruby_package.hashCode() : 0);
result = result * 37 + (features != null ? features.hashCode() : 0);
result = result * 37 + uninterpreted_option.hashCode();
result = result * 37 + (wire_package != null ? wire_package.hashCode() : 0);
super.hashCode = result;
}
return result;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
if (java_package != null) builder.append(", java_package=").append(Internal.sanitize(java_package));
if (java_outer_classname != null) builder.append(", java_outer_classname=").append(Internal.sanitize(java_outer_classname));
if (java_multiple_files != null) builder.append(", java_multiple_files=").append(java_multiple_files);
if (java_generate_equals_and_hash != null) builder.append(", java_generate_equals_and_hash=").append(java_generate_equals_and_hash);
if (java_string_check_utf8 != null) builder.append(", java_string_check_utf8=").append(java_string_check_utf8);
if (optimize_for != null) builder.append(", optimize_for=").append(optimize_for);
if (go_package != null) builder.append(", go_package=").append(Internal.sanitize(go_package));
if (cc_generic_services != null) builder.append(", cc_generic_services=").append(cc_generic_services);
if (java_generic_services != null) builder.append(", java_generic_services=").append(java_generic_services);
if (py_generic_services != null) builder.append(", py_generic_services=").append(py_generic_services);
if (php_generic_services != null) builder.append(", php_generic_services=").append(php_generic_services);
if (deprecated != null) builder.append(", deprecated=").append(deprecated);
if (cc_enable_arenas != null) builder.append(", cc_enable_arenas=").append(cc_enable_arenas);
if (objc_class_prefix != null) builder.append(", objc_class_prefix=").append(Internal.sanitize(objc_class_prefix));
if (csharp_namespace != null) builder.append(", csharp_namespace=").append(Internal.sanitize(csharp_namespace));
if (swift_prefix != null) builder.append(", swift_prefix=").append(Internal.sanitize(swift_prefix));
if (php_class_prefix != null) builder.append(", php_class_prefix=").append(Internal.sanitize(php_class_prefix));
if (php_namespace != null) builder.append(", php_namespace=").append(Internal.sanitize(php_namespace));
if (php_metadata_namespace != null) builder.append(", php_metadata_namespace=").append(Internal.sanitize(php_metadata_namespace));
if (ruby_package != null) builder.append(", ruby_package=").append(Internal.sanitize(ruby_package));
if (features != null) builder.append(", features=").append(features);
if (!uninterpreted_option.isEmpty()) builder.append(", uninterpreted_option=").append(uninterpreted_option);
if (wire_package != null) builder.append(", wire_package=").append(Internal.sanitize(wire_package));
return builder.replace(0, 2, "FileOptions{").append('}').toString();
}
public static final class Builder extends Message.Builder {
public String java_package;
public String java_outer_classname;
public Boolean java_multiple_files;
public Boolean java_generate_equals_and_hash;
public Boolean java_string_check_utf8;
public OptimizeMode optimize_for;
public String go_package;
public Boolean cc_generic_services;
public Boolean java_generic_services;
public Boolean py_generic_services;
public Boolean php_generic_services;
public Boolean deprecated;
public Boolean cc_enable_arenas;
public String objc_class_prefix;
public String csharp_namespace;
public String swift_prefix;
public String php_class_prefix;
public String php_namespace;
public String php_metadata_namespace;
public String ruby_package;
public FeatureSet features;
public List uninterpreted_option;
public String wire_package;
public Builder() {
uninterpreted_option = Internal.newMutableList();
}
/**
* Sets the Java package where classes generated from this .proto will be
* placed. By default, the proto package is used, but this is often
* inappropriate because proto packages do not normally start with backwards
* domain names.
*/
public Builder java_package(String java_package) {
this.java_package = java_package;
return this;
}
/**
* Controls the name of the wrapper Java class generated for the .proto file.
* That class will always contain the .proto file's getDescriptor() method as
* well as any top-level extensions defined in the .proto file.
* If java_multiple_files is disabled, then all the other classes from the
* .proto file will be nested inside the single wrapper outer class.
*/
public Builder java_outer_classname(String java_outer_classname) {
this.java_outer_classname = java_outer_classname;
return this;
}
/**
* If enabled, then the Java code generator will generate a separate .java
* file for each top-level message, enum, and service defined in the .proto
* file. Thus, these types will *not* be nested inside the wrapper class
* named by java_outer_classname. However, the wrapper class will still be
* generated to contain the file's getDescriptor() method as well as any
* top-level extensions defined in the file.
*/
public Builder java_multiple_files(Boolean java_multiple_files) {
this.java_multiple_files = java_multiple_files;
return this;
}
/**
* This option does nothing.
*/
@Deprecated
public Builder java_generate_equals_and_hash(Boolean java_generate_equals_and_hash) {
this.java_generate_equals_and_hash = java_generate_equals_and_hash;
return this;
}
/**
* If set true, then the Java2 code generator will generate code that
* throws an exception whenever an attempt is made to assign a non-UTF-8
* byte sequence to a string field.
* Message reflection will do the same.
* However, an extension field still accepts non-UTF-8 byte sequences.
* This option has no effect on when used with the lite runtime.
*/
public Builder java_string_check_utf8(Boolean java_string_check_utf8) {
this.java_string_check_utf8 = java_string_check_utf8;
return this;
}
public Builder optimize_for(OptimizeMode optimize_for) {
this.optimize_for = optimize_for;
return this;
}
/**
* Sets the Go package where structs generated from this .proto will be
* placed. If omitted, the Go package will be derived from the following:
* - The basename of the package import path, if provided.
* - Otherwise, the package statement in the .proto file, if present.
* - Otherwise, the basename of the .proto file, without extension.
*/
public Builder go_package(String go_package) {
this.go_package = go_package;
return this;
}
/**
* Should generic services be generated in each language? "Generic" services
* are not specific to any particular RPC system. They are generated by the
* main code generators in each language (without additional plugins).
* Generic services were the only kind of service generation supported by
* early versions of google.protobuf.
*
* Generic services are now considered deprecated in favor of using plugins
* that generate code specific to your particular RPC system. Therefore,
* these default to false. Old code which depends on generic services should
* explicitly set them to true.
*/
public Builder cc_generic_services(Boolean cc_generic_services) {
this.cc_generic_services = cc_generic_services;
return this;
}
public Builder java_generic_services(Boolean java_generic_services) {
this.java_generic_services = java_generic_services;
return this;
}
public Builder py_generic_services(Boolean py_generic_services) {
this.py_generic_services = py_generic_services;
return this;
}
public Builder php_generic_services(Boolean php_generic_services) {
this.php_generic_services = php_generic_services;
return this;
}
/**
* Is this file deprecated?
* Depending on the target platform, this can emit Deprecated annotations
* for everything in the file, or it will be completely ignored; in the very
* least, this is a formalization for deprecating files.
*/
public Builder deprecated(Boolean deprecated) {
this.deprecated = deprecated;
return this;
}
/**
* Enables the use of arenas for the proto messages in this file. This applies
* only to generated classes for C++.
*/
public Builder cc_enable_arenas(Boolean cc_enable_arenas) {
this.cc_enable_arenas = cc_enable_arenas;
return this;
}
/**
* Sets the objective c class prefix which is prepended to all objective c
* generated classes from this .proto. There is no default.
*/
public Builder objc_class_prefix(String objc_class_prefix) {
this.objc_class_prefix = objc_class_prefix;
return this;
}
/**
* Namespace for generated classes; defaults to the package.
*/
public Builder csharp_namespace(String csharp_namespace) {
this.csharp_namespace = csharp_namespace;
return this;
}
/**
* By default Swift generators will take the proto package and CamelCase it
* replacing '.' with underscore and use that to prefix the types/symbols
* defined. When this options is provided, they will use this value instead
* to prefix the types/symbols defined.
*/
public Builder swift_prefix(String swift_prefix) {
this.swift_prefix = swift_prefix;
return this;
}
/**
* Sets the php class prefix which is prepended to all php generated classes
* from this .proto. Default is empty.
*/
public Builder php_class_prefix(String php_class_prefix) {
this.php_class_prefix = php_class_prefix;
return this;
}
/**
* Use this option to change the namespace of php generated classes. Default
* is empty. When this option is empty, the package name will be used for
* determining the namespace.
*/
public Builder php_namespace(String php_namespace) {
this.php_namespace = php_namespace;
return this;
}
/**
* Use this option to change the namespace of php generated metadata classes.
* Default is empty. When this option is empty, the proto file name will be
* used for determining the namespace.
*/
public Builder php_metadata_namespace(String php_metadata_namespace) {
this.php_metadata_namespace = php_metadata_namespace;
return this;
}
/**
* Use this option to change the package of ruby generated classes. Default
* is empty. When this option is not set, the package name will be used for
* determining the ruby package.
*/
public Builder ruby_package(String ruby_package) {
this.ruby_package = ruby_package;
return this;
}
/**
* Any features defined in the specific edition.
*/
public Builder features(FeatureSet features) {
this.features = features;
return this;
}
/**
* The parser stores options it doesn't recognize here.
* See the documentation for the "Options" section above.
*/
public Builder uninterpreted_option(List uninterpreted_option) {
Internal.checkElementsNotNull(uninterpreted_option);
this.uninterpreted_option = uninterpreted_option;
return this;
}
/**
* Sets the JVM package where classes generated from this .proto will be placed. `wire_package`
* takes precedence over `java_package` which itself takes precedence over the proto package.
* This option can be used to avoid collision when generating from both Wire and Protoc.
*/
public Builder wire_package(String wire_package) {
this.wire_package = wire_package;
return this;
}
@Override
public FileOptions build() {
return new FileOptions(this, super.buildUnknownFields());
}
}
/**
* Generated classes can be optimized for speed or code size.
*/
public enum OptimizeMode implements WireEnum {
/**
* Generate complete code for parsing, serialization,
*/
SPEED(1),
/**
* etc.
* Use ReflectionOps to implement these methods.
*/
CODE_SIZE(2),
/**
* Generate code using MessageLite and the lite runtime.
*/
LITE_RUNTIME(3);
public static final ProtoAdapter ADAPTER = new ProtoAdapter_OptimizeMode();
private final int value;
OptimizeMode(int value) {
this.value = value;
}
/**
* Return the constant for {@code value} or null.
*/
public static OptimizeMode fromValue(int value) {
switch (value) {
case 1: return SPEED;
case 2: return CODE_SIZE;
case 3: return LITE_RUNTIME;
default: return null;
}
}
@Override
public int getValue() {
return value;
}
private static final class ProtoAdapter_OptimizeMode extends EnumAdapter {
ProtoAdapter_OptimizeMode() {
super(OptimizeMode.class, Syntax.PROTO_2, null);
}
@Override
protected OptimizeMode fromValue(int value) {
return OptimizeMode.fromValue(value);
}
}
}
private static final class ProtoAdapter_FileOptions extends ProtoAdapter {
public ProtoAdapter_FileOptions() {
super(FieldEncoding.LENGTH_DELIMITED, FileOptions.class, "type.googleapis.com/google.protobuf.FileOptions", Syntax.PROTO_2, null, "google/protobuf/descriptor.proto");
}
@Override
public int encodedSize(FileOptions value) {
int result = 0;
result += ProtoAdapter.STRING.encodedSizeWithTag(1, value.java_package);
result += ProtoAdapter.STRING.encodedSizeWithTag(8, value.java_outer_classname);
result += ProtoAdapter.BOOL.encodedSizeWithTag(10, value.java_multiple_files);
result += ProtoAdapter.BOOL.encodedSizeWithTag(20, value.java_generate_equals_and_hash);
result += ProtoAdapter.BOOL.encodedSizeWithTag(27, value.java_string_check_utf8);
result += OptimizeMode.ADAPTER.encodedSizeWithTag(9, value.optimize_for);
result += ProtoAdapter.STRING.encodedSizeWithTag(11, value.go_package);
result += ProtoAdapter.BOOL.encodedSizeWithTag(16, value.cc_generic_services);
result += ProtoAdapter.BOOL.encodedSizeWithTag(17, value.java_generic_services);
result += ProtoAdapter.BOOL.encodedSizeWithTag(18, value.py_generic_services);
result += ProtoAdapter.BOOL.encodedSizeWithTag(42, value.php_generic_services);
result += ProtoAdapter.BOOL.encodedSizeWithTag(23, value.deprecated);
result += ProtoAdapter.BOOL.encodedSizeWithTag(31, value.cc_enable_arenas);
result += ProtoAdapter.STRING.encodedSizeWithTag(36, value.objc_class_prefix);
result += ProtoAdapter.STRING.encodedSizeWithTag(37, value.csharp_namespace);
result += ProtoAdapter.STRING.encodedSizeWithTag(39, value.swift_prefix);
result += ProtoAdapter.STRING.encodedSizeWithTag(40, value.php_class_prefix);
result += ProtoAdapter.STRING.encodedSizeWithTag(41, value.php_namespace);
result += ProtoAdapter.STRING.encodedSizeWithTag(44, value.php_metadata_namespace);
result += ProtoAdapter.STRING.encodedSizeWithTag(45, value.ruby_package);
result += FeatureSet.ADAPTER.encodedSizeWithTag(50, value.features);
result += UninterpretedOption.ADAPTER.asRepeated().encodedSizeWithTag(999, value.uninterpreted_option);
result += ProtoAdapter.STRING.encodedSizeWithTag(1087, value.wire_package);
result += value.unknownFields().size();
return result;
}
@Override
public void encode(ProtoWriter writer, FileOptions value) throws IOException {
ProtoAdapter.STRING.encodeWithTag(writer, 1, value.java_package);
ProtoAdapter.STRING.encodeWithTag(writer, 8, value.java_outer_classname);
ProtoAdapter.BOOL.encodeWithTag(writer, 10, value.java_multiple_files);
ProtoAdapter.BOOL.encodeWithTag(writer, 20, value.java_generate_equals_and_hash);
ProtoAdapter.BOOL.encodeWithTag(writer, 27, value.java_string_check_utf8);
OptimizeMode.ADAPTER.encodeWithTag(writer, 9, value.optimize_for);
ProtoAdapter.STRING.encodeWithTag(writer, 11, value.go_package);
ProtoAdapter.BOOL.encodeWithTag(writer, 16, value.cc_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 17, value.java_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 18, value.py_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 42, value.php_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 23, value.deprecated);
ProtoAdapter.BOOL.encodeWithTag(writer, 31, value.cc_enable_arenas);
ProtoAdapter.STRING.encodeWithTag(writer, 36, value.objc_class_prefix);
ProtoAdapter.STRING.encodeWithTag(writer, 37, value.csharp_namespace);
ProtoAdapter.STRING.encodeWithTag(writer, 39, value.swift_prefix);
ProtoAdapter.STRING.encodeWithTag(writer, 40, value.php_class_prefix);
ProtoAdapter.STRING.encodeWithTag(writer, 41, value.php_namespace);
ProtoAdapter.STRING.encodeWithTag(writer, 44, value.php_metadata_namespace);
ProtoAdapter.STRING.encodeWithTag(writer, 45, value.ruby_package);
FeatureSet.ADAPTER.encodeWithTag(writer, 50, value.features);
UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
ProtoAdapter.STRING.encodeWithTag(writer, 1087, value.wire_package);
writer.writeBytes(value.unknownFields());
}
@Override
public void encode(ReverseProtoWriter writer, FileOptions value) throws IOException {
writer.writeBytes(value.unknownFields());
ProtoAdapter.STRING.encodeWithTag(writer, 1087, value.wire_package);
UninterpretedOption.ADAPTER.asRepeated().encodeWithTag(writer, 999, value.uninterpreted_option);
FeatureSet.ADAPTER.encodeWithTag(writer, 50, value.features);
ProtoAdapter.STRING.encodeWithTag(writer, 45, value.ruby_package);
ProtoAdapter.STRING.encodeWithTag(writer, 44, value.php_metadata_namespace);
ProtoAdapter.STRING.encodeWithTag(writer, 41, value.php_namespace);
ProtoAdapter.STRING.encodeWithTag(writer, 40, value.php_class_prefix);
ProtoAdapter.STRING.encodeWithTag(writer, 39, value.swift_prefix);
ProtoAdapter.STRING.encodeWithTag(writer, 37, value.csharp_namespace);
ProtoAdapter.STRING.encodeWithTag(writer, 36, value.objc_class_prefix);
ProtoAdapter.BOOL.encodeWithTag(writer, 31, value.cc_enable_arenas);
ProtoAdapter.BOOL.encodeWithTag(writer, 23, value.deprecated);
ProtoAdapter.BOOL.encodeWithTag(writer, 42, value.php_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 18, value.py_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 17, value.java_generic_services);
ProtoAdapter.BOOL.encodeWithTag(writer, 16, value.cc_generic_services);
ProtoAdapter.STRING.encodeWithTag(writer, 11, value.go_package);
OptimizeMode.ADAPTER.encodeWithTag(writer, 9, value.optimize_for);
ProtoAdapter.BOOL.encodeWithTag(writer, 27, value.java_string_check_utf8);
ProtoAdapter.BOOL.encodeWithTag(writer, 20, value.java_generate_equals_and_hash);
ProtoAdapter.BOOL.encodeWithTag(writer, 10, value.java_multiple_files);
ProtoAdapter.STRING.encodeWithTag(writer, 8, value.java_outer_classname);
ProtoAdapter.STRING.encodeWithTag(writer, 1, value.java_package);
}
@Override
public FileOptions decode(ProtoReader reader) throws IOException {
Builder builder = new Builder();
long token = reader.beginMessage();
for (int tag; (tag = reader.nextTag()) != -1;) {
switch (tag) {
case 1: builder.java_package(ProtoAdapter.STRING.decode(reader)); break;
case 8: builder.java_outer_classname(ProtoAdapter.STRING.decode(reader)); break;
case 9: {
try {
builder.optimize_for(OptimizeMode.ADAPTER.decode(reader));
} catch (ProtoAdapter.EnumConstantNotFoundException e) {
builder.addUnknownField(tag, FieldEncoding.VARINT, (long) e.value);
}
break;
}
case 10: builder.java_multiple_files(ProtoAdapter.BOOL.decode(reader)); break;
case 11: builder.go_package(ProtoAdapter.STRING.decode(reader)); break;
case 16: builder.cc_generic_services(ProtoAdapter.BOOL.decode(reader)); break;
case 17: builder.java_generic_services(ProtoAdapter.BOOL.decode(reader)); break;
case 18: builder.py_generic_services(ProtoAdapter.BOOL.decode(reader)); break;
case 20: builder.java_generate_equals_and_hash(ProtoAdapter.BOOL.decode(reader)); break;
case 23: builder.deprecated(ProtoAdapter.BOOL.decode(reader)); break;
case 27: builder.java_string_check_utf8(ProtoAdapter.BOOL.decode(reader)); break;
case 31: builder.cc_enable_arenas(ProtoAdapter.BOOL.decode(reader)); break;
case 36: builder.objc_class_prefix(ProtoAdapter.STRING.decode(reader)); break;
case 37: builder.csharp_namespace(ProtoAdapter.STRING.decode(reader)); break;
case 39: builder.swift_prefix(ProtoAdapter.STRING.decode(reader)); break;
case 40: builder.php_class_prefix(ProtoAdapter.STRING.decode(reader)); break;
case 41: builder.php_namespace(ProtoAdapter.STRING.decode(reader)); break;
case 42: builder.php_generic_services(ProtoAdapter.BOOL.decode(reader)); break;
case 44: builder.php_metadata_namespace(ProtoAdapter.STRING.decode(reader)); break;
case 45: builder.ruby_package(ProtoAdapter.STRING.decode(reader)); break;
case 50: builder.features(FeatureSet.ADAPTER.decode(reader)); break;
case 999: builder.uninterpreted_option.add(UninterpretedOption.ADAPTER.decode(reader)); break;
case 1087: builder.wire_package(ProtoAdapter.STRING.decode(reader)); break;
default: {
reader.readUnknownField(tag);
}
}
}
builder.addUnknownFields(reader.endMessageAndGetUnknownFields(token));
return builder.build();
}
@Override
public FileOptions redact(FileOptions value) {
Builder builder = value.newBuilder();
if (builder.features != null) builder.features = FeatureSet.ADAPTER.redact(builder.features);
Internal.redactElements(builder.uninterpreted_option, UninterpretedOption.ADAPTER);
builder.clearUnknownFields();
return builder.build();
}
}
}