java_features_pb.py 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. # Copyright (c) 2025-2026 Buf Technologies, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Generated from google/protobuf/java_features.proto. DO NOT EDIT.
  15. # Generated by protoc-gen-py v0.1.1 with parameter "no_fmt_off".
  16. # ruff: noqa: PGH004
  17. # ruff: noqa
  18. from __future__ import annotations
  19. from typing import Final, Literal, NoReturn, TYPE_CHECKING, TypeAlias
  20. from protobuf import Enum, Extension, Message
  21. from protobuf._codegen import file_desc
  22. from . import descriptor_pb
  23. from .descriptor_pb import FeatureSet
  24. if TYPE_CHECKING:
  25. from protobuf import DescFile
  26. _JavaFeaturesFields: TypeAlias = Literal[
  27. "legacy_closed_enum",
  28. "utf8_validation",
  29. "large_enum",
  30. "use_old_outer_classname_default",
  31. "nest_in_file_class",
  32. ]
  33. class JavaFeatures(Message[_JavaFeaturesFields]):
  34. """
  35. ```proto
  36. message pb.JavaFeatures
  37. ```
  38. Attributes:
  39. legacy_closed_enum:
  40. Whether or not to treat an enum field as closed. This option is only
  41. applicable to enum fields, and will be removed in the future. It is
  42. consistent with the legacy behavior of using proto3 enum types for proto2
  43. fields.
  44. ```proto
  45. optional bool legacy_closed_enum = 1;
  46. ```
  47. utf8_validation:
  48. ```proto
  49. optional pb.JavaFeatures.Utf8Validation utf8_validation = 2;
  50. ```
  51. large_enum:
  52. Allows creation of large Java enums, extending beyond the standard
  53. constant limits imposed by the Java language.
  54. ```proto
  55. optional bool large_enum = 3;
  56. ```
  57. use_old_outer_classname_default:
  58. Whether to use the old default outer class name scheme, or the new feature
  59. which adds a "Proto" suffix to the outer class name.
  60. Users will not be able to set this option, because we removed it in the
  61. same edition that it was introduced. But we use it to determine which
  62. naming scheme to use for outer class name defaults.
  63. ```proto
  64. optional bool use_old_outer_classname_default = 4;
  65. ```
  66. nest_in_file_class:
  67. Whether to nest the generated class in the generated file class. This is
  68. only applicable to *top-level* messages, enums, and services.
  69. ```proto
  70. optional pb.JavaFeatures.NestInFileClassFeature.NestInFileClass nest_in_file_class = 5;
  71. ```
  72. """
  73. __slots__ = (
  74. "legacy_closed_enum",
  75. "utf8_validation",
  76. "large_enum",
  77. "use_old_outer_classname_default",
  78. "nest_in_file_class",
  79. )
  80. if TYPE_CHECKING:
  81. def __init__(
  82. self,
  83. *,
  84. legacy_closed_enum: bool | None = None,
  85. utf8_validation: JavaFeatures.Utf8Validation | None = None,
  86. large_enum: bool | None = None,
  87. use_old_outer_classname_default: bool | None = None,
  88. nest_in_file_class: JavaFeatures.NestInFileClassFeature.NestInFileClass
  89. | None = None,
  90. ) -> None:
  91. pass
  92. legacy_closed_enum: bool
  93. utf8_validation: JavaFeatures.Utf8Validation
  94. large_enum: bool
  95. use_old_outer_classname_default: bool
  96. nest_in_file_class: JavaFeatures.NestInFileClassFeature.NestInFileClass
  97. _NestInFileClassFeatureFields: TypeAlias = NoReturn
  98. class NestInFileClassFeature(Message[_NestInFileClassFeatureFields]):
  99. """
  100. ```proto
  101. message pb.JavaFeatures.NestInFileClassFeature
  102. ```
  103. """
  104. __slots__ = ()
  105. if TYPE_CHECKING:
  106. def __init__(self) -> None:
  107. pass
  108. class NestInFileClass(Enum):
  109. """
  110. ```proto
  111. enum pb.JavaFeatures.NestInFileClassFeature.NestInFileClass
  112. ```
  113. Attributes:
  114. UNKNOWN:
  115. Invalid default, which should never be used.
  116. ```proto
  117. NEST_IN_FILE_CLASS_UNKNOWN = 0
  118. ```
  119. NO:
  120. Do not nest the generated class in the file class.
  121. ```proto
  122. NO = 1
  123. ```
  124. YES:
  125. Nest the generated class in the file class.
  126. ```proto
  127. YES = 2
  128. ```
  129. LEGACY:
  130. Fall back to the `java_multiple_files` option. Users won't be able to
  131. set this option.
  132. ```proto
  133. LEGACY = 3
  134. ```
  135. """
  136. UNKNOWN = 0
  137. NO = 1
  138. YES = 2
  139. LEGACY = 3
  140. class Utf8Validation(Enum):
  141. """
  142. The UTF8 validation strategy to use.
  143. ```proto
  144. enum pb.JavaFeatures.Utf8Validation
  145. ```
  146. Attributes:
  147. UNKNOWN:
  148. Invalid default, which should never be used.
  149. ```proto
  150. UTF8_VALIDATION_UNKNOWN = 0
  151. ```
  152. DEFAULT:
  153. Respect the UTF8 validation behavior specified by the global
  154. utf8_validation feature.
  155. ```proto
  156. DEFAULT = 1
  157. ```
  158. VERIFY:
  159. Verifies UTF8 validity overriding the global utf8_validation
  160. feature. This represents the legacy java_string_check_utf8 option.
  161. ```proto
  162. VERIFY = 2
  163. ```
  164. """
  165. UNKNOWN = 0
  166. DEFAULT = 1
  167. VERIFY = 2
  168. ext_java: Final[Extension[FeatureSet, JavaFeatures]] = Extension()
  169. """
  170. ```proto
  171. extend google.protobuf.FeatureSet { optional pb.JavaFeatures java = 1001 [json_name = "[pb.java]"] }
  172. ```
  173. """
  174. _DESC = file_desc(
  175. b'\n#google/protobuf/java_features.proto\x12\x02pb\x1a google/protobuf/descriptor.proto"\xdf\x08\n\x0cJavaFeatures\x12\x90\x02\n\x12legacy_closed_enum\x18\x01 \x01(\x08R\x10legacyClosedEnumB\xe1\x01\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\t\x18\x84\x07\x12\x04true\xa2\x01\n\x18\xe7\x07\x12\x05false\xb2\x01\xbb\x01\x08\xe8\x07\x10\xe8\x07\x1a\xb2\x01The legacy closed enum behavior in Java is deprecated and is scheduled to be removed in edition 2025. See http://protobuf.dev/programming-guides/enum/#java for more information.\x12\xaf\x02\n\x0futf8_validation\x18\x02 \x01(\x0e2\x1f.pb.JavaFeatures.Utf8ValidationR\x0eutf8ValidationB\xe4\x01\x88\x01\x01\x98\x01\x04\x98\x01\x01\xa2\x01\x0c\x18\x84\x07\x12\x07DEFAULT\xb2\x01\xc8\x01\x08\xe8\x07\x10\xe9\x07\x1a\xbf\x01The Java-specific utf8 validation feature is deprecated and is scheduled to be removed in edition 2025. Utf8 validation behavior should use the global cross-language utf8_validation feature.\x12;\n\nlarge_enum\x18\x03 \x01(\x08R\tlargeEnumB\x1c\x88\x01\x01\x98\x01\x06\x98\x01\x01\xa2\x01\n\x18\x84\x07\x12\x05false\xb2\x01\x03\x08\xe9\x07\x12n\n\x1fuse_old_outer_classname_default\x18\x04 \x01(\x08R\x1buseOldOuterClassnameDefaultB(\x88\x01\x01\x98\x01\x01\xa2\x01\t\x18\x84\x07\x12\x04true\xa2\x01\n\x18\xe9\x07\x12\x05false\xb2\x01\x06\x08\xe9\x07 \xe9\x07\x12\x90\x01\n\x12nest_in_file_class\x18\x05 \x01(\x0e27.pb.JavaFeatures.NestInFileClassFeature.NestInFileClassR\x0fnestInFileClassB*\x88\x01\x01\x98\x01\x03\x98\x01\x06\x98\x01\x08\xa2\x01\x0b\x18\x84\x07\x12\x06LEGACY\xa2\x01\x07\x18\xe9\x07\x12\x02NO\xb2\x01\x03\x08\xe9\x07\x1a|\n\x16NestInFileClassFeature"X\n\x0fNestInFileClass\x12\x1e\n\x1aNEST_IN_FILE_CLASS_UNKNOWN\x10\x00\x12\x06\n\x02NO\x10\x01\x12\x07\n\x03YES\x10\x02\x12\x14\n\x06LEGACY\x10\x03\x1a\x08"\x06\x08\xe9\x07 \xe9\x07J\x08\x08\x01\x10\x80\x80\x80\x80\x02"F\n\x0eUtf8Validation\x12\x1b\n\x17UTF8_VALIDATION_UNKNOWN\x10\x00\x12\x0b\n\x07DEFAULT\x10\x01\x12\n\n\x06VERIFY\x10\x02J\x04\x08\x06\x10\x07:B\n\x04java\x18\xe9\x07 \x01(\x0b2\x10.pb.JavaFeatures\x12\x1b.google.protobuf.FeatureSetR\x04javaB(\n\x13com.google.protobufB\x11JavaFeaturesProto',
  176. [descriptor_pb.desc()],
  177. {
  178. "JavaFeatures": JavaFeatures,
  179. "JavaFeatures.NestInFileClassFeature": JavaFeatures.NestInFileClassFeature,
  180. "JavaFeatures.NestInFileClassFeature.NestInFileClass": JavaFeatures.NestInFileClassFeature.NestInFileClass,
  181. "JavaFeatures.Utf8Validation": JavaFeatures.Utf8Validation,
  182. "java": ext_java,
  183. },
  184. )
  185. def desc() -> DescFile:
  186. """Returns the descriptor for the file `google/protobuf/java_features.proto`."""
  187. return _DESC