# Copyright (c) 2025-2026 Buf Technologies, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Generated from google/protobuf/java_features.proto. DO NOT EDIT. # Generated by protoc-gen-py v0.1.1 with parameter "no_fmt_off". # ruff: noqa: PGH004 # ruff: noqa from __future__ import annotations from typing import Final, Literal, NoReturn, TYPE_CHECKING, TypeAlias from protobuf import Enum, Extension, Message from protobuf._codegen import file_desc from . import descriptor_pb from .descriptor_pb import FeatureSet if TYPE_CHECKING: from protobuf import DescFile _JavaFeaturesFields: TypeAlias = Literal[ "legacy_closed_enum", "utf8_validation", "large_enum", "use_old_outer_classname_default", "nest_in_file_class", ] class JavaFeatures(Message[_JavaFeaturesFields]): """ ```proto message pb.JavaFeatures ``` Attributes: legacy_closed_enum: Whether or not to treat an enum field as closed. This option is only applicable to enum fields, and will be removed in the future. It is consistent with the legacy behavior of using proto3 enum types for proto2 fields. ```proto optional bool legacy_closed_enum = 1; ``` utf8_validation: ```proto optional pb.JavaFeatures.Utf8Validation utf8_validation = 2; ``` large_enum: Allows creation of large Java enums, extending beyond the standard constant limits imposed by the Java language. ```proto optional bool large_enum = 3; ``` use_old_outer_classname_default: Whether to use the old default outer class name scheme, or the new feature which adds a "Proto" suffix to the outer class name. Users will not be able to set this option, because we removed it in the same edition that it was introduced. But we use it to determine which naming scheme to use for outer class name defaults. ```proto optional bool use_old_outer_classname_default = 4; ``` nest_in_file_class: Whether to nest the generated class in the generated file class. This is only applicable to *top-level* messages, enums, and services. ```proto optional pb.JavaFeatures.NestInFileClassFeature.NestInFileClass nest_in_file_class = 5; ``` """ __slots__ = ( "legacy_closed_enum", "utf8_validation", "large_enum", "use_old_outer_classname_default", "nest_in_file_class", ) if TYPE_CHECKING: def __init__( self, *, legacy_closed_enum: bool | None = None, utf8_validation: JavaFeatures.Utf8Validation | None = None, large_enum: bool | None = None, use_old_outer_classname_default: bool | None = None, nest_in_file_class: JavaFeatures.NestInFileClassFeature.NestInFileClass | None = None, ) -> None: pass legacy_closed_enum: bool utf8_validation: JavaFeatures.Utf8Validation large_enum: bool use_old_outer_classname_default: bool nest_in_file_class: JavaFeatures.NestInFileClassFeature.NestInFileClass _NestInFileClassFeatureFields: TypeAlias = NoReturn class NestInFileClassFeature(Message[_NestInFileClassFeatureFields]): """ ```proto message pb.JavaFeatures.NestInFileClassFeature ``` """ __slots__ = () if TYPE_CHECKING: def __init__(self) -> None: pass class NestInFileClass(Enum): """ ```proto enum pb.JavaFeatures.NestInFileClassFeature.NestInFileClass ``` Attributes: UNKNOWN: Invalid default, which should never be used. ```proto NEST_IN_FILE_CLASS_UNKNOWN = 0 ``` NO: Do not nest the generated class in the file class. ```proto NO = 1 ``` YES: Nest the generated class in the file class. ```proto YES = 2 ``` LEGACY: Fall back to the `java_multiple_files` option. Users won't be able to set this option. ```proto LEGACY = 3 ``` """ UNKNOWN = 0 NO = 1 YES = 2 LEGACY = 3 class Utf8Validation(Enum): """ The UTF8 validation strategy to use. ```proto enum pb.JavaFeatures.Utf8Validation ``` Attributes: UNKNOWN: Invalid default, which should never be used. ```proto UTF8_VALIDATION_UNKNOWN = 0 ``` DEFAULT: Respect the UTF8 validation behavior specified by the global utf8_validation feature. ```proto DEFAULT = 1 ``` VERIFY: Verifies UTF8 validity overriding the global utf8_validation feature. This represents the legacy java_string_check_utf8 option. ```proto VERIFY = 2 ``` """ UNKNOWN = 0 DEFAULT = 1 VERIFY = 2 ext_java: Final[Extension[FeatureSet, JavaFeatures]] = Extension() """ ```proto extend google.protobuf.FeatureSet { optional pb.JavaFeatures java = 1001 [json_name = "[pb.java]"] } ``` """ _DESC = file_desc( 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', [descriptor_pb.desc()], { "JavaFeatures": JavaFeatures, "JavaFeatures.NestInFileClassFeature": JavaFeatures.NestInFileClassFeature, "JavaFeatures.NestInFileClassFeature.NestInFileClass": JavaFeatures.NestInFileClassFeature.NestInFileClass, "JavaFeatures.Utf8Validation": JavaFeatures.Utf8Validation, "java": ext_java, }, ) def desc() -> DescFile: """Returns the descriptor for the file `google/protobuf/java_features.proto`.""" return _DESC