From 350c18385193e5bc615e86c1c32deee62102c9cf Mon Sep 17 00:00:00 2001 From: Alper Yoney Date: Fri, 27 Dec 2024 13:07:05 -0800 Subject: [PATCH] Add Containers to the complex-struct fixture Summary: Add `Containers` to complex-struct fixture to sample the cases where container elements are structs, unions or other containers. Reviewed By: iahs, vitaut Differential Revision: D67674109 fbshipit-source-id: 7124fa99dd9316c21c263ad30887f1d782a3060c --- .../out/cpp2/gen-cpp2/module_constants.cpp | 4 +- .../out/cpp2/gen-cpp2/module_constants.h | 4 +- .../out/cpp2/gen-cpp2/module_data.cpp | 102 + .../out/cpp2/gen-cpp2/module_data.h | 16 + .../out/cpp2/gen-cpp2/module_for_each_field.h | 25 + .../out/cpp2/gen-cpp2/module_metadata.cpp | 23 + .../out/cpp2/gen-cpp2/module_metadata.h | 5 + .../out/cpp2/gen-cpp2/module_types.cpp | 391 ++++ .../out/cpp2/gen-cpp2/module_types.h | 1418 +++++++++++ .../out/cpp2/gen-cpp2/module_types.tcc | 792 +++++++ .../out/cpp2/gen-cpp2/module_types_fwd.h | 1 + .../module_visit_by_thrift_field_metadata.h | 47 + .../fixtures/complex_struct/Containers.java | 1261 ++++++++++ .../gen-javadeprecated/Containers.java | 2070 +++++++++++++++++ .../module/thrift_abstract_types.py | 64 + .../gen-python/module/thrift_metadata.py | 90 + .../gen-python/module/thrift_mutable_types.py | 244 ++ .../module/thrift_mutable_types.pyi | 163 ++ .../python/gen-python/module/thrift_types.py | 247 ++ .../python/gen-python/module/thrift_types.pyi | 73 + .../module/thrift_converter.pxd | 5 + .../module/thrift_converter.pyx | 6 + .../module/thrift_types_capi.cpp | 320 +++ .../module/thrift_types_capi.h | 31 + .../module/thrift_types_capi.pxd | 5 + .../module/thrift_types_capi.pyx | 7 + .../fixtures/complex-struct/src/module.thrift | 27 + 27 files changed, 7437 insertions(+), 4 deletions(-) create mode 100644 thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/Containers.java create mode 100644 thrift/compiler/test/fixtures/complex-struct/out/java_deprecated/gen-javadeprecated/Containers.java diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.cpp b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.cpp index c33da63464f..6d194b15716 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.cpp @@ -20,10 +20,10 @@ ::cpp2::MyUnion const& constEnumUnion() { } -::std::string_view _fbthrift_schema_711abdb343f078bf() { +::std::string_view _fbthrift_schema_26752209a8354ec6() { return ""; } -::folly::Range _fbthrift_schema_711abdb343f078bf_includes() { +::folly::Range _fbthrift_schema_26752209a8354ec6_includes() { return {}; } diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.h index 785c40ded18..fa37ec3364b 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_constants.h @@ -24,8 +24,8 @@ namespace module_constants { /** Glean {"constant": "constEnumUnion"} */ ::cpp2::MyUnion const& constEnumUnion(); - FOLLY_EXPORT ::std::string_view _fbthrift_schema_711abdb343f078bf(); - FOLLY_EXPORT ::folly::Range _fbthrift_schema_711abdb343f078bf_includes(); + FOLLY_EXPORT ::std::string_view _fbthrift_schema_26752209a8354ec6(); + FOLLY_EXPORT ::folly::Range _fbthrift_schema_26752209a8354ec6_includes(); } // namespace module_constants } // namespace cpp2 diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.cpp b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.cpp index dd88d234971..03cda6e0577 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.cpp @@ -758,5 +758,107 @@ THRIFT_DATA_MEMBER const std::array TStructDataStorage<::cpp2::complexEx 5, }}; +THRIFT_DATA_MEMBER const std::string_view TStructDataStorage<::cpp2::Containers>::name = "Containers"; +THRIFT_DATA_MEMBER const std::array TStructDataStorage<::cpp2::Containers>::fields_names = { { + "struct_list"sv, + "union_list"sv, + "enum_list"sv, + "struct_set"sv, + "union_set"sv, + "enum_set"sv, + "struct_map"sv, + "union_map"sv, + "enum_map"sv, + "struct_map_2"sv, + "union_map_2"sv, + "enum_map_2"sv, + "list_map"sv, + "list_map_2"sv, + "set_map"sv, + "set_map_2"sv, + "map_map"sv, + "map_map_2"sv, +}}; +THRIFT_DATA_MEMBER const std::array TStructDataStorage<::cpp2::Containers>::fields_ids = { { + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, +}}; +THRIFT_DATA_MEMBER const std::array TStructDataStorage<::cpp2::Containers>::fields_types = { { + TType::T_LIST, + TType::T_LIST, + TType::T_LIST, + TType::T_SET, + TType::T_SET, + TType::T_SET, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, + TType::T_MAP, +}}; +THRIFT_DATA_MEMBER const std::array TStructDataStorage<::cpp2::Containers>::storage_names = { { + "__fbthrift_field_struct_list"sv, + "__fbthrift_field_union_list"sv, + "__fbthrift_field_enum_list"sv, + "__fbthrift_field_struct_set"sv, + "__fbthrift_field_union_set"sv, + "__fbthrift_field_enum_set"sv, + "__fbthrift_field_struct_map"sv, + "__fbthrift_field_union_map"sv, + "__fbthrift_field_enum_map"sv, + "__fbthrift_field_struct_map_2"sv, + "__fbthrift_field_union_map_2"sv, + "__fbthrift_field_enum_map_2"sv, + "__fbthrift_field_list_map"sv, + "__fbthrift_field_list_map_2"sv, + "__fbthrift_field_set_map"sv, + "__fbthrift_field_set_map_2"sv, + "__fbthrift_field_map_map"sv, + "__fbthrift_field_map_map_2"sv, +}}; +THRIFT_DATA_MEMBER const std::array TStructDataStorage<::cpp2::Containers>::isset_indexes = { { + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, +}}; + } // namespace thrift } // namespace apache diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.h index f92083e7d65..1d9a85d245e 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_data.h @@ -309,4 +309,20 @@ template <> struct TStructDataStorage<::cpp2::complexException> { static const std::array isset_indexes; }; +template <> struct TStructDataStorage<::cpp2::Containers> { + static constexpr const std::size_t fields_size = 18; + static const std::string_view name; + static const std::array fields_names; + static const std::array fields_ids; + static const std::array fields_types; + + private: + // The following fields describe internal storage metadata, and are private to + // prevent user logic from accessing them, but they can be inspected by + // debuggers. + static const std::array storage_names; + // -1 if the field has no isset. + static const std::array isset_indexes; +}; + }} // apache::thrift diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_for_each_field.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_for_each_field.h index 332cf602e29..60e7cb9adf2 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_for_each_field.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_for_each_field.h @@ -226,6 +226,31 @@ struct ForEachField<::cpp2::complexException> { f(5, static_cast(t).lsMap_ref()...); } }; + +template <> +struct ForEachField<::cpp2::Containers> { + template + void operator()([[maybe_unused]] F&& f, [[maybe_unused]] T&&... t) const { + f(0, static_cast(t).struct_list_ref()...); + f(1, static_cast(t).union_list_ref()...); + f(2, static_cast(t).enum_list_ref()...); + f(3, static_cast(t).struct_set_ref()...); + f(4, static_cast(t).union_set_ref()...); + f(5, static_cast(t).enum_set_ref()...); + f(6, static_cast(t).struct_map_ref()...); + f(7, static_cast(t).union_map_ref()...); + f(8, static_cast(t).enum_map_ref()...); + f(9, static_cast(t).struct_map_2_ref()...); + f(10, static_cast(t).union_map_2_ref()...); + f(11, static_cast(t).enum_map_2_ref()...); + f(12, static_cast(t).list_map_ref()...); + f(13, static_cast(t).list_map_2_ref()...); + f(14, static_cast(t).set_map_ref()...); + f(15, static_cast(t).set_map_2_ref()...); + f(16, static_cast(t).map_map_ref()...); + f(17, static_cast(t).map_map_2_ref()...); + } +}; } // namespace detail } // namespace thrift } // namespace apache diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.cpp b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.cpp index adb17e197e3..7e57bb38ce7 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.cpp @@ -359,6 +359,29 @@ StructMetadata<::cpp2::complexException>::gen(ThriftMetadata& metadata) { } return res.first->second; } +const ::apache::thrift::metadata::ThriftStruct& +StructMetadata<::cpp2::Containers>::gen(ThriftMetadata& metadata) { + auto res = metadata.structs()->emplace("module.Containers", ::apache::thrift::metadata::ThriftStruct{}); + if (!res.second) { + return res.first->second; + } + ::apache::thrift::metadata::ThriftStruct& module_Containers = res.first->second; + module_Containers.name() = "module.Containers"; + module_Containers.is_union() = false; + static const auto* const + module_Containers_fields = new std::array{ { + { 1, "struct_list", false, std::make_unique(std::make_unique>("module.MyStruct")), std::vector{ }}, { 2, "union_list", false, std::make_unique(std::make_unique>("module.MyUnion")), std::vector{ }}, { 3, "enum_list", false, std::make_unique(std::make_unique>("module.MyEnum")), std::vector{ }}, { 4, "struct_set", false, std::make_unique(std::make_unique>("module.MyStruct")), std::vector{ }}, { 5, "union_set", false, std::make_unique(std::make_unique>("module.MyUnion")), std::vector{ }}, { 6, "enum_set", false, std::make_unique(std::make_unique>("module.MyEnum")), std::vector{ }}, { 7, "struct_map", false, std::make_unique(std::make_unique>("module.MyStruct"), std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{ }}, { 8, "union_map", false, std::make_unique(std::make_unique>("module.MyUnion"), std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{ }}, { 9, "enum_map", false, std::make_unique(std::make_unique>("module.MyEnum"), std::make_unique(ThriftPrimitiveType::THRIFT_I64_TYPE)), std::vector{ }}, { 10, "struct_map_2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique>("module.MyStruct")), std::vector{ }}, { 11, "union_map_2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique>("module.MyUnion")), std::vector{ }}, { 12, "enum_map_2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique>("module.MyEnum")), std::vector{ }}, { 13, "list_map", false, std::make_unique(std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 14, "list_map_2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE))), std::vector{ }}, { 15, "set_map", false, std::make_unique(std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 16, "set_map_2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE))), std::vector{ }}, { 17, "map_map", false, std::make_unique(std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE)), std::vector{ }}, { 18, "map_map_2", false, std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE), std::make_unique(ThriftPrimitiveType::THRIFT_I32_TYPE))), std::vector{ }}, }}; + for (const auto& f : *module_Containers_fields) { + ::apache::thrift::metadata::ThriftField field; + field.id() = f.id; + field.name() = f.name; + field.is_optional() = f.is_optional; + f.metadata_type_interface->writeAndGenType(*field.type(), metadata); + field.structured_annotations() = f.structured_annotations; + module_Containers.fields()->push_back(std::move(field)); + } + return res.first->second; +} void ExceptionMetadata<::cpp2::emptyXcep>::gen(ThriftMetadata& metadata) { auto res = metadata.exceptions()->emplace("module.emptyXcep", ::apache::thrift::metadata::ThriftException{}); diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.h index 7370a16660b..5d9aa833ef8 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_metadata.h @@ -98,6 +98,11 @@ class StructMetadata<::cpp2::complexException> { static const ::apache::thrift::metadata::ThriftStruct& gen(ThriftMetadata& metadata); }; template <> +class StructMetadata<::cpp2::Containers> { + public: + static const ::apache::thrift::metadata::ThriftStruct& gen(ThriftMetadata& metadata); +}; +template <> class ExceptionMetadata<::cpp2::emptyXcep> { public: static void gen(ThriftMetadata& metadata); diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp index 479e785e305..a53bafac471 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.cpp @@ -2762,6 +2762,397 @@ static_assert( } // namespace cpp2 +namespace apache { +namespace thrift { +namespace detail { + +void TccStructTraits<::cpp2::Containers>::translateFieldName( + std::string_view _fname, + int16_t& fid, + apache::thrift::protocol::TType& _ftype) noexcept { + using data = apache::thrift::TStructDataStorage<::cpp2::Containers>; + static const st::translate_field_name_table table{ + data::fields_size, + data::fields_names.data(), + data::fields_ids.data(), + data::fields_types.data()}; + st::translate_field_name(_fname, fid, _ftype, table); +} + +} // namespace detail +} // namespace thrift +} // namespace apache + +namespace cpp2 { + +std::string_view Containers::__fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord) { + if (ord == ::apache::thrift::FieldOrdinal{0}) { return {}; } + return apache::thrift::TStructDataStorage::fields_names[folly::to_underlying(ord) - 1]; +} +std::string_view Containers::__fbthrift_get_class_name() { + return apache::thrift::TStructDataStorage::name; +} + +Containers::Containers(const Containers&) = default; +Containers& Containers::operator=(const Containers&) = default; +Containers::Containers() { +} + + +Containers::~Containers() {} + +Containers::Containers([[maybe_unused]] Containers&& other) noexcept : + __fbthrift_field_struct_list(std::move(other.__fbthrift_field_struct_list)), + __fbthrift_field_union_list(std::move(other.__fbthrift_field_union_list)), + __fbthrift_field_enum_list(std::move(other.__fbthrift_field_enum_list)), + __fbthrift_field_struct_set(std::move(other.__fbthrift_field_struct_set)), + __fbthrift_field_union_set(std::move(other.__fbthrift_field_union_set)), + __fbthrift_field_enum_set(std::move(other.__fbthrift_field_enum_set)), + __fbthrift_field_struct_map(std::move(other.__fbthrift_field_struct_map)), + __fbthrift_field_union_map(std::move(other.__fbthrift_field_union_map)), + __fbthrift_field_enum_map(std::move(other.__fbthrift_field_enum_map)), + __fbthrift_field_struct_map_2(std::move(other.__fbthrift_field_struct_map_2)), + __fbthrift_field_union_map_2(std::move(other.__fbthrift_field_union_map_2)), + __fbthrift_field_enum_map_2(std::move(other.__fbthrift_field_enum_map_2)), + __fbthrift_field_list_map(std::move(other.__fbthrift_field_list_map)), + __fbthrift_field_list_map_2(std::move(other.__fbthrift_field_list_map_2)), + __fbthrift_field_set_map(std::move(other.__fbthrift_field_set_map)), + __fbthrift_field_set_map_2(std::move(other.__fbthrift_field_set_map_2)), + __fbthrift_field_map_map(std::move(other.__fbthrift_field_map_map)), + __fbthrift_field_map_map_2(std::move(other.__fbthrift_field_map_map_2)), + __isset(other.__isset) { +} + +Containers& Containers::operator=([[maybe_unused]] Containers&& other) noexcept { + this->__fbthrift_field_struct_list = std::move(other.__fbthrift_field_struct_list); + this->__fbthrift_field_union_list = std::move(other.__fbthrift_field_union_list); + this->__fbthrift_field_enum_list = std::move(other.__fbthrift_field_enum_list); + this->__fbthrift_field_struct_set = std::move(other.__fbthrift_field_struct_set); + this->__fbthrift_field_union_set = std::move(other.__fbthrift_field_union_set); + this->__fbthrift_field_enum_set = std::move(other.__fbthrift_field_enum_set); + this->__fbthrift_field_struct_map = std::move(other.__fbthrift_field_struct_map); + this->__fbthrift_field_union_map = std::move(other.__fbthrift_field_union_map); + this->__fbthrift_field_enum_map = std::move(other.__fbthrift_field_enum_map); + this->__fbthrift_field_struct_map_2 = std::move(other.__fbthrift_field_struct_map_2); + this->__fbthrift_field_union_map_2 = std::move(other.__fbthrift_field_union_map_2); + this->__fbthrift_field_enum_map_2 = std::move(other.__fbthrift_field_enum_map_2); + this->__fbthrift_field_list_map = std::move(other.__fbthrift_field_list_map); + this->__fbthrift_field_list_map_2 = std::move(other.__fbthrift_field_list_map_2); + this->__fbthrift_field_set_map = std::move(other.__fbthrift_field_set_map); + this->__fbthrift_field_set_map_2 = std::move(other.__fbthrift_field_set_map_2); + this->__fbthrift_field_map_map = std::move(other.__fbthrift_field_map_map); + this->__fbthrift_field_map_map_2 = std::move(other.__fbthrift_field_map_map_2); + __isset = other.__isset; + return *this; +} + + +Containers::Containers(apache::thrift::FragileConstructor, ::std::vector<::cpp2::MyStruct> struct_list__arg, ::std::vector<::cpp2::MyUnion> union_list__arg, ::std::vector<::cpp2::MyEnum> enum_list__arg, ::std::set<::cpp2::MyStruct> struct_set__arg, ::std::set<::cpp2::MyUnion> union_set__arg, ::std::set<::cpp2::MyEnum> enum_set__arg, ::std::map<::cpp2::MyStruct, ::std::int64_t> struct_map__arg, ::std::map<::cpp2::MyUnion, ::std::int64_t> union_map__arg, ::std::map<::cpp2::MyEnum, ::std::int64_t> enum_map__arg, ::std::map<::std::int32_t, ::cpp2::MyStruct> struct_map_2__arg, ::std::map<::std::int32_t, ::cpp2::MyUnion> union_map_2__arg, ::std::map<::std::int32_t, ::cpp2::MyEnum> enum_map_2__arg, ::std::map<::std::vector<::std::int32_t>, ::std::int32_t> list_map__arg, ::std::map<::std::int32_t, ::std::vector<::std::int32_t>> list_map_2__arg, ::std::map<::std::set<::std::int32_t>, ::std::int32_t> set_map__arg, ::std::map<::std::int32_t, ::std::set<::std::int32_t>> set_map_2__arg, ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t> map_map__arg, ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>> map_map_2__arg) : + __fbthrift_field_struct_list(std::move(struct_list__arg)), + __fbthrift_field_union_list(std::move(union_list__arg)), + __fbthrift_field_enum_list(std::move(enum_list__arg)), + __fbthrift_field_struct_set(std::move(struct_set__arg)), + __fbthrift_field_union_set(std::move(union_set__arg)), + __fbthrift_field_enum_set(std::move(enum_set__arg)), + __fbthrift_field_struct_map(std::move(struct_map__arg)), + __fbthrift_field_union_map(std::move(union_map__arg)), + __fbthrift_field_enum_map(std::move(enum_map__arg)), + __fbthrift_field_struct_map_2(std::move(struct_map_2__arg)), + __fbthrift_field_union_map_2(std::move(union_map_2__arg)), + __fbthrift_field_enum_map_2(std::move(enum_map_2__arg)), + __fbthrift_field_list_map(std::move(list_map__arg)), + __fbthrift_field_list_map_2(std::move(list_map_2__arg)), + __fbthrift_field_set_map(std::move(set_map__arg)), + __fbthrift_field_set_map_2(std::move(set_map_2__arg)), + __fbthrift_field_map_map(std::move(map_map__arg)), + __fbthrift_field_map_map_2(std::move(map_map_2__arg)) { + __isset.set(folly::index_constant<0>(), true); + __isset.set(folly::index_constant<1>(), true); + __isset.set(folly::index_constant<2>(), true); + __isset.set(folly::index_constant<3>(), true); + __isset.set(folly::index_constant<4>(), true); + __isset.set(folly::index_constant<5>(), true); + __isset.set(folly::index_constant<6>(), true); + __isset.set(folly::index_constant<7>(), true); + __isset.set(folly::index_constant<8>(), true); + __isset.set(folly::index_constant<9>(), true); + __isset.set(folly::index_constant<10>(), true); + __isset.set(folly::index_constant<11>(), true); + __isset.set(folly::index_constant<12>(), true); + __isset.set(folly::index_constant<13>(), true); + __isset.set(folly::index_constant<14>(), true); + __isset.set(folly::index_constant<15>(), true); + __isset.set(folly::index_constant<16>(), true); + __isset.set(folly::index_constant<17>(), true); +} + + +void Containers::__fbthrift_clear() { + // clear all fields + this->__fbthrift_field_struct_list.clear(); + this->__fbthrift_field_union_list.clear(); + this->__fbthrift_field_enum_list.clear(); + this->__fbthrift_field_struct_set.clear(); + this->__fbthrift_field_union_set.clear(); + this->__fbthrift_field_enum_set.clear(); + this->__fbthrift_field_struct_map.clear(); + this->__fbthrift_field_union_map.clear(); + this->__fbthrift_field_enum_map.clear(); + this->__fbthrift_field_struct_map_2.clear(); + this->__fbthrift_field_union_map_2.clear(); + this->__fbthrift_field_enum_map_2.clear(); + this->__fbthrift_field_list_map.clear(); + this->__fbthrift_field_list_map_2.clear(); + this->__fbthrift_field_set_map.clear(); + this->__fbthrift_field_set_map_2.clear(); + this->__fbthrift_field_map_map.clear(); + this->__fbthrift_field_map_map_2.clear(); + __isset = {}; +} + +void Containers::__fbthrift_clear_terse_fields() { +} + +bool Containers::__fbthrift_is_empty() const { + return false; +} + +bool Containers::operator==([[maybe_unused]] const Containers& rhs) const { + return ::apache::thrift::op::detail::StructEquality{}(*this, rhs); +} + +bool Containers::operator<([[maybe_unused]] const Containers& rhs) const { + return ::apache::thrift::op::detail::StructLessThan{}(*this, rhs); +} + +const ::std::vector<::cpp2::MyStruct>& Containers::get_struct_list() const& { + return __fbthrift_field_struct_list; +} + +::std::vector<::cpp2::MyStruct> Containers::get_struct_list() && { + return std::move(__fbthrift_field_struct_list); +} + +const ::std::vector<::cpp2::MyUnion>& Containers::get_union_list() const& { + return __fbthrift_field_union_list; +} + +::std::vector<::cpp2::MyUnion> Containers::get_union_list() && { + return std::move(__fbthrift_field_union_list); +} + +const ::std::vector<::cpp2::MyEnum>& Containers::get_enum_list() const& { + return __fbthrift_field_enum_list; +} + +::std::vector<::cpp2::MyEnum> Containers::get_enum_list() && { + return std::move(__fbthrift_field_enum_list); +} + +const ::std::set<::cpp2::MyStruct>& Containers::get_struct_set() const& { + return __fbthrift_field_struct_set; +} + +::std::set<::cpp2::MyStruct> Containers::get_struct_set() && { + return std::move(__fbthrift_field_struct_set); +} + +const ::std::set<::cpp2::MyUnion>& Containers::get_union_set() const& { + return __fbthrift_field_union_set; +} + +::std::set<::cpp2::MyUnion> Containers::get_union_set() && { + return std::move(__fbthrift_field_union_set); +} + +const ::std::set<::cpp2::MyEnum>& Containers::get_enum_set() const& { + return __fbthrift_field_enum_set; +} + +::std::set<::cpp2::MyEnum> Containers::get_enum_set() && { + return std::move(__fbthrift_field_enum_set); +} + +const ::std::map<::cpp2::MyStruct, ::std::int64_t>& Containers::get_struct_map() const& { + return __fbthrift_field_struct_map; +} + +::std::map<::cpp2::MyStruct, ::std::int64_t> Containers::get_struct_map() && { + return std::move(__fbthrift_field_struct_map); +} + +const ::std::map<::cpp2::MyUnion, ::std::int64_t>& Containers::get_union_map() const& { + return __fbthrift_field_union_map; +} + +::std::map<::cpp2::MyUnion, ::std::int64_t> Containers::get_union_map() && { + return std::move(__fbthrift_field_union_map); +} + +const ::std::map<::cpp2::MyEnum, ::std::int64_t>& Containers::get_enum_map() const& { + return __fbthrift_field_enum_map; +} + +::std::map<::cpp2::MyEnum, ::std::int64_t> Containers::get_enum_map() && { + return std::move(__fbthrift_field_enum_map); +} + +const ::std::map<::std::int32_t, ::cpp2::MyStruct>& Containers::get_struct_map_2() const& { + return __fbthrift_field_struct_map_2; +} + +::std::map<::std::int32_t, ::cpp2::MyStruct> Containers::get_struct_map_2() && { + return std::move(__fbthrift_field_struct_map_2); +} + +const ::std::map<::std::int32_t, ::cpp2::MyUnion>& Containers::get_union_map_2() const& { + return __fbthrift_field_union_map_2; +} + +::std::map<::std::int32_t, ::cpp2::MyUnion> Containers::get_union_map_2() && { + return std::move(__fbthrift_field_union_map_2); +} + +const ::std::map<::std::int32_t, ::cpp2::MyEnum>& Containers::get_enum_map_2() const& { + return __fbthrift_field_enum_map_2; +} + +::std::map<::std::int32_t, ::cpp2::MyEnum> Containers::get_enum_map_2() && { + return std::move(__fbthrift_field_enum_map_2); +} + +const ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>& Containers::get_list_map() const& { + return __fbthrift_field_list_map; +} + +::std::map<::std::vector<::std::int32_t>, ::std::int32_t> Containers::get_list_map() && { + return std::move(__fbthrift_field_list_map); +} + +const ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>& Containers::get_list_map_2() const& { + return __fbthrift_field_list_map_2; +} + +::std::map<::std::int32_t, ::std::vector<::std::int32_t>> Containers::get_list_map_2() && { + return std::move(__fbthrift_field_list_map_2); +} + +const ::std::map<::std::set<::std::int32_t>, ::std::int32_t>& Containers::get_set_map() const& { + return __fbthrift_field_set_map; +} + +::std::map<::std::set<::std::int32_t>, ::std::int32_t> Containers::get_set_map() && { + return std::move(__fbthrift_field_set_map); +} + +const ::std::map<::std::int32_t, ::std::set<::std::int32_t>>& Containers::get_set_map_2() const& { + return __fbthrift_field_set_map_2; +} + +::std::map<::std::int32_t, ::std::set<::std::int32_t>> Containers::get_set_map_2() && { + return std::move(__fbthrift_field_set_map_2); +} + +const ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>& Containers::get_map_map() const& { + return __fbthrift_field_map_map; +} + +::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t> Containers::get_map_map() && { + return std::move(__fbthrift_field_map_map); +} + +const ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>& Containers::get_map_map_2() const& { + return __fbthrift_field_map_map_2; +} + +::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>> Containers::get_map_map_2() && { + return std::move(__fbthrift_field_map_map_2); +} + + +void swap([[maybe_unused]] Containers& a, [[maybe_unused]] Containers& b) { + using ::std::swap; + swap(a.__fbthrift_field_struct_list, b.__fbthrift_field_struct_list); + swap(a.__fbthrift_field_union_list, b.__fbthrift_field_union_list); + swap(a.__fbthrift_field_enum_list, b.__fbthrift_field_enum_list); + swap(a.__fbthrift_field_struct_set, b.__fbthrift_field_struct_set); + swap(a.__fbthrift_field_union_set, b.__fbthrift_field_union_set); + swap(a.__fbthrift_field_enum_set, b.__fbthrift_field_enum_set); + swap(a.__fbthrift_field_struct_map, b.__fbthrift_field_struct_map); + swap(a.__fbthrift_field_union_map, b.__fbthrift_field_union_map); + swap(a.__fbthrift_field_enum_map, b.__fbthrift_field_enum_map); + swap(a.__fbthrift_field_struct_map_2, b.__fbthrift_field_struct_map_2); + swap(a.__fbthrift_field_union_map_2, b.__fbthrift_field_union_map_2); + swap(a.__fbthrift_field_enum_map_2, b.__fbthrift_field_enum_map_2); + swap(a.__fbthrift_field_list_map, b.__fbthrift_field_list_map); + swap(a.__fbthrift_field_list_map_2, b.__fbthrift_field_list_map_2); + swap(a.__fbthrift_field_set_map, b.__fbthrift_field_set_map); + swap(a.__fbthrift_field_set_map_2, b.__fbthrift_field_set_map_2); + swap(a.__fbthrift_field_map_map, b.__fbthrift_field_map_map); + swap(a.__fbthrift_field_map_map_2, b.__fbthrift_field_map_map_2); + swap(a.__isset, b.__isset); +} + +template void Containers::readNoXfer<>(apache::thrift::BinaryProtocolReader*); +template uint32_t Containers::write<>(apache::thrift::BinaryProtocolWriter*) const; +template uint32_t Containers::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const; +template uint32_t Containers::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const; +template void Containers::readNoXfer<>(apache::thrift::CompactProtocolReader*); +template uint32_t Containers::write<>(apache::thrift::CompactProtocolWriter*) const; +template uint32_t Containers::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const; +template uint32_t Containers::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const; + +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::list<::apache::thrift::type_class::structure>, + ::std::vector<::cpp2::MyStruct>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::list<::apache::thrift::type_class::variant>, + ::std::vector<::cpp2::MyUnion>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::set<::apache::thrift::type_class::structure>, + ::std::set<::cpp2::MyStruct>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::set<::apache::thrift::type_class::variant>, + ::std::set<::cpp2::MyUnion>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::map<::apache::thrift::type_class::structure, ::apache::thrift::type_class::integral>, + ::std::map<::cpp2::MyStruct, ::std::int64_t>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::map<::apache::thrift::type_class::variant, ::apache::thrift::type_class::integral>, + ::std::map<::cpp2::MyUnion, ::std::int64_t>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::structure>, + ::std::map<::std::int32_t, ::cpp2::MyStruct>>, + "inconsistent use of json option"); +static_assert( + ::apache::thrift::detail::st::gen_check_json< + Containers, + ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, + ::std::map<::std::int32_t, ::cpp2::MyUnion>>, + "inconsistent use of json option"); + +} // namespace cpp2 + namespace cpp2 { namespace { [[maybe_unused]] FOLLY_ERASE void validateAdapters() { } diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h index bc9ce0f06ef..be6f12785cd 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.h @@ -122,6 +122,24 @@ struct errorEnum; struct unionError; struct structError; struct lsMap; +struct struct_list; +struct union_list; +struct enum_list; +struct struct_set; +struct union_set; +struct enum_set; +struct struct_map; +struct union_map; +struct enum_map; +struct struct_map_2; +struct union_map_2; +struct enum_map_2; +struct list_map; +struct list_map_2; +struct set_map; +struct set_map_2; +struct map_map; +struct map_map_2; } // namespace ident namespace detail { #ifndef APACHE_THRIFT_ACCESSOR_myLongField @@ -560,6 +578,78 @@ APACHE_THRIFT_DEFINE_ACCESSOR(structError); #define APACHE_THRIFT_ACCESSOR_lsMap APACHE_THRIFT_DEFINE_ACCESSOR(lsMap); #endif +#ifndef APACHE_THRIFT_ACCESSOR_struct_list +#define APACHE_THRIFT_ACCESSOR_struct_list +APACHE_THRIFT_DEFINE_ACCESSOR(struct_list); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_union_list +#define APACHE_THRIFT_ACCESSOR_union_list +APACHE_THRIFT_DEFINE_ACCESSOR(union_list); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_enum_list +#define APACHE_THRIFT_ACCESSOR_enum_list +APACHE_THRIFT_DEFINE_ACCESSOR(enum_list); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_struct_set +#define APACHE_THRIFT_ACCESSOR_struct_set +APACHE_THRIFT_DEFINE_ACCESSOR(struct_set); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_union_set +#define APACHE_THRIFT_ACCESSOR_union_set +APACHE_THRIFT_DEFINE_ACCESSOR(union_set); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_enum_set +#define APACHE_THRIFT_ACCESSOR_enum_set +APACHE_THRIFT_DEFINE_ACCESSOR(enum_set); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_struct_map +#define APACHE_THRIFT_ACCESSOR_struct_map +APACHE_THRIFT_DEFINE_ACCESSOR(struct_map); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_union_map +#define APACHE_THRIFT_ACCESSOR_union_map +APACHE_THRIFT_DEFINE_ACCESSOR(union_map); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_enum_map +#define APACHE_THRIFT_ACCESSOR_enum_map +APACHE_THRIFT_DEFINE_ACCESSOR(enum_map); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_struct_map_2 +#define APACHE_THRIFT_ACCESSOR_struct_map_2 +APACHE_THRIFT_DEFINE_ACCESSOR(struct_map_2); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_union_map_2 +#define APACHE_THRIFT_ACCESSOR_union_map_2 +APACHE_THRIFT_DEFINE_ACCESSOR(union_map_2); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_enum_map_2 +#define APACHE_THRIFT_ACCESSOR_enum_map_2 +APACHE_THRIFT_DEFINE_ACCESSOR(enum_map_2); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_list_map +#define APACHE_THRIFT_ACCESSOR_list_map +APACHE_THRIFT_DEFINE_ACCESSOR(list_map); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_list_map_2 +#define APACHE_THRIFT_ACCESSOR_list_map_2 +APACHE_THRIFT_DEFINE_ACCESSOR(list_map_2); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_set_map +#define APACHE_THRIFT_ACCESSOR_set_map +APACHE_THRIFT_DEFINE_ACCESSOR(set_map); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_set_map_2 +#define APACHE_THRIFT_ACCESSOR_set_map_2 +APACHE_THRIFT_DEFINE_ACCESSOR(set_map_2); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_map_map +#define APACHE_THRIFT_ACCESSOR_map_map +APACHE_THRIFT_DEFINE_ACCESSOR(map_map); +#endif +#ifndef APACHE_THRIFT_ACCESSOR_map_map_2 +#define APACHE_THRIFT_ACCESSOR_map_map_2 +APACHE_THRIFT_DEFINE_ACCESSOR(map_map_2); +#endif } // namespace detail } // namespace thrift } // namespace apache @@ -640,6 +730,7 @@ class emptyXcep; class reqXcep; class optXcep; class complexException; +class Containers; } // namespace cpp2 // END forward_declare namespace apache::thrift::detail::annotation { @@ -9819,6 +9910,1333 @@ unsigned long complexException::read(Protocol_* iprot) { } +/** Glean {"file": "thrift/compiler/test/fixtures/complex-struct/src/module.thrift", "name": "Containers", "kind": "struct" } */ +class Containers final { + private: + friend struct ::apache::thrift::detail::st::struct_private_access; + template friend struct ::apache::thrift::detail::invoke_reffer; + + // used by a static_assert in the corresponding source + static constexpr bool __fbthrift_cpp2_gen_json = false; + static constexpr bool __fbthrift_cpp2_is_runtime_annotation = false; + static std::string_view __fbthrift_get_field_name(::apache::thrift::FieldOrdinal ord); + static std::string_view __fbthrift_get_class_name(); + template + FOLLY_ERASE static constexpr std::string_view __fbthrift_get_module_name() noexcept { + return "module"; + } + using __fbthrift_reflection_ident_list = folly::tag_t< + ::apache::thrift::ident::struct_list, + ::apache::thrift::ident::union_list, + ::apache::thrift::ident::enum_list, + ::apache::thrift::ident::struct_set, + ::apache::thrift::ident::union_set, + ::apache::thrift::ident::enum_set, + ::apache::thrift::ident::struct_map, + ::apache::thrift::ident::union_map, + ::apache::thrift::ident::enum_map, + ::apache::thrift::ident::struct_map_2, + ::apache::thrift::ident::union_map_2, + ::apache::thrift::ident::enum_map_2, + ::apache::thrift::ident::list_map, + ::apache::thrift::ident::list_map_2, + ::apache::thrift::ident::set_map, + ::apache::thrift::ident::set_map_2, + ::apache::thrift::ident::map_map, + ::apache::thrift::ident::map_map_2 + >; + + static constexpr std::int16_t __fbthrift_reflection_field_id_list[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; + using __fbthrift_reflection_type_tags = folly::tag_t< + ::apache::thrift::type::list<::apache::thrift::type::struct_t<::cpp2::MyStruct>>, + ::apache::thrift::type::list<::apache::thrift::type::union_t<::cpp2::MyUnion>>, + ::apache::thrift::type::list<::apache::thrift::type::enum_t<::cpp2::MyEnum>>, + ::apache::thrift::type::set<::apache::thrift::type::struct_t<::cpp2::MyStruct>>, + ::apache::thrift::type::set<::apache::thrift::type::union_t<::cpp2::MyUnion>>, + ::apache::thrift::type::set<::apache::thrift::type::enum_t<::cpp2::MyEnum>>, + ::apache::thrift::type::map<::apache::thrift::type::struct_t<::cpp2::MyStruct>, ::apache::thrift::type::i64_t>, + ::apache::thrift::type::map<::apache::thrift::type::union_t<::cpp2::MyUnion>, ::apache::thrift::type::i64_t>, + ::apache::thrift::type::map<::apache::thrift::type::enum_t<::cpp2::MyEnum>, ::apache::thrift::type::i64_t>, + ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::struct_t<::cpp2::MyStruct>>, + ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::union_t<::cpp2::MyUnion>>, + ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::enum_t<::cpp2::MyEnum>>, + ::apache::thrift::type::map<::apache::thrift::type::list<::apache::thrift::type::i32_t>, ::apache::thrift::type::i32_t>, + ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::list<::apache::thrift::type::i32_t>>, + ::apache::thrift::type::map<::apache::thrift::type::set<::apache::thrift::type::i32_t>, ::apache::thrift::type::i32_t>, + ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::set<::apache::thrift::type::i32_t>>, + ::apache::thrift::type::map<::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::i32_t>, ::apache::thrift::type::i32_t>, + ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::map<::apache::thrift::type::i32_t, ::apache::thrift::type::i32_t>> + >; + + static constexpr std::size_t __fbthrift_field_size_v = 18; + + template + using __fbthrift_id = ::apache::thrift::type::field_id<__fbthrift_reflection_field_id_list[folly::to_underlying(T::value)]>; + + template + using __fbthrift_type_tag = ::apache::thrift::detail::at<__fbthrift_reflection_type_tags, T::value>; + + template + using __fbthrift_ident = ::apache::thrift::detail::at<__fbthrift_reflection_ident_list, T::value>; + + template using __fbthrift_ordinal = ::apache::thrift::type::ordinal_tag< + ::apache::thrift::detail::getFieldOrdinal( + __fbthrift_reflection_field_id_list + ) + >; + void __fbthrift_clear(); + void __fbthrift_clear_terse_fields(); + bool __fbthrift_is_empty() const; + + public: + using __fbthrift_cpp2_type = Containers; + static constexpr bool __fbthrift_cpp2_is_union = + false; + static constexpr bool __fbthrift_cpp2_uses_op_encode = + false; + + + public: + + Containers(); + + // FragileConstructor for use in initialization lists only. + [[deprecated("This constructor is deprecated")]] + Containers(apache::thrift::FragileConstructor, ::std::vector<::cpp2::MyStruct> struct_list__arg, ::std::vector<::cpp2::MyUnion> union_list__arg, ::std::vector<::cpp2::MyEnum> enum_list__arg, ::std::set<::cpp2::MyStruct> struct_set__arg, ::std::set<::cpp2::MyUnion> union_set__arg, ::std::set<::cpp2::MyEnum> enum_set__arg, ::std::map<::cpp2::MyStruct, ::std::int64_t> struct_map__arg, ::std::map<::cpp2::MyUnion, ::std::int64_t> union_map__arg, ::std::map<::cpp2::MyEnum, ::std::int64_t> enum_map__arg, ::std::map<::std::int32_t, ::cpp2::MyStruct> struct_map_2__arg, ::std::map<::std::int32_t, ::cpp2::MyUnion> union_map_2__arg, ::std::map<::std::int32_t, ::cpp2::MyEnum> enum_map_2__arg, ::std::map<::std::vector<::std::int32_t>, ::std::int32_t> list_map__arg, ::std::map<::std::int32_t, ::std::vector<::std::int32_t>> list_map_2__arg, ::std::map<::std::set<::std::int32_t>, ::std::int32_t> set_map__arg, ::std::map<::std::int32_t, ::std::set<::std::int32_t>> set_map_2__arg, ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t> map_map__arg, ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>> map_map_2__arg); + + Containers(Containers&&) noexcept; + + Containers(const Containers& src); + + + Containers& operator=(Containers&&) noexcept; + Containers& operator=(const Containers& src); + + ~Containers(); + + private: + ::std::vector<::cpp2::MyStruct> __fbthrift_field_struct_list; + private: + ::std::vector<::cpp2::MyUnion> __fbthrift_field_union_list; + private: + ::std::vector<::cpp2::MyEnum> __fbthrift_field_enum_list; + private: + ::std::set<::cpp2::MyStruct> __fbthrift_field_struct_set; + private: + ::std::set<::cpp2::MyUnion> __fbthrift_field_union_set; + private: + ::std::set<::cpp2::MyEnum> __fbthrift_field_enum_set; + private: + ::std::map<::cpp2::MyStruct, ::std::int64_t> __fbthrift_field_struct_map; + private: + ::std::map<::cpp2::MyUnion, ::std::int64_t> __fbthrift_field_union_map; + private: + ::std::map<::cpp2::MyEnum, ::std::int64_t> __fbthrift_field_enum_map; + private: + ::std::map<::std::int32_t, ::cpp2::MyStruct> __fbthrift_field_struct_map_2; + private: + ::std::map<::std::int32_t, ::cpp2::MyUnion> __fbthrift_field_union_map_2; + private: + ::std::map<::std::int32_t, ::cpp2::MyEnum> __fbthrift_field_enum_map_2; + private: + ::std::map<::std::vector<::std::int32_t>, ::std::int32_t> __fbthrift_field_list_map; + private: + ::std::map<::std::int32_t, ::std::vector<::std::int32_t>> __fbthrift_field_list_map_2; + private: + ::std::map<::std::set<::std::int32_t>, ::std::int32_t> __fbthrift_field_set_map; + private: + ::std::map<::std::int32_t, ::std::set<::std::int32_t>> __fbthrift_field_set_map_2; + private: + ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t> __fbthrift_field_map_map; + private: + ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>> __fbthrift_field_map_map_2; + private: + apache::thrift::detail::isset_bitset<18, apache::thrift::detail::IssetBitsetOption::Unpacked> __isset; + + public: + + bool operator==(const Containers&) const; + bool operator<(const Containers&) const; + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list_ref() const& { + return {this->__fbthrift_field_struct_list, __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list_ref() const&& { + return {static_cast(this->__fbthrift_field_struct_list), __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list_ref() & { + return {this->__fbthrift_field_struct_list, __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list_ref() && { + return {static_cast(this->__fbthrift_field_struct_list), __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list() const& { + return {this->__fbthrift_field_struct_list, __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list() const&& { + return {static_cast(this->__fbthrift_field_struct_list), __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list() & { + return {this->__fbthrift_field_struct_list, __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "struct_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_list() && { + return {static_cast(this->__fbthrift_field_struct_list), __isset.at(0), __isset.bit(0)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list_ref() const& { + return {this->__fbthrift_field_union_list, __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list_ref() const&& { + return {static_cast(this->__fbthrift_field_union_list), __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list_ref() & { + return {this->__fbthrift_field_union_list, __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list_ref() && { + return {static_cast(this->__fbthrift_field_union_list), __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list() const& { + return {this->__fbthrift_field_union_list, __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list() const&& { + return {static_cast(this->__fbthrift_field_union_list), __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list() & { + return {this->__fbthrift_field_union_list, __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "union_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_list() && { + return {static_cast(this->__fbthrift_field_union_list), __isset.at(1), __isset.bit(1)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list_ref() const& { + return {this->__fbthrift_field_enum_list, __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list_ref() const&& { + return {static_cast(this->__fbthrift_field_enum_list), __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list_ref() & { + return {this->__fbthrift_field_enum_list, __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list_ref() && { + return {static_cast(this->__fbthrift_field_enum_list), __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list() const& { + return {this->__fbthrift_field_enum_list, __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list() const&& { + return {static_cast(this->__fbthrift_field_enum_list), __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list() & { + return {this->__fbthrift_field_enum_list, __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "enum_list" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_list() && { + return {static_cast(this->__fbthrift_field_enum_list), __isset.at(2), __isset.bit(2)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set_ref() const& { + return {this->__fbthrift_field_struct_set, __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set_ref() const&& { + return {static_cast(this->__fbthrift_field_struct_set), __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set_ref() & { + return {this->__fbthrift_field_struct_set, __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set_ref() && { + return {static_cast(this->__fbthrift_field_struct_set), __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set() const& { + return {this->__fbthrift_field_struct_set, __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set() const&& { + return {static_cast(this->__fbthrift_field_struct_set), __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set() & { + return {this->__fbthrift_field_struct_set, __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "struct_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_set() && { + return {static_cast(this->__fbthrift_field_struct_set), __isset.at(3), __isset.bit(3)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set_ref() const& { + return {this->__fbthrift_field_union_set, __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set_ref() const&& { + return {static_cast(this->__fbthrift_field_union_set), __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set_ref() & { + return {this->__fbthrift_field_union_set, __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set_ref() && { + return {static_cast(this->__fbthrift_field_union_set), __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set() const& { + return {this->__fbthrift_field_union_set, __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set() const&& { + return {static_cast(this->__fbthrift_field_union_set), __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set() & { + return {this->__fbthrift_field_union_set, __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "union_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_set() && { + return {static_cast(this->__fbthrift_field_union_set), __isset.at(4), __isset.bit(4)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set_ref() const& { + return {this->__fbthrift_field_enum_set, __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set_ref() const&& { + return {static_cast(this->__fbthrift_field_enum_set), __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set_ref() & { + return {this->__fbthrift_field_enum_set, __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set_ref() && { + return {static_cast(this->__fbthrift_field_enum_set), __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set() const& { + return {this->__fbthrift_field_enum_set, __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set() const&& { + return {static_cast(this->__fbthrift_field_enum_set), __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set() & { + return {this->__fbthrift_field_enum_set, __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "enum_set" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_set() && { + return {static_cast(this->__fbthrift_field_enum_set), __isset.at(5), __isset.bit(5)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_ref() const& { + return {this->__fbthrift_field_struct_map, __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_ref() const&& { + return {static_cast(this->__fbthrift_field_struct_map), __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_ref() & { + return {this->__fbthrift_field_struct_map, __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_ref() && { + return {static_cast(this->__fbthrift_field_struct_map), __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map() const& { + return {this->__fbthrift_field_struct_map, __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map() const&& { + return {static_cast(this->__fbthrift_field_struct_map), __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map() & { + return {this->__fbthrift_field_struct_map, __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "struct_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map() && { + return {static_cast(this->__fbthrift_field_struct_map), __isset.at(6), __isset.bit(6)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_ref() const& { + return {this->__fbthrift_field_union_map, __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_ref() const&& { + return {static_cast(this->__fbthrift_field_union_map), __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_ref() & { + return {this->__fbthrift_field_union_map, __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_ref() && { + return {static_cast(this->__fbthrift_field_union_map), __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map() const& { + return {this->__fbthrift_field_union_map, __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map() const&& { + return {static_cast(this->__fbthrift_field_union_map), __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map() & { + return {this->__fbthrift_field_union_map, __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "union_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map() && { + return {static_cast(this->__fbthrift_field_union_map), __isset.at(7), __isset.bit(7)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_ref() const& { + return {this->__fbthrift_field_enum_map, __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_ref() const&& { + return {static_cast(this->__fbthrift_field_enum_map), __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_ref() & { + return {this->__fbthrift_field_enum_map, __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_ref() && { + return {static_cast(this->__fbthrift_field_enum_map), __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map() const& { + return {this->__fbthrift_field_enum_map, __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map() const&& { + return {static_cast(this->__fbthrift_field_enum_map), __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map() & { + return {this->__fbthrift_field_enum_map, __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "enum_map" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map() && { + return {static_cast(this->__fbthrift_field_enum_map), __isset.at(8), __isset.bit(8)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2_ref() const& { + return {this->__fbthrift_field_struct_map_2, __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2_ref() const&& { + return {static_cast(this->__fbthrift_field_struct_map_2), __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2_ref() & { + return {this->__fbthrift_field_struct_map_2, __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2_ref() && { + return {static_cast(this->__fbthrift_field_struct_map_2), __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2() const& { + return {this->__fbthrift_field_struct_map_2, __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2() const&& { + return {static_cast(this->__fbthrift_field_struct_map_2), __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2() & { + return {this->__fbthrift_field_struct_map_2, __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "struct_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref struct_map_2() && { + return {static_cast(this->__fbthrift_field_struct_map_2), __isset.at(9), __isset.bit(9)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2_ref() const& { + return {this->__fbthrift_field_union_map_2, __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2_ref() const&& { + return {static_cast(this->__fbthrift_field_union_map_2), __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2_ref() & { + return {this->__fbthrift_field_union_map_2, __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2_ref() && { + return {static_cast(this->__fbthrift_field_union_map_2), __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2() const& { + return {this->__fbthrift_field_union_map_2, __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2() const&& { + return {static_cast(this->__fbthrift_field_union_map_2), __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2() & { + return {this->__fbthrift_field_union_map_2, __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "union_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref union_map_2() && { + return {static_cast(this->__fbthrift_field_union_map_2), __isset.at(10), __isset.bit(10)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2_ref() const& { + return {this->__fbthrift_field_enum_map_2, __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2_ref() const&& { + return {static_cast(this->__fbthrift_field_enum_map_2), __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2_ref() & { + return {this->__fbthrift_field_enum_map_2, __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2_ref() && { + return {static_cast(this->__fbthrift_field_enum_map_2), __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2() const& { + return {this->__fbthrift_field_enum_map_2, __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2() const&& { + return {static_cast(this->__fbthrift_field_enum_map_2), __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2() & { + return {this->__fbthrift_field_enum_map_2, __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "enum_map_2" } */ + template > + FOLLY_ERASE ::apache::thrift::field_ref enum_map_2() && { + return {static_cast(this->__fbthrift_field_enum_map_2), __isset.at(11), __isset.bit(11)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map_ref() const& { + return {this->__fbthrift_field_list_map, __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map_ref() const&& { + return {static_cast(this->__fbthrift_field_list_map), __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map_ref() & { + return {this->__fbthrift_field_list_map, __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map_ref() && { + return {static_cast(this->__fbthrift_field_list_map), __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map() const& { + return {this->__fbthrift_field_list_map, __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map() const&& { + return {static_cast(this->__fbthrift_field_list_map), __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map() & { + return {this->__fbthrift_field_list_map, __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref list_map() && { + return {static_cast(this->__fbthrift_field_list_map), __isset.at(12), __isset.bit(12)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2_ref() const& { + return {this->__fbthrift_field_list_map_2, __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2_ref() const&& { + return {static_cast(this->__fbthrift_field_list_map_2), __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2_ref() & { + return {this->__fbthrift_field_list_map_2, __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2_ref() && { + return {static_cast(this->__fbthrift_field_list_map_2), __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2() const& { + return {this->__fbthrift_field_list_map_2, __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2() const&& { + return {static_cast(this->__fbthrift_field_list_map_2), __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2() & { + return {this->__fbthrift_field_list_map_2, __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "list_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref list_map_2() && { + return {static_cast(this->__fbthrift_field_list_map_2), __isset.at(13), __isset.bit(13)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map_ref() const& { + return {this->__fbthrift_field_set_map, __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map_ref() const&& { + return {static_cast(this->__fbthrift_field_set_map), __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map_ref() & { + return {this->__fbthrift_field_set_map, __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map_ref() && { + return {static_cast(this->__fbthrift_field_set_map), __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map() const& { + return {this->__fbthrift_field_set_map, __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map() const&& { + return {static_cast(this->__fbthrift_field_set_map), __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map() & { + return {this->__fbthrift_field_set_map, __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref set_map() && { + return {static_cast(this->__fbthrift_field_set_map), __isset.at(14), __isset.bit(14)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2_ref() const& { + return {this->__fbthrift_field_set_map_2, __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2_ref() const&& { + return {static_cast(this->__fbthrift_field_set_map_2), __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2_ref() & { + return {this->__fbthrift_field_set_map_2, __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2_ref() && { + return {static_cast(this->__fbthrift_field_set_map_2), __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2() const& { + return {this->__fbthrift_field_set_map_2, __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2() const&& { + return {static_cast(this->__fbthrift_field_set_map_2), __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2() & { + return {this->__fbthrift_field_set_map_2, __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "set_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref set_map_2() && { + return {static_cast(this->__fbthrift_field_set_map_2), __isset.at(15), __isset.bit(15)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map_ref() const& { + return {this->__fbthrift_field_map_map, __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map_ref() const&& { + return {static_cast(this->__fbthrift_field_map_map), __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map_ref() & { + return {this->__fbthrift_field_map_map, __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map_ref() && { + return {static_cast(this->__fbthrift_field_map_map), __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map() const& { + return {this->__fbthrift_field_map_map, __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map() const&& { + return {static_cast(this->__fbthrift_field_map_map), __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map() & { + return {this->__fbthrift_field_map_map, __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + FOLLY_ERASE ::apache::thrift::field_ref map_map() && { + return {static_cast(this->__fbthrift_field_map_map), __isset.at(16), __isset.bit(16)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2_ref() const& { + return {this->__fbthrift_field_map_map_2, __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2_ref() const&& { + return {static_cast(this->__fbthrift_field_map_map_2), __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2_ref() & { + return {this->__fbthrift_field_map_map_2, __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2_ref() && { + return {static_cast(this->__fbthrift_field_map_map_2), __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2() const& { + return {this->__fbthrift_field_map_map_2, __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2() const&& { + return {static_cast(this->__fbthrift_field_map_map_2), __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2() & { + return {this->__fbthrift_field_map_map_2, __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "map_map_2" } */ + template >> + FOLLY_ERASE ::apache::thrift::field_ref map_map_2() && { + return {static_cast(this->__fbthrift_field_map_map_2), __isset.at(17), __isset.bit(17)}; + } + + /** Glean { "field": "struct_list" } */ + [[deprecated("Use `FOO.struct_list().value();` instead of `FOO.get_struct_list();`")]] + const ::std::vector<::cpp2::MyStruct>& get_struct_list() const&; + + /** Glean { "field": "struct_list" } */ + [[deprecated("Use `FOO.struct_list().value();` instead of `FOO.get_struct_list();`")]] + ::std::vector<::cpp2::MyStruct> get_struct_list() &&; + + /** Glean { "field": "struct_list" } */ + template > + [[deprecated("Use `FOO.struct_list() = BAR;` instead of `FOO.set_struct_list(BAR);`")]] + ::std::vector<::cpp2::MyStruct>& set_struct_list(T_Containers_struct_list_struct_setter&& struct_list_) { + struct_list_ref() = std::forward(struct_list_); + return __fbthrift_field_struct_list; + } + + /** Glean { "field": "union_list" } */ + [[deprecated("Use `FOO.union_list().value();` instead of `FOO.get_union_list();`")]] + const ::std::vector<::cpp2::MyUnion>& get_union_list() const&; + + /** Glean { "field": "union_list" } */ + [[deprecated("Use `FOO.union_list().value();` instead of `FOO.get_union_list();`")]] + ::std::vector<::cpp2::MyUnion> get_union_list() &&; + + /** Glean { "field": "union_list" } */ + template > + [[deprecated("Use `FOO.union_list() = BAR;` instead of `FOO.set_union_list(BAR);`")]] + ::std::vector<::cpp2::MyUnion>& set_union_list(T_Containers_union_list_struct_setter&& union_list_) { + union_list_ref() = std::forward(union_list_); + return __fbthrift_field_union_list; + } + + /** Glean { "field": "enum_list" } */ + [[deprecated("Use `FOO.enum_list().value();` instead of `FOO.get_enum_list();`")]] + const ::std::vector<::cpp2::MyEnum>& get_enum_list() const&; + + /** Glean { "field": "enum_list" } */ + [[deprecated("Use `FOO.enum_list().value();` instead of `FOO.get_enum_list();`")]] + ::std::vector<::cpp2::MyEnum> get_enum_list() &&; + + /** Glean { "field": "enum_list" } */ + template > + [[deprecated("Use `FOO.enum_list() = BAR;` instead of `FOO.set_enum_list(BAR);`")]] + ::std::vector<::cpp2::MyEnum>& set_enum_list(T_Containers_enum_list_struct_setter&& enum_list_) { + enum_list_ref() = std::forward(enum_list_); + return __fbthrift_field_enum_list; + } + + /** Glean { "field": "struct_set" } */ + [[deprecated("Use `FOO.struct_set().value();` instead of `FOO.get_struct_set();`")]] + const ::std::set<::cpp2::MyStruct>& get_struct_set() const&; + + /** Glean { "field": "struct_set" } */ + [[deprecated("Use `FOO.struct_set().value();` instead of `FOO.get_struct_set();`")]] + ::std::set<::cpp2::MyStruct> get_struct_set() &&; + + /** Glean { "field": "struct_set" } */ + template > + [[deprecated("Use `FOO.struct_set() = BAR;` instead of `FOO.set_struct_set(BAR);`")]] + ::std::set<::cpp2::MyStruct>& set_struct_set(T_Containers_struct_set_struct_setter&& struct_set_) { + struct_set_ref() = std::forward(struct_set_); + return __fbthrift_field_struct_set; + } + + /** Glean { "field": "union_set" } */ + [[deprecated("Use `FOO.union_set().value();` instead of `FOO.get_union_set();`")]] + const ::std::set<::cpp2::MyUnion>& get_union_set() const&; + + /** Glean { "field": "union_set" } */ + [[deprecated("Use `FOO.union_set().value();` instead of `FOO.get_union_set();`")]] + ::std::set<::cpp2::MyUnion> get_union_set() &&; + + /** Glean { "field": "union_set" } */ + template > + [[deprecated("Use `FOO.union_set() = BAR;` instead of `FOO.set_union_set(BAR);`")]] + ::std::set<::cpp2::MyUnion>& set_union_set(T_Containers_union_set_struct_setter&& union_set_) { + union_set_ref() = std::forward(union_set_); + return __fbthrift_field_union_set; + } + + /** Glean { "field": "enum_set" } */ + [[deprecated("Use `FOO.enum_set().value();` instead of `FOO.get_enum_set();`")]] + const ::std::set<::cpp2::MyEnum>& get_enum_set() const&; + + /** Glean { "field": "enum_set" } */ + [[deprecated("Use `FOO.enum_set().value();` instead of `FOO.get_enum_set();`")]] + ::std::set<::cpp2::MyEnum> get_enum_set() &&; + + /** Glean { "field": "enum_set" } */ + template > + [[deprecated("Use `FOO.enum_set() = BAR;` instead of `FOO.set_enum_set(BAR);`")]] + ::std::set<::cpp2::MyEnum>& set_enum_set(T_Containers_enum_set_struct_setter&& enum_set_) { + enum_set_ref() = std::forward(enum_set_); + return __fbthrift_field_enum_set; + } + + /** Glean { "field": "struct_map" } */ + [[deprecated("Use `FOO.struct_map().value();` instead of `FOO.get_struct_map();`")]] + const ::std::map<::cpp2::MyStruct, ::std::int64_t>& get_struct_map() const&; + + /** Glean { "field": "struct_map" } */ + [[deprecated("Use `FOO.struct_map().value();` instead of `FOO.get_struct_map();`")]] + ::std::map<::cpp2::MyStruct, ::std::int64_t> get_struct_map() &&; + + /** Glean { "field": "struct_map" } */ + template > + [[deprecated("Use `FOO.struct_map() = BAR;` instead of `FOO.set_struct_map(BAR);`")]] + ::std::map<::cpp2::MyStruct, ::std::int64_t>& set_struct_map(T_Containers_struct_map_struct_setter&& struct_map_) { + struct_map_ref() = std::forward(struct_map_); + return __fbthrift_field_struct_map; + } + + /** Glean { "field": "union_map" } */ + [[deprecated("Use `FOO.union_map().value();` instead of `FOO.get_union_map();`")]] + const ::std::map<::cpp2::MyUnion, ::std::int64_t>& get_union_map() const&; + + /** Glean { "field": "union_map" } */ + [[deprecated("Use `FOO.union_map().value();` instead of `FOO.get_union_map();`")]] + ::std::map<::cpp2::MyUnion, ::std::int64_t> get_union_map() &&; + + /** Glean { "field": "union_map" } */ + template > + [[deprecated("Use `FOO.union_map() = BAR;` instead of `FOO.set_union_map(BAR);`")]] + ::std::map<::cpp2::MyUnion, ::std::int64_t>& set_union_map(T_Containers_union_map_struct_setter&& union_map_) { + union_map_ref() = std::forward(union_map_); + return __fbthrift_field_union_map; + } + + /** Glean { "field": "enum_map" } */ + [[deprecated("Use `FOO.enum_map().value();` instead of `FOO.get_enum_map();`")]] + const ::std::map<::cpp2::MyEnum, ::std::int64_t>& get_enum_map() const&; + + /** Glean { "field": "enum_map" } */ + [[deprecated("Use `FOO.enum_map().value();` instead of `FOO.get_enum_map();`")]] + ::std::map<::cpp2::MyEnum, ::std::int64_t> get_enum_map() &&; + + /** Glean { "field": "enum_map" } */ + template > + [[deprecated("Use `FOO.enum_map() = BAR;` instead of `FOO.set_enum_map(BAR);`")]] + ::std::map<::cpp2::MyEnum, ::std::int64_t>& set_enum_map(T_Containers_enum_map_struct_setter&& enum_map_) { + enum_map_ref() = std::forward(enum_map_); + return __fbthrift_field_enum_map; + } + + /** Glean { "field": "struct_map_2" } */ + [[deprecated("Use `FOO.struct_map_2().value();` instead of `FOO.get_struct_map_2();`")]] + const ::std::map<::std::int32_t, ::cpp2::MyStruct>& get_struct_map_2() const&; + + /** Glean { "field": "struct_map_2" } */ + [[deprecated("Use `FOO.struct_map_2().value();` instead of `FOO.get_struct_map_2();`")]] + ::std::map<::std::int32_t, ::cpp2::MyStruct> get_struct_map_2() &&; + + /** Glean { "field": "struct_map_2" } */ + template > + [[deprecated("Use `FOO.struct_map_2() = BAR;` instead of `FOO.set_struct_map_2(BAR);`")]] + ::std::map<::std::int32_t, ::cpp2::MyStruct>& set_struct_map_2(T_Containers_struct_map_2_struct_setter&& struct_map_2_) { + struct_map_2_ref() = std::forward(struct_map_2_); + return __fbthrift_field_struct_map_2; + } + + /** Glean { "field": "union_map_2" } */ + [[deprecated("Use `FOO.union_map_2().value();` instead of `FOO.get_union_map_2();`")]] + const ::std::map<::std::int32_t, ::cpp2::MyUnion>& get_union_map_2() const&; + + /** Glean { "field": "union_map_2" } */ + [[deprecated("Use `FOO.union_map_2().value();` instead of `FOO.get_union_map_2();`")]] + ::std::map<::std::int32_t, ::cpp2::MyUnion> get_union_map_2() &&; + + /** Glean { "field": "union_map_2" } */ + template > + [[deprecated("Use `FOO.union_map_2() = BAR;` instead of `FOO.set_union_map_2(BAR);`")]] + ::std::map<::std::int32_t, ::cpp2::MyUnion>& set_union_map_2(T_Containers_union_map_2_struct_setter&& union_map_2_) { + union_map_2_ref() = std::forward(union_map_2_); + return __fbthrift_field_union_map_2; + } + + /** Glean { "field": "enum_map_2" } */ + [[deprecated("Use `FOO.enum_map_2().value();` instead of `FOO.get_enum_map_2();`")]] + const ::std::map<::std::int32_t, ::cpp2::MyEnum>& get_enum_map_2() const&; + + /** Glean { "field": "enum_map_2" } */ + [[deprecated("Use `FOO.enum_map_2().value();` instead of `FOO.get_enum_map_2();`")]] + ::std::map<::std::int32_t, ::cpp2::MyEnum> get_enum_map_2() &&; + + /** Glean { "field": "enum_map_2" } */ + template > + [[deprecated("Use `FOO.enum_map_2() = BAR;` instead of `FOO.set_enum_map_2(BAR);`")]] + ::std::map<::std::int32_t, ::cpp2::MyEnum>& set_enum_map_2(T_Containers_enum_map_2_struct_setter&& enum_map_2_) { + enum_map_2_ref() = std::forward(enum_map_2_); + return __fbthrift_field_enum_map_2; + } + + /** Glean { "field": "list_map" } */ + [[deprecated("Use `FOO.list_map().value();` instead of `FOO.get_list_map();`")]] + const ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>& get_list_map() const&; + + /** Glean { "field": "list_map" } */ + [[deprecated("Use `FOO.list_map().value();` instead of `FOO.get_list_map();`")]] + ::std::map<::std::vector<::std::int32_t>, ::std::int32_t> get_list_map() &&; + + /** Glean { "field": "list_map" } */ + template , ::std::int32_t>> + [[deprecated("Use `FOO.list_map() = BAR;` instead of `FOO.set_list_map(BAR);`")]] + ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>& set_list_map(T_Containers_list_map_struct_setter&& list_map_) { + list_map_ref() = std::forward(list_map_); + return __fbthrift_field_list_map; + } + + /** Glean { "field": "list_map_2" } */ + [[deprecated("Use `FOO.list_map_2().value();` instead of `FOO.get_list_map_2();`")]] + const ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>& get_list_map_2() const&; + + /** Glean { "field": "list_map_2" } */ + [[deprecated("Use `FOO.list_map_2().value();` instead of `FOO.get_list_map_2();`")]] + ::std::map<::std::int32_t, ::std::vector<::std::int32_t>> get_list_map_2() &&; + + /** Glean { "field": "list_map_2" } */ + template >> + [[deprecated("Use `FOO.list_map_2() = BAR;` instead of `FOO.set_list_map_2(BAR);`")]] + ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>& set_list_map_2(T_Containers_list_map_2_struct_setter&& list_map_2_) { + list_map_2_ref() = std::forward(list_map_2_); + return __fbthrift_field_list_map_2; + } + + /** Glean { "field": "set_map" } */ + [[deprecated("Use `FOO.set_map().value();` instead of `FOO.get_set_map();`")]] + const ::std::map<::std::set<::std::int32_t>, ::std::int32_t>& get_set_map() const&; + + /** Glean { "field": "set_map" } */ + [[deprecated("Use `FOO.set_map().value();` instead of `FOO.get_set_map();`")]] + ::std::map<::std::set<::std::int32_t>, ::std::int32_t> get_set_map() &&; + + /** Glean { "field": "set_map" } */ + template , ::std::int32_t>> + [[deprecated("Use `FOO.set_map() = BAR;` instead of `FOO.set_set_map(BAR);`")]] + ::std::map<::std::set<::std::int32_t>, ::std::int32_t>& set_set_map(T_Containers_set_map_struct_setter&& set_map_) { + set_map_ref() = std::forward(set_map_); + return __fbthrift_field_set_map; + } + + /** Glean { "field": "set_map_2" } */ + [[deprecated("Use `FOO.set_map_2().value();` instead of `FOO.get_set_map_2();`")]] + const ::std::map<::std::int32_t, ::std::set<::std::int32_t>>& get_set_map_2() const&; + + /** Glean { "field": "set_map_2" } */ + [[deprecated("Use `FOO.set_map_2().value();` instead of `FOO.get_set_map_2();`")]] + ::std::map<::std::int32_t, ::std::set<::std::int32_t>> get_set_map_2() &&; + + /** Glean { "field": "set_map_2" } */ + template >> + [[deprecated("Use `FOO.set_map_2() = BAR;` instead of `FOO.set_set_map_2(BAR);`")]] + ::std::map<::std::int32_t, ::std::set<::std::int32_t>>& set_set_map_2(T_Containers_set_map_2_struct_setter&& set_map_2_) { + set_map_2_ref() = std::forward(set_map_2_); + return __fbthrift_field_set_map_2; + } + + /** Glean { "field": "map_map" } */ + [[deprecated("Use `FOO.map_map().value();` instead of `FOO.get_map_map();`")]] + const ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>& get_map_map() const&; + + /** Glean { "field": "map_map" } */ + [[deprecated("Use `FOO.map_map().value();` instead of `FOO.get_map_map();`")]] + ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t> get_map_map() &&; + + /** Glean { "field": "map_map" } */ + template , ::std::int32_t>> + [[deprecated("Use `FOO.map_map() = BAR;` instead of `FOO.set_map_map(BAR);`")]] + ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>& set_map_map(T_Containers_map_map_struct_setter&& map_map_) { + map_map_ref() = std::forward(map_map_); + return __fbthrift_field_map_map; + } + + /** Glean { "field": "map_map_2" } */ + [[deprecated("Use `FOO.map_map_2().value();` instead of `FOO.get_map_map_2();`")]] + const ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>& get_map_map_2() const&; + + /** Glean { "field": "map_map_2" } */ + [[deprecated("Use `FOO.map_map_2().value();` instead of `FOO.get_map_map_2();`")]] + ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>> get_map_map_2() &&; + + /** Glean { "field": "map_map_2" } */ + template >> + [[deprecated("Use `FOO.map_map_2() = BAR;` instead of `FOO.set_map_map_2(BAR);`")]] + ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>& set_map_map_2(T_Containers_map_map_2_struct_setter&& map_map_2_) { + map_map_2_ref() = std::forward(map_map_2_); + return __fbthrift_field_map_map_2; + } + + template + unsigned long read(Protocol_* iprot); + template + uint32_t serializedSize(Protocol_ const* prot_) const; + template + uint32_t serializedSizeZC(Protocol_ const* prot_) const; + template + uint32_t write(Protocol_* prot_) const; + + private: + template + void readNoXfer(Protocol_* iprot); + + friend class ::apache::thrift::Cpp2Ops; + friend void swap(Containers& a, Containers& b); +}; + +template +unsigned long Containers::read(Protocol_* iprot) { + auto _xferStart = iprot->getCursorPosition(); + readNoXfer(iprot); + return iprot->getCursorPosition() - _xferStart; +} + + } // namespace cpp2 namespace apache { namespace thrift { diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.tcc b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.tcc index 3a02953828b..121ba39f357 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.tcc +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types.tcc @@ -120,6 +120,13 @@ struct TccStructTraits<::cpp2::complexException> { int16_t& fid, apache::thrift::protocol::TType& _ftype) noexcept; }; +template <> +struct TccStructTraits<::cpp2::Containers> { + static void translateFieldName( + std::string_view _fname, + int16_t& fid, + apache::thrift::protocol::TType& _ftype) noexcept; +}; } // namespace detail } // namespace thrift @@ -5409,4 +5416,789 @@ extern template uint32_t complexException::serializedSize<>(apache::thrift::Comp extern template uint32_t complexException::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const; +template +void Containers::readNoXfer(Protocol_* iprot) { + __fbthrift_clear_terse_fields(); + + apache::thrift::detail::ProtocolReaderStructReadState _readState; + + _readState.readStructBegin(iprot); + + using apache::thrift::TProtocolException; + + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 0, + 1, + apache::thrift::protocol::T_LIST))) { + goto _advance_failure; + } +_readField_struct_list: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_struct_list = ::std::vector<::cpp2::MyStruct>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::structure>, ::std::vector<::cpp2::MyStruct>>::readWithContext(*iprot, this->__fbthrift_field_struct_list, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(0, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 1, + 2, + apache::thrift::protocol::T_LIST))) { + goto _advance_failure; + } +_readField_union_list: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_union_list = ::std::vector<::cpp2::MyUnion>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::variant>, ::std::vector<::cpp2::MyUnion>>::readWithContext(*iprot, this->__fbthrift_field_union_list, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(1, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 2, + 3, + apache::thrift::protocol::T_LIST))) { + goto _advance_failure; + } +_readField_enum_list: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_enum_list = ::std::vector<::cpp2::MyEnum>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::enumeration>, ::std::vector<::cpp2::MyEnum>>::readWithContext(*iprot, this->__fbthrift_field_enum_list, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(2, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 3, + 4, + apache::thrift::protocol::T_SET))) { + goto _advance_failure; + } +_readField_struct_set: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_struct_set = ::std::set<::cpp2::MyStruct>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::structure>, ::std::set<::cpp2::MyStruct>>::readWithContext(*iprot, this->__fbthrift_field_struct_set, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(3, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 4, + 5, + apache::thrift::protocol::T_SET))) { + goto _advance_failure; + } +_readField_union_set: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_union_set = ::std::set<::cpp2::MyUnion>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::variant>, ::std::set<::cpp2::MyUnion>>::readWithContext(*iprot, this->__fbthrift_field_union_set, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(4, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 5, + 6, + apache::thrift::protocol::T_SET))) { + goto _advance_failure; + } +_readField_enum_set: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_enum_set = ::std::set<::cpp2::MyEnum>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::enumeration>, ::std::set<::cpp2::MyEnum>>::readWithContext(*iprot, this->__fbthrift_field_enum_set, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(5, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 6, + 7, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_struct_map: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_struct_map = ::std::map<::cpp2::MyStruct, ::std::int64_t>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::structure, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyStruct, ::std::int64_t>>::readWithContext(*iprot, this->__fbthrift_field_struct_map, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(6, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 7, + 8, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_union_map: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_union_map = ::std::map<::cpp2::MyUnion, ::std::int64_t>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::variant, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyUnion, ::std::int64_t>>::readWithContext(*iprot, this->__fbthrift_field_union_map, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(7, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 8, + 9, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_enum_map: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_enum_map = ::std::map<::cpp2::MyEnum, ::std::int64_t>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::enumeration, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyEnum, ::std::int64_t>>::readWithContext(*iprot, this->__fbthrift_field_enum_map, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(8, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 9, + 10, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_struct_map_2: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_struct_map_2 = ::std::map<::std::int32_t, ::cpp2::MyStruct>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::structure>, ::std::map<::std::int32_t, ::cpp2::MyStruct>>::readWithContext(*iprot, this->__fbthrift_field_struct_map_2, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(9, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 10, + 11, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_union_map_2: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_union_map_2 = ::std::map<::std::int32_t, ::cpp2::MyUnion>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::std::map<::std::int32_t, ::cpp2::MyUnion>>::readWithContext(*iprot, this->__fbthrift_field_union_map_2, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(10, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 11, + 12, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_enum_map_2: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_enum_map_2 = ::std::map<::std::int32_t, ::cpp2::MyEnum>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::enumeration>, ::std::map<::std::int32_t, ::cpp2::MyEnum>>::readWithContext(*iprot, this->__fbthrift_field_enum_map_2, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(11, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 12, + 13, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_list_map: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_list_map = ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_list_map, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(12, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 13, + 14, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_list_map_2: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_list_map_2 = ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::list<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>>::readWithContext(*iprot, this->__fbthrift_field_list_map_2, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(13, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 14, + 15, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_set_map: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_set_map = ::std::map<::std::set<::std::int32_t>, ::std::int32_t>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::set<::std::int32_t>, ::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_set_map, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(14, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 15, + 16, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_set_map_2: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_set_map_2 = ::std::map<::std::int32_t, ::std::set<::std::int32_t>>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::set<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::set<::std::int32_t>>>::readWithContext(*iprot, this->__fbthrift_field_set_map_2, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(15, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 16, + 17, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_map_map: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_map_map = ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>>::readWithContext(*iprot, this->__fbthrift_field_map_map, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(16, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 17, + 18, + apache::thrift::protocol::T_MAP))) { + goto _advance_failure; + } +_readField_map_map_2: + { + _readState.beforeSubobject(iprot); + this->__fbthrift_field_map_map_2 = ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>(); + ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>>::readWithContext(*iprot, this->__fbthrift_field_map_map_2, _readState); + _readState.afterSubobject(iprot); + } + this->__isset.set(17, true); + + if (UNLIKELY(!_readState.advanceToNextField( + iprot, + 18, + 0, + apache::thrift::protocol::T_STOP))) { + goto _advance_failure; + } + +_end: + _readState.readStructEnd(iprot); + + return; + + goto _advance_failure; // Avoid compiler warnings about unused labels. + _advance_failure: + _readState.afterAdvanceFailure(iprot); +_loop: + if (_readState.atStop()) { + goto _end; + } + if (iprot->kUsesFieldNames()) { + _readState.template fillFieldTraitsFromName>(); + } + + switch (_readState.fieldId) { + case 1: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_LIST))) { + goto _readField_struct_list; + } else { + goto _skip; + } + } + case 2: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_LIST))) { + goto _readField_union_list; + } else { + goto _skip; + } + } + case 3: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_LIST))) { + goto _readField_enum_list; + } else { + goto _skip; + } + } + case 4: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_SET))) { + goto _readField_struct_set; + } else { + goto _skip; + } + } + case 5: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_SET))) { + goto _readField_union_set; + } else { + goto _skip; + } + } + case 6: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_SET))) { + goto _readField_enum_set; + } else { + goto _skip; + } + } + case 7: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_struct_map; + } else { + goto _skip; + } + } + case 8: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_union_map; + } else { + goto _skip; + } + } + case 9: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_enum_map; + } else { + goto _skip; + } + } + case 10: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_struct_map_2; + } else { + goto _skip; + } + } + case 11: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_union_map_2; + } else { + goto _skip; + } + } + case 12: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_enum_map_2; + } else { + goto _skip; + } + } + case 13: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_list_map; + } else { + goto _skip; + } + } + case 14: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_list_map_2; + } else { + goto _skip; + } + } + case 15: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_set_map; + } else { + goto _skip; + } + } + case 16: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_set_map_2; + } else { + goto _skip; + } + } + case 17: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_map_map; + } else { + goto _skip; + } + } + case 18: + { + if (LIKELY(_readState.isCompatibleWithType(iprot, apache::thrift::protocol::T_MAP))) { + goto _readField_map_map_2; + } else { + goto _skip; + } + } + default: + { +_skip: + _readState.skip(iprot); + _readState.readFieldEnd(iprot); + _readState.readFieldBeginNoInline(iprot); + goto _loop; + } + } +} + +template +uint32_t Containers::serializedSize(Protocol_ const* prot_) const { + uint32_t xfer = 0; + xfer += prot_->serializedStructSize("Containers"); + { + xfer += prot_->serializedFieldSize("struct_list", apache::thrift::protocol::T_LIST, 1); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::structure>, ::std::vector<::cpp2::MyStruct>>::serializedSize(*prot_, this->__fbthrift_field_struct_list); + } + { + xfer += prot_->serializedFieldSize("union_list", apache::thrift::protocol::T_LIST, 2); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::variant>, ::std::vector<::cpp2::MyUnion>>::serializedSize(*prot_, this->__fbthrift_field_union_list); + } + { + xfer += prot_->serializedFieldSize("enum_list", apache::thrift::protocol::T_LIST, 3); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::enumeration>, ::std::vector<::cpp2::MyEnum>>::serializedSize(*prot_, this->__fbthrift_field_enum_list); + } + { + xfer += prot_->serializedFieldSize("struct_set", apache::thrift::protocol::T_SET, 4); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::structure>, ::std::set<::cpp2::MyStruct>>::serializedSize(*prot_, this->__fbthrift_field_struct_set); + } + { + xfer += prot_->serializedFieldSize("union_set", apache::thrift::protocol::T_SET, 5); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::variant>, ::std::set<::cpp2::MyUnion>>::serializedSize(*prot_, this->__fbthrift_field_union_set); + } + { + xfer += prot_->serializedFieldSize("enum_set", apache::thrift::protocol::T_SET, 6); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::enumeration>, ::std::set<::cpp2::MyEnum>>::serializedSize(*prot_, this->__fbthrift_field_enum_set); + } + { + xfer += prot_->serializedFieldSize("struct_map", apache::thrift::protocol::T_MAP, 7); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::structure, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyStruct, ::std::int64_t>>::serializedSize(*prot_, this->__fbthrift_field_struct_map); + } + { + xfer += prot_->serializedFieldSize("union_map", apache::thrift::protocol::T_MAP, 8); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::variant, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyUnion, ::std::int64_t>>::serializedSize(*prot_, this->__fbthrift_field_union_map); + } + { + xfer += prot_->serializedFieldSize("enum_map", apache::thrift::protocol::T_MAP, 9); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::enumeration, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyEnum, ::std::int64_t>>::serializedSize(*prot_, this->__fbthrift_field_enum_map); + } + { + xfer += prot_->serializedFieldSize("struct_map_2", apache::thrift::protocol::T_MAP, 10); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::structure>, ::std::map<::std::int32_t, ::cpp2::MyStruct>>::serializedSize(*prot_, this->__fbthrift_field_struct_map_2); + } + { + xfer += prot_->serializedFieldSize("union_map_2", apache::thrift::protocol::T_MAP, 11); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::std::map<::std::int32_t, ::cpp2::MyUnion>>::serializedSize(*prot_, this->__fbthrift_field_union_map_2); + } + { + xfer += prot_->serializedFieldSize("enum_map_2", apache::thrift::protocol::T_MAP, 12); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::enumeration>, ::std::map<::std::int32_t, ::cpp2::MyEnum>>::serializedSize(*prot_, this->__fbthrift_field_enum_map_2); + } + { + xfer += prot_->serializedFieldSize("list_map", apache::thrift::protocol::T_MAP, 13); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_list_map); + } + { + xfer += prot_->serializedFieldSize("list_map_2", apache::thrift::protocol::T_MAP, 14); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::list<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>>::serializedSize(*prot_, this->__fbthrift_field_list_map_2); + } + { + xfer += prot_->serializedFieldSize("set_map", apache::thrift::protocol::T_MAP, 15); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::set<::std::int32_t>, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_set_map); + } + { + xfer += prot_->serializedFieldSize("set_map_2", apache::thrift::protocol::T_MAP, 16); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::set<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::set<::std::int32_t>>>::serializedSize(*prot_, this->__fbthrift_field_set_map_2); + } + { + xfer += prot_->serializedFieldSize("map_map", apache::thrift::protocol::T_MAP, 17); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_map_map); + } + { + xfer += prot_->serializedFieldSize("map_map_2", apache::thrift::protocol::T_MAP, 18); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>>::serializedSize(*prot_, this->__fbthrift_field_map_map_2); + } + xfer += prot_->serializedSizeStop(); + return xfer; +} + +template +uint32_t Containers::serializedSizeZC(Protocol_ const* prot_) const { + uint32_t xfer = 0; + xfer += prot_->serializedStructSize("Containers"); + { + xfer += prot_->serializedFieldSize("struct_list", apache::thrift::protocol::T_LIST, 1); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::structure>, ::std::vector<::cpp2::MyStruct>>::serializedSize(*prot_, this->__fbthrift_field_struct_list); + } + { + xfer += prot_->serializedFieldSize("union_list", apache::thrift::protocol::T_LIST, 2); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::variant>, ::std::vector<::cpp2::MyUnion>>::serializedSize(*prot_, this->__fbthrift_field_union_list); + } + { + xfer += prot_->serializedFieldSize("enum_list", apache::thrift::protocol::T_LIST, 3); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::enumeration>, ::std::vector<::cpp2::MyEnum>>::serializedSize(*prot_, this->__fbthrift_field_enum_list); + } + { + xfer += prot_->serializedFieldSize("struct_set", apache::thrift::protocol::T_SET, 4); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::structure>, ::std::set<::cpp2::MyStruct>>::serializedSize(*prot_, this->__fbthrift_field_struct_set); + } + { + xfer += prot_->serializedFieldSize("union_set", apache::thrift::protocol::T_SET, 5); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::variant>, ::std::set<::cpp2::MyUnion>>::serializedSize(*prot_, this->__fbthrift_field_union_set); + } + { + xfer += prot_->serializedFieldSize("enum_set", apache::thrift::protocol::T_SET, 6); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::enumeration>, ::std::set<::cpp2::MyEnum>>::serializedSize(*prot_, this->__fbthrift_field_enum_set); + } + { + xfer += prot_->serializedFieldSize("struct_map", apache::thrift::protocol::T_MAP, 7); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::structure, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyStruct, ::std::int64_t>>::serializedSize(*prot_, this->__fbthrift_field_struct_map); + } + { + xfer += prot_->serializedFieldSize("union_map", apache::thrift::protocol::T_MAP, 8); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::variant, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyUnion, ::std::int64_t>>::serializedSize(*prot_, this->__fbthrift_field_union_map); + } + { + xfer += prot_->serializedFieldSize("enum_map", apache::thrift::protocol::T_MAP, 9); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::enumeration, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyEnum, ::std::int64_t>>::serializedSize(*prot_, this->__fbthrift_field_enum_map); + } + { + xfer += prot_->serializedFieldSize("struct_map_2", apache::thrift::protocol::T_MAP, 10); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::structure>, ::std::map<::std::int32_t, ::cpp2::MyStruct>>::serializedSize(*prot_, this->__fbthrift_field_struct_map_2); + } + { + xfer += prot_->serializedFieldSize("union_map_2", apache::thrift::protocol::T_MAP, 11); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::std::map<::std::int32_t, ::cpp2::MyUnion>>::serializedSize(*prot_, this->__fbthrift_field_union_map_2); + } + { + xfer += prot_->serializedFieldSize("enum_map_2", apache::thrift::protocol::T_MAP, 12); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::enumeration>, ::std::map<::std::int32_t, ::cpp2::MyEnum>>::serializedSize(*prot_, this->__fbthrift_field_enum_map_2); + } + { + xfer += prot_->serializedFieldSize("list_map", apache::thrift::protocol::T_MAP, 13); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_list_map); + } + { + xfer += prot_->serializedFieldSize("list_map_2", apache::thrift::protocol::T_MAP, 14); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::list<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>>::serializedSize(*prot_, this->__fbthrift_field_list_map_2); + } + { + xfer += prot_->serializedFieldSize("set_map", apache::thrift::protocol::T_MAP, 15); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::set<::std::int32_t>, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_set_map); + } + { + xfer += prot_->serializedFieldSize("set_map_2", apache::thrift::protocol::T_MAP, 16); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::set<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::set<::std::int32_t>>>::serializedSize(*prot_, this->__fbthrift_field_set_map_2); + } + { + xfer += prot_->serializedFieldSize("map_map", apache::thrift::protocol::T_MAP, 17); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>>::serializedSize(*prot_, this->__fbthrift_field_map_map); + } + { + xfer += prot_->serializedFieldSize("map_map_2", apache::thrift::protocol::T_MAP, 18); + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>>::serializedSize(*prot_, this->__fbthrift_field_map_map_2); + } + xfer += prot_->serializedSizeStop(); + return xfer; +} + +template +uint32_t Containers::write(Protocol_* prot_) const { + uint32_t xfer = 0; + xfer += prot_->writeStructBegin("Containers"); + bool previousFieldHasValue = true; + { + constexpr int16_t kPrevFieldId = 0; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "struct_list", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::structure>, ::std::vector<::cpp2::MyStruct>>::write(*prot_, this->__fbthrift_field_struct_list); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 1; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "union_list", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::variant>, ::std::vector<::cpp2::MyUnion>>::write(*prot_, this->__fbthrift_field_union_list); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 2; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "enum_list", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::list<::apache::thrift::type_class::enumeration>, ::std::vector<::cpp2::MyEnum>>::write(*prot_, this->__fbthrift_field_enum_list); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 3; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "struct_set", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::structure>, ::std::set<::cpp2::MyStruct>>::write(*prot_, this->__fbthrift_field_struct_set); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 4; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "union_set", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::variant>, ::std::set<::cpp2::MyUnion>>::write(*prot_, this->__fbthrift_field_union_set); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 5; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "enum_set", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::set<::apache::thrift::type_class::enumeration>, ::std::set<::cpp2::MyEnum>>::write(*prot_, this->__fbthrift_field_enum_set); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 6; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "struct_map", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::structure, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyStruct, ::std::int64_t>>::write(*prot_, this->__fbthrift_field_struct_map); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 7; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "union_map", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::variant, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyUnion, ::std::int64_t>>::write(*prot_, this->__fbthrift_field_union_map); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 8; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "enum_map", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::enumeration, ::apache::thrift::type_class::integral>, ::std::map<::cpp2::MyEnum, ::std::int64_t>>::write(*prot_, this->__fbthrift_field_enum_map); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 9; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "struct_map_2", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::structure>, ::std::map<::std::int32_t, ::cpp2::MyStruct>>::write(*prot_, this->__fbthrift_field_struct_map_2); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 10; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "union_map_2", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::variant>, ::std::map<::std::int32_t, ::cpp2::MyUnion>>::write(*prot_, this->__fbthrift_field_union_map_2); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 11; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "enum_map_2", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::enumeration>, ::std::map<::std::int32_t, ::cpp2::MyEnum>>::write(*prot_, this->__fbthrift_field_enum_map_2); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 12; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "list_map", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::list<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::vector<::std::int32_t>, ::std::int32_t>>::write(*prot_, this->__fbthrift_field_list_map); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 13; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "list_map_2", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::list<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::vector<::std::int32_t>>>::write(*prot_, this->__fbthrift_field_list_map_2); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 14; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "set_map", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::set<::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::set<::std::int32_t>, ::std::int32_t>>::write(*prot_, this->__fbthrift_field_set_map); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 15; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "set_map_2", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::set<::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::set<::std::int32_t>>>::write(*prot_, this->__fbthrift_field_set_map_2); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 16; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "map_map", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>, ::apache::thrift::type_class::integral>, ::std::map<::std::map<::std::int32_t, ::std::int32_t>, ::std::int32_t>>::write(*prot_, this->__fbthrift_field_map_map); + xfer += prot_->writeFieldEnd(); + } + { + constexpr int16_t kPrevFieldId = 17; + xfer += ::apache::thrift::detail::writeFieldBegin(*prot_, "map_map_2", previousFieldHasValue); + previousFieldHasValue = true; + xfer += ::apache::thrift::detail::pm::protocol_methods<::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::map<::apache::thrift::type_class::integral, ::apache::thrift::type_class::integral>>, ::std::map<::std::int32_t, ::std::map<::std::int32_t, ::std::int32_t>>>::write(*prot_, this->__fbthrift_field_map_map_2); + xfer += prot_->writeFieldEnd(); + } + xfer += prot_->writeFieldStop(); + xfer += prot_->writeStructEnd(); + return xfer; +} + +extern template void Containers::readNoXfer<>(apache::thrift::BinaryProtocolReader*); +extern template uint32_t Containers::write<>(apache::thrift::BinaryProtocolWriter*) const; +extern template uint32_t Containers::serializedSize<>(apache::thrift::BinaryProtocolWriter const*) const; +extern template uint32_t Containers::serializedSizeZC<>(apache::thrift::BinaryProtocolWriter const*) const; +extern template void Containers::readNoXfer<>(apache::thrift::CompactProtocolReader*); +extern template uint32_t Containers::write<>(apache::thrift::CompactProtocolWriter*) const; +extern template uint32_t Containers::serializedSize<>(apache::thrift::CompactProtocolWriter const*) const; +extern template uint32_t Containers::serializedSizeZC<>(apache::thrift::CompactProtocolWriter const*) const; + + } // namespace cpp2 diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types_fwd.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types_fwd.h index 730f0f04c42..ca9aeb4fc4e 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types_fwd.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_types_fwd.h @@ -25,6 +25,7 @@ class emptyXcep; class reqXcep; class optXcep; class complexException; +class Containers; } // namespace cpp2 // END forward_declare diff --git a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h index cbb93c9c6da..f5d004a1ffe 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/cpp2/gen-cpp2/module_visit_by_thrift_field_metadata.h @@ -395,6 +395,53 @@ struct VisitByFieldId<::cpp2::complexException> { } } }; + +template <> +struct VisitByFieldId<::cpp2::Containers> { + template + void operator()([[maybe_unused]] F&& f, int32_t fieldId, [[maybe_unused]] T&& t) const { + switch (fieldId) { + case 1: + return f(0, static_cast(t).struct_list_ref()); + case 2: + return f(1, static_cast(t).union_list_ref()); + case 3: + return f(2, static_cast(t).enum_list_ref()); + case 4: + return f(3, static_cast(t).struct_set_ref()); + case 5: + return f(4, static_cast(t).union_set_ref()); + case 6: + return f(5, static_cast(t).enum_set_ref()); + case 7: + return f(6, static_cast(t).struct_map_ref()); + case 8: + return f(7, static_cast(t).union_map_ref()); + case 9: + return f(8, static_cast(t).enum_map_ref()); + case 10: + return f(9, static_cast(t).struct_map_2_ref()); + case 11: + return f(10, static_cast(t).union_map_2_ref()); + case 12: + return f(11, static_cast(t).enum_map_2_ref()); + case 13: + return f(12, static_cast(t).list_map_ref()); + case 14: + return f(13, static_cast(t).list_map_2_ref()); + case 15: + return f(14, static_cast(t).set_map_ref()); + case 16: + return f(15, static_cast(t).set_map_2_ref()); + case 17: + return f(16, static_cast(t).map_map_ref()); + case 18: + return f(17, static_cast(t).map_map_2_ref()); + default: + throwInvalidThriftId(fieldId, "::cpp2::Containers"); + } + } +}; } // namespace detail } // namespace thrift } // namespace apache diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/Containers.java b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/Containers.java new file mode 100644 index 00000000000..d1cfe43ad13 --- /dev/null +++ b/thrift/compiler/test/fixtures/complex-struct/out/java/gen-java/test/fixtures/complex_struct/Containers.java @@ -0,0 +1,1261 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + +package test.fixtures.complex_struct; + +import com.facebook.swift.codec.*; +import com.facebook.swift.codec.ThriftField.Requiredness; +import com.facebook.swift.codec.ThriftField.Recursiveness; +import com.google.common.collect.*; +import java.util.*; +import javax.annotation.Nullable; +import org.apache.thrift.*; +import org.apache.thrift.transport.*; +import org.apache.thrift.protocol.*; +import static com.google.common.base.MoreObjects.toStringHelper; +import static com.google.common.base.MoreObjects.ToStringHelper; + +@SwiftGenerated +@com.facebook.swift.codec.ThriftStruct(value="Containers", builder=Containers.Builder.class) +public final class Containers implements com.facebook.thrift.payload.ThriftSerializable { + @ThriftConstructor + public Containers( + @com.facebook.swift.codec.ThriftField(value=1, name="struct_list", requiredness=Requiredness.NONE) final List structList, + @com.facebook.swift.codec.ThriftField(value=2, name="union_list", requiredness=Requiredness.NONE) final List unionList, + @com.facebook.swift.codec.ThriftField(value=3, name="enum_list", requiredness=Requiredness.NONE) final List enumList, + @com.facebook.swift.codec.ThriftField(value=4, name="struct_set", requiredness=Requiredness.NONE) final Set structSet, + @com.facebook.swift.codec.ThriftField(value=5, name="union_set", requiredness=Requiredness.NONE) final Set unionSet, + @com.facebook.swift.codec.ThriftField(value=6, name="enum_set", requiredness=Requiredness.NONE) final Set enumSet, + @com.facebook.swift.codec.ThriftField(value=7, name="struct_map", requiredness=Requiredness.NONE) final Map structMap, + @com.facebook.swift.codec.ThriftField(value=8, name="union_map", requiredness=Requiredness.NONE) final Map unionMap, + @com.facebook.swift.codec.ThriftField(value=9, name="enum_map", requiredness=Requiredness.NONE) final Map enumMap, + @com.facebook.swift.codec.ThriftField(value=10, name="struct_map_2", requiredness=Requiredness.NONE) final Map structMap2, + @com.facebook.swift.codec.ThriftField(value=11, name="union_map_2", requiredness=Requiredness.NONE) final Map unionMap2, + @com.facebook.swift.codec.ThriftField(value=12, name="enum_map_2", requiredness=Requiredness.NONE) final Map enumMap2, + @com.facebook.swift.codec.ThriftField(value=13, name="list_map", requiredness=Requiredness.NONE) final Map, Integer> listMap, + @com.facebook.swift.codec.ThriftField(value=14, name="list_map_2", requiredness=Requiredness.NONE) final Map> listMap2, + @com.facebook.swift.codec.ThriftField(value=15, name="set_map", requiredness=Requiredness.NONE) final Map, Integer> setMap, + @com.facebook.swift.codec.ThriftField(value=16, name="set_map_2", requiredness=Requiredness.NONE) final Map> setMap2, + @com.facebook.swift.codec.ThriftField(value=17, name="map_map", requiredness=Requiredness.NONE) final Map, Integer> mapMap, + @com.facebook.swift.codec.ThriftField(value=18, name="map_map_2", requiredness=Requiredness.NONE) final Map> mapMap2 + ) { + this.structList = structList; + this.unionList = unionList; + this.enumList = enumList; + this.structSet = structSet; + this.unionSet = unionSet; + this.enumSet = enumSet; + this.structMap = structMap; + this.unionMap = unionMap; + this.enumMap = enumMap; + this.structMap2 = structMap2; + this.unionMap2 = unionMap2; + this.enumMap2 = enumMap2; + this.listMap = listMap; + this.listMap2 = listMap2; + this.setMap = setMap; + this.setMap2 = setMap2; + this.mapMap = mapMap; + this.mapMap2 = mapMap2; + } + + @ThriftConstructor + protected Containers() { + this.structList = null; + this.unionList = null; + this.enumList = null; + this.structSet = null; + this.unionSet = null; + this.enumSet = null; + this.structMap = null; + this.unionMap = null; + this.enumMap = null; + this.structMap2 = null; + this.unionMap2 = null; + this.enumMap2 = null; + this.listMap = null; + this.listMap2 = null; + this.setMap = null; + this.setMap2 = null; + this.mapMap = null; + this.mapMap2 = null; + } + + public static Builder builder() { + return new Builder(); + } + + public static Builder builder(Containers other) { + return new Builder(other); + } + + public static class Builder { + private List structList = null; + private List unionList = null; + private List enumList = null; + private Set structSet = null; + private Set unionSet = null; + private Set enumSet = null; + private Map structMap = null; + private Map unionMap = null; + private Map enumMap = null; + private Map structMap2 = null; + private Map unionMap2 = null; + private Map enumMap2 = null; + private Map, Integer> listMap = null; + private Map> listMap2 = null; + private Map, Integer> setMap = null; + private Map> setMap2 = null; + private Map, Integer> mapMap = null; + private Map> mapMap2 = null; + + @com.facebook.swift.codec.ThriftField(value=1, name="struct_list", requiredness=Requiredness.NONE) + public Builder setStructList(List structList) { + this.structList = structList; + return this; + } + + public List getStructList() { return structList; } + + @com.facebook.swift.codec.ThriftField(value=2, name="union_list", requiredness=Requiredness.NONE) + public Builder setUnionList(List unionList) { + this.unionList = unionList; + return this; + } + + public List getUnionList() { return unionList; } + + @com.facebook.swift.codec.ThriftField(value=3, name="enum_list", requiredness=Requiredness.NONE) + public Builder setEnumList(List enumList) { + this.enumList = enumList; + return this; + } + + public List getEnumList() { return enumList; } + + @com.facebook.swift.codec.ThriftField(value=4, name="struct_set", requiredness=Requiredness.NONE) + public Builder setStructSet(Set structSet) { + this.structSet = structSet; + return this; + } + + public Set getStructSet() { return structSet; } + + @com.facebook.swift.codec.ThriftField(value=5, name="union_set", requiredness=Requiredness.NONE) + public Builder setUnionSet(Set unionSet) { + this.unionSet = unionSet; + return this; + } + + public Set getUnionSet() { return unionSet; } + + @com.facebook.swift.codec.ThriftField(value=6, name="enum_set", requiredness=Requiredness.NONE) + public Builder setEnumSet(Set enumSet) { + this.enumSet = enumSet; + return this; + } + + public Set getEnumSet() { return enumSet; } + + @com.facebook.swift.codec.ThriftField(value=7, name="struct_map", requiredness=Requiredness.NONE) + public Builder setStructMap(Map structMap) { + this.structMap = structMap; + return this; + } + + public Map getStructMap() { return structMap; } + + @com.facebook.swift.codec.ThriftField(value=8, name="union_map", requiredness=Requiredness.NONE) + public Builder setUnionMap(Map unionMap) { + this.unionMap = unionMap; + return this; + } + + public Map getUnionMap() { return unionMap; } + + @com.facebook.swift.codec.ThriftField(value=9, name="enum_map", requiredness=Requiredness.NONE) + public Builder setEnumMap(Map enumMap) { + this.enumMap = enumMap; + return this; + } + + public Map getEnumMap() { return enumMap; } + + @com.facebook.swift.codec.ThriftField(value=10, name="struct_map_2", requiredness=Requiredness.NONE) + public Builder setStructMap2(Map structMap2) { + this.structMap2 = structMap2; + return this; + } + + public Map getStructMap2() { return structMap2; } + + @com.facebook.swift.codec.ThriftField(value=11, name="union_map_2", requiredness=Requiredness.NONE) + public Builder setUnionMap2(Map unionMap2) { + this.unionMap2 = unionMap2; + return this; + } + + public Map getUnionMap2() { return unionMap2; } + + @com.facebook.swift.codec.ThriftField(value=12, name="enum_map_2", requiredness=Requiredness.NONE) + public Builder setEnumMap2(Map enumMap2) { + this.enumMap2 = enumMap2; + return this; + } + + public Map getEnumMap2() { return enumMap2; } + + @com.facebook.swift.codec.ThriftField(value=13, name="list_map", requiredness=Requiredness.NONE) + public Builder setListMap(Map, Integer> listMap) { + this.listMap = listMap; + return this; + } + + public Map, Integer> getListMap() { return listMap; } + + @com.facebook.swift.codec.ThriftField(value=14, name="list_map_2", requiredness=Requiredness.NONE) + public Builder setListMap2(Map> listMap2) { + this.listMap2 = listMap2; + return this; + } + + public Map> getListMap2() { return listMap2; } + + @com.facebook.swift.codec.ThriftField(value=15, name="set_map", requiredness=Requiredness.NONE) + public Builder setSetMap(Map, Integer> setMap) { + this.setMap = setMap; + return this; + } + + public Map, Integer> getSetMap() { return setMap; } + + @com.facebook.swift.codec.ThriftField(value=16, name="set_map_2", requiredness=Requiredness.NONE) + public Builder setSetMap2(Map> setMap2) { + this.setMap2 = setMap2; + return this; + } + + public Map> getSetMap2() { return setMap2; } + + @com.facebook.swift.codec.ThriftField(value=17, name="map_map", requiredness=Requiredness.NONE) + public Builder setMapMap(Map, Integer> mapMap) { + this.mapMap = mapMap; + return this; + } + + public Map, Integer> getMapMap() { return mapMap; } + + @com.facebook.swift.codec.ThriftField(value=18, name="map_map_2", requiredness=Requiredness.NONE) + public Builder setMapMap2(Map> mapMap2) { + this.mapMap2 = mapMap2; + return this; + } + + public Map> getMapMap2() { return mapMap2; } + + public Builder() { } + public Builder(Containers other) { + this.structList = other.structList; + this.unionList = other.unionList; + this.enumList = other.enumList; + this.structSet = other.structSet; + this.unionSet = other.unionSet; + this.enumSet = other.enumSet; + this.structMap = other.structMap; + this.unionMap = other.unionMap; + this.enumMap = other.enumMap; + this.structMap2 = other.structMap2; + this.unionMap2 = other.unionMap2; + this.enumMap2 = other.enumMap2; + this.listMap = other.listMap; + this.listMap2 = other.listMap2; + this.setMap = other.setMap; + this.setMap2 = other.setMap2; + this.mapMap = other.mapMap; + this.mapMap2 = other.mapMap2; + } + + @ThriftConstructor + public Containers build() { + Containers result = new Containers ( + this.structList, + this.unionList, + this.enumList, + this.structSet, + this.unionSet, + this.enumSet, + this.structMap, + this.unionMap, + this.enumMap, + this.structMap2, + this.unionMap2, + this.enumMap2, + this.listMap, + this.listMap2, + this.setMap, + this.setMap2, + this.mapMap, + this.mapMap2 + ); + return result; + } + } + + public static final Map NAMES_TO_IDS = new HashMap<>(); + public static final Map THRIFT_NAMES_TO_IDS = new HashMap<>(); + public static final Map FIELD_METADATA = new HashMap<>(); + private static final TStruct STRUCT_DESC = new TStruct("Containers"); + private final List structList; + public static final int _STRUCT_LIST = 1; + private static final TField STRUCT_LIST_FIELD_DESC = new TField("struct_list", TType.LIST, (short)1); + private final List unionList; + public static final int _UNION_LIST = 2; + private static final TField UNION_LIST_FIELD_DESC = new TField("union_list", TType.LIST, (short)2); + private final List enumList; + public static final int _ENUM_LIST = 3; + private static final TField ENUM_LIST_FIELD_DESC = new TField("enum_list", TType.LIST, (short)3); + private final Set structSet; + public static final int _STRUCT_SET = 4; + private static final TField STRUCT_SET_FIELD_DESC = new TField("struct_set", TType.SET, (short)4); + private final Set unionSet; + public static final int _UNION_SET = 5; + private static final TField UNION_SET_FIELD_DESC = new TField("union_set", TType.SET, (short)5); + private final Set enumSet; + public static final int _ENUM_SET = 6; + private static final TField ENUM_SET_FIELD_DESC = new TField("enum_set", TType.SET, (short)6); + private final Map structMap; + public static final int _STRUCT_MAP = 7; + private static final TField STRUCT_MAP_FIELD_DESC = new TField("struct_map", TType.MAP, (short)7); + private final Map unionMap; + public static final int _UNION_MAP = 8; + private static final TField UNION_MAP_FIELD_DESC = new TField("union_map", TType.MAP, (short)8); + private final Map enumMap; + public static final int _ENUM_MAP = 9; + private static final TField ENUM_MAP_FIELD_DESC = new TField("enum_map", TType.MAP, (short)9); + private final Map structMap2; + public static final int _STRUCT_MAP_2 = 10; + private static final TField STRUCT_MAP_2_FIELD_DESC = new TField("struct_map_2", TType.MAP, (short)10); + private final Map unionMap2; + public static final int _UNION_MAP_2 = 11; + private static final TField UNION_MAP_2_FIELD_DESC = new TField("union_map_2", TType.MAP, (short)11); + private final Map enumMap2; + public static final int _ENUM_MAP_2 = 12; + private static final TField ENUM_MAP_2_FIELD_DESC = new TField("enum_map_2", TType.MAP, (short)12); + private final Map, Integer> listMap; + public static final int _LIST_MAP = 13; + private static final TField LIST_MAP_FIELD_DESC = new TField("list_map", TType.MAP, (short)13); + private final Map> listMap2; + public static final int _LIST_MAP_2 = 14; + private static final TField LIST_MAP_2_FIELD_DESC = new TField("list_map_2", TType.MAP, (short)14); + private final Map, Integer> setMap; + public static final int _SET_MAP = 15; + private static final TField SET_MAP_FIELD_DESC = new TField("set_map", TType.MAP, (short)15); + private final Map> setMap2; + public static final int _SET_MAP_2 = 16; + private static final TField SET_MAP_2_FIELD_DESC = new TField("set_map_2", TType.MAP, (short)16); + private final Map, Integer> mapMap; + public static final int _MAP_MAP = 17; + private static final TField MAP_MAP_FIELD_DESC = new TField("map_map", TType.MAP, (short)17); + private final Map> mapMap2; + public static final int _MAP_MAP_2 = 18; + private static final TField MAP_MAP_2_FIELD_DESC = new TField("map_map_2", TType.MAP, (short)18); + static { + NAMES_TO_IDS.put("structList", 1); + THRIFT_NAMES_TO_IDS.put("struct_list", 1); + FIELD_METADATA.put(1, STRUCT_LIST_FIELD_DESC); + NAMES_TO_IDS.put("unionList", 2); + THRIFT_NAMES_TO_IDS.put("union_list", 2); + FIELD_METADATA.put(2, UNION_LIST_FIELD_DESC); + NAMES_TO_IDS.put("enumList", 3); + THRIFT_NAMES_TO_IDS.put("enum_list", 3); + FIELD_METADATA.put(3, ENUM_LIST_FIELD_DESC); + NAMES_TO_IDS.put("structSet", 4); + THRIFT_NAMES_TO_IDS.put("struct_set", 4); + FIELD_METADATA.put(4, STRUCT_SET_FIELD_DESC); + NAMES_TO_IDS.put("unionSet", 5); + THRIFT_NAMES_TO_IDS.put("union_set", 5); + FIELD_METADATA.put(5, UNION_SET_FIELD_DESC); + NAMES_TO_IDS.put("enumSet", 6); + THRIFT_NAMES_TO_IDS.put("enum_set", 6); + FIELD_METADATA.put(6, ENUM_SET_FIELD_DESC); + NAMES_TO_IDS.put("structMap", 7); + THRIFT_NAMES_TO_IDS.put("struct_map", 7); + FIELD_METADATA.put(7, STRUCT_MAP_FIELD_DESC); + NAMES_TO_IDS.put("unionMap", 8); + THRIFT_NAMES_TO_IDS.put("union_map", 8); + FIELD_METADATA.put(8, UNION_MAP_FIELD_DESC); + NAMES_TO_IDS.put("enumMap", 9); + THRIFT_NAMES_TO_IDS.put("enum_map", 9); + FIELD_METADATA.put(9, ENUM_MAP_FIELD_DESC); + NAMES_TO_IDS.put("structMap2", 10); + THRIFT_NAMES_TO_IDS.put("struct_map_2", 10); + FIELD_METADATA.put(10, STRUCT_MAP_2_FIELD_DESC); + NAMES_TO_IDS.put("unionMap2", 11); + THRIFT_NAMES_TO_IDS.put("union_map_2", 11); + FIELD_METADATA.put(11, UNION_MAP_2_FIELD_DESC); + NAMES_TO_IDS.put("enumMap2", 12); + THRIFT_NAMES_TO_IDS.put("enum_map_2", 12); + FIELD_METADATA.put(12, ENUM_MAP_2_FIELD_DESC); + NAMES_TO_IDS.put("listMap", 13); + THRIFT_NAMES_TO_IDS.put("list_map", 13); + FIELD_METADATA.put(13, LIST_MAP_FIELD_DESC); + NAMES_TO_IDS.put("listMap2", 14); + THRIFT_NAMES_TO_IDS.put("list_map_2", 14); + FIELD_METADATA.put(14, LIST_MAP_2_FIELD_DESC); + NAMES_TO_IDS.put("setMap", 15); + THRIFT_NAMES_TO_IDS.put("set_map", 15); + FIELD_METADATA.put(15, SET_MAP_FIELD_DESC); + NAMES_TO_IDS.put("setMap2", 16); + THRIFT_NAMES_TO_IDS.put("set_map_2", 16); + FIELD_METADATA.put(16, SET_MAP_2_FIELD_DESC); + NAMES_TO_IDS.put("mapMap", 17); + THRIFT_NAMES_TO_IDS.put("map_map", 17); + FIELD_METADATA.put(17, MAP_MAP_FIELD_DESC); + NAMES_TO_IDS.put("mapMap2", 18); + THRIFT_NAMES_TO_IDS.put("map_map_2", 18); + FIELD_METADATA.put(18, MAP_MAP_2_FIELD_DESC); + } + + @Nullable + @com.facebook.swift.codec.ThriftField(value=1, name="struct_list", requiredness=Requiredness.NONE) + public List getStructList() { return structList; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=2, name="union_list", requiredness=Requiredness.NONE) + public List getUnionList() { return unionList; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=3, name="enum_list", requiredness=Requiredness.NONE) + public List getEnumList() { return enumList; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=4, name="struct_set", requiredness=Requiredness.NONE) + public Set getStructSet() { return structSet; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=5, name="union_set", requiredness=Requiredness.NONE) + public Set getUnionSet() { return unionSet; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=6, name="enum_set", requiredness=Requiredness.NONE) + public Set getEnumSet() { return enumSet; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=7, name="struct_map", requiredness=Requiredness.NONE) + public Map getStructMap() { return structMap; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=8, name="union_map", requiredness=Requiredness.NONE) + public Map getUnionMap() { return unionMap; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=9, name="enum_map", requiredness=Requiredness.NONE) + public Map getEnumMap() { return enumMap; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=10, name="struct_map_2", requiredness=Requiredness.NONE) + public Map getStructMap2() { return structMap2; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=11, name="union_map_2", requiredness=Requiredness.NONE) + public Map getUnionMap2() { return unionMap2; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=12, name="enum_map_2", requiredness=Requiredness.NONE) + public Map getEnumMap2() { return enumMap2; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=13, name="list_map", requiredness=Requiredness.NONE) + public Map, Integer> getListMap() { return listMap; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=14, name="list_map_2", requiredness=Requiredness.NONE) + public Map> getListMap2() { return listMap2; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=15, name="set_map", requiredness=Requiredness.NONE) + public Map, Integer> getSetMap() { return setMap; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=16, name="set_map_2", requiredness=Requiredness.NONE) + public Map> getSetMap2() { return setMap2; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=17, name="map_map", requiredness=Requiredness.NONE) + public Map, Integer> getMapMap() { return mapMap; } + + + @Nullable + @com.facebook.swift.codec.ThriftField(value=18, name="map_map_2", requiredness=Requiredness.NONE) + public Map> getMapMap2() { return mapMap2; } + + @java.lang.Override + public String toString() { + ToStringHelper helper = toStringHelper(this); + helper.add("structList", structList); + helper.add("unionList", unionList); + helper.add("enumList", enumList); + helper.add("structSet", structSet); + helper.add("unionSet", unionSet); + helper.add("enumSet", enumSet); + helper.add("structMap", structMap); + helper.add("unionMap", unionMap); + helper.add("enumMap", enumMap); + helper.add("structMap2", structMap2); + helper.add("unionMap2", unionMap2); + helper.add("enumMap2", enumMap2); + helper.add("listMap", listMap); + helper.add("listMap2", listMap2); + helper.add("setMap", setMap); + helper.add("setMap2", setMap2); + helper.add("mapMap", mapMap); + helper.add("mapMap2", mapMap2); + return helper.toString(); + } + + @java.lang.Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + Containers other = (Containers)o; + + return + Objects.equals(structList, other.structList) && + Objects.equals(unionList, other.unionList) && + Objects.equals(enumList, other.enumList) && + Objects.equals(structSet, other.structSet) && + Objects.equals(unionSet, other.unionSet) && + Objects.equals(enumSet, other.enumSet) && + Objects.equals(structMap, other.structMap) && + Objects.equals(unionMap, other.unionMap) && + Objects.equals(enumMap, other.enumMap) && + Objects.equals(structMap2, other.structMap2) && + Objects.equals(unionMap2, other.unionMap2) && + Objects.equals(enumMap2, other.enumMap2) && + Objects.equals(listMap, other.listMap) && + Objects.equals(listMap2, other.listMap2) && + Objects.equals(setMap, other.setMap) && + Objects.equals(setMap2, other.setMap2) && + Objects.equals(mapMap, other.mapMap) && + Objects.equals(mapMap2, other.mapMap2) && + true; + } + + @java.lang.Override + public int hashCode() { + return Arrays.deepHashCode(new java.lang.Object[] { + structList, + unionList, + enumList, + structSet, + unionSet, + enumSet, + structMap, + unionMap, + enumMap, + structMap2, + unionMap2, + enumMap2, + listMap, + listMap2, + setMap, + setMap2, + mapMap, + mapMap2 + }); + } + + + public static com.facebook.thrift.payload.Reader asReader() { + return Containers::read0; + } + + public static Containers read0(TProtocol oprot) throws TException { + TField __field; + oprot.readStructBegin(Containers.NAMES_TO_IDS, Containers.THRIFT_NAMES_TO_IDS, Containers.FIELD_METADATA); + Containers.Builder builder = new Containers.Builder(); + while (true) { + __field = oprot.readFieldBegin(); + if (__field.type == TType.STOP) { break; } + switch (__field.id) { + case _STRUCT_LIST: + if (__field.type == TType.LIST) { + List structList; + { + TList _list = oprot.readListBegin(); + structList = new ArrayList(Math.max(0, _list.size)); + for (int _i = 0; (_list.size < 0) ? oprot.peekList() : (_i < _list.size); _i++) { + + test.fixtures.complex_struct.MyStruct _value1 = test.fixtures.complex_struct.MyStruct.read0(oprot); + structList.add(_value1); + } + oprot.readListEnd(); + } + builder.setStructList(structList); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _UNION_LIST: + if (__field.type == TType.LIST) { + List unionList; + { + TList _list = oprot.readListBegin(); + unionList = new ArrayList(Math.max(0, _list.size)); + for (int _i = 0; (_list.size < 0) ? oprot.peekList() : (_i < _list.size); _i++) { + + test.fixtures.complex_struct.MyUnion _value1 = test.fixtures.complex_struct.MyUnion.read0(oprot); + unionList.add(_value1); + } + oprot.readListEnd(); + } + builder.setUnionList(unionList); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _ENUM_LIST: + if (__field.type == TType.LIST) { + List enumList; + { + TList _list = oprot.readListBegin(); + enumList = new ArrayList(Math.max(0, _list.size)); + for (int _i = 0; (_list.size < 0) ? oprot.peekList() : (_i < _list.size); _i++) { + + test.fixtures.complex_struct.MyEnum _value1 = test.fixtures.complex_struct.MyEnum.fromInteger(oprot.readI32()); + enumList.add(_value1); + } + oprot.readListEnd(); + } + builder.setEnumList(enumList); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _STRUCT_SET: + if (__field.type == TType.SET) { + Set structSet; + { + TSet _set = oprot.readSetBegin(); + structSet = new HashSet(Math.max(0, _set.size)); + for (int _i = 0; (_set.size < 0) ? oprot.peekSet() : (_i < _set.size); _i++) { + + test.fixtures.complex_struct.MyStruct _value1 = test.fixtures.complex_struct.MyStruct.read0(oprot); + structSet.add(_value1); + } + oprot.readSetEnd(); + } + builder.setStructSet(structSet); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _UNION_SET: + if (__field.type == TType.SET) { + Set unionSet; + { + TSet _set = oprot.readSetBegin(); + unionSet = new HashSet(Math.max(0, _set.size)); + for (int _i = 0; (_set.size < 0) ? oprot.peekSet() : (_i < _set.size); _i++) { + + test.fixtures.complex_struct.MyUnion _value1 = test.fixtures.complex_struct.MyUnion.read0(oprot); + unionSet.add(_value1); + } + oprot.readSetEnd(); + } + builder.setUnionSet(unionSet); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _ENUM_SET: + if (__field.type == TType.SET) { + Set enumSet; + { + TSet _set = oprot.readSetBegin(); + enumSet = new HashSet(Math.max(0, _set.size)); + for (int _i = 0; (_set.size < 0) ? oprot.peekSet() : (_i < _set.size); _i++) { + + test.fixtures.complex_struct.MyEnum _value1 = test.fixtures.complex_struct.MyEnum.fromInteger(oprot.readI32()); + enumSet.add(_value1); + } + oprot.readSetEnd(); + } + builder.setEnumSet(enumSet); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _STRUCT_MAP: + if (__field.type == TType.MAP) { + Map structMap; + { + TMap _map = oprot.readMapBegin(); + structMap = new HashMap(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + test.fixtures.complex_struct.MyStruct _key1 = test.fixtures.complex_struct.MyStruct.read0(oprot); + long _value1 = oprot.readI64(); + structMap.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setStructMap(structMap); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _UNION_MAP: + if (__field.type == TType.MAP) { + Map unionMap; + { + TMap _map = oprot.readMapBegin(); + unionMap = new HashMap(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + test.fixtures.complex_struct.MyUnion _key1 = test.fixtures.complex_struct.MyUnion.read0(oprot); + long _value1 = oprot.readI64(); + unionMap.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setUnionMap(unionMap); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _ENUM_MAP: + if (__field.type == TType.MAP) { + Map enumMap; + { + TMap _map = oprot.readMapBegin(); + enumMap = new HashMap(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + test.fixtures.complex_struct.MyEnum _key1 = test.fixtures.complex_struct.MyEnum.fromInteger(oprot.readI32()); + long _value1 = oprot.readI64(); + enumMap.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setEnumMap(enumMap); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _STRUCT_MAP_2: + if (__field.type == TType.MAP) { + Map structMap2; + { + TMap _map = oprot.readMapBegin(); + structMap2 = new HashMap(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + int _key1 = oprot.readI32(); + test.fixtures.complex_struct.MyStruct _value1 = test.fixtures.complex_struct.MyStruct.read0(oprot); + structMap2.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setStructMap2(structMap2); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _UNION_MAP_2: + if (__field.type == TType.MAP) { + Map unionMap2; + { + TMap _map = oprot.readMapBegin(); + unionMap2 = new HashMap(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + int _key1 = oprot.readI32(); + test.fixtures.complex_struct.MyUnion _value1 = test.fixtures.complex_struct.MyUnion.read0(oprot); + unionMap2.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setUnionMap2(unionMap2); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _ENUM_MAP_2: + if (__field.type == TType.MAP) { + Map enumMap2; + { + TMap _map = oprot.readMapBegin(); + enumMap2 = new HashMap(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + int _key1 = oprot.readI32(); + test.fixtures.complex_struct.MyEnum _value1 = test.fixtures.complex_struct.MyEnum.fromInteger(oprot.readI32()); + enumMap2.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setEnumMap2(enumMap2); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _LIST_MAP: + if (__field.type == TType.MAP) { + Map, Integer> listMap; + { + TMap _map = oprot.readMapBegin(); + listMap = new HashMap, Integer>(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + List _key1; + { + TList _list1 = oprot.readListBegin(); + _key1 = new ArrayList(Math.max(0, _list1.size)); + for (int _i1 = 0; (_list1.size < 0) ? oprot.peekList() : (_i1 < _list1.size); _i1++) { + + int _value2 = oprot.readI32(); + _key1.add(_value2); + } + oprot.readListEnd(); + } + int _value1 = oprot.readI32(); + listMap.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setListMap(listMap); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _LIST_MAP_2: + if (__field.type == TType.MAP) { + Map> listMap2; + { + TMap _map = oprot.readMapBegin(); + listMap2 = new HashMap>(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + int _key1 = oprot.readI32(); + List _value1; + { + TList _list1 = oprot.readListBegin(); + _value1 = new ArrayList(Math.max(0, _list1.size)); + for (int _i1 = 0; (_list1.size < 0) ? oprot.peekList() : (_i1 < _list1.size); _i1++) { + + + int _value2 = oprot.readI32(); + + + _value1.add(_value2); + + } + oprot.readListEnd(); + } + listMap2.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setListMap2(listMap2); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _SET_MAP: + if (__field.type == TType.MAP) { + Map, Integer> setMap; + { + TMap _map = oprot.readMapBegin(); + setMap = new HashMap, Integer>(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + Set _key1; + { + TSet _set1 = oprot.readSetBegin(); + _key1 = new HashSet(Math.max(0, _set1.size)); + for (int _i1 = 0; (_set1.size < 0) ? oprot.peekSet() : (_i1 < _set1.size); _i1++) { + + int _value2 = oprot.readI32(); + _key1.add(_value2); + } + oprot.readSetEnd(); + } + int _value1 = oprot.readI32(); + setMap.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setSetMap(setMap); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _SET_MAP_2: + if (__field.type == TType.MAP) { + Map> setMap2; + { + TMap _map = oprot.readMapBegin(); + setMap2 = new HashMap>(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + int _key1 = oprot.readI32(); + Set _value1; + { + TSet _set1 = oprot.readSetBegin(); + _value1 = new HashSet(Math.max(0, _set1.size)); + for (int _i1 = 0; (_set1.size < 0) ? oprot.peekSet() : (_i1 < _set1.size); _i1++) { + + + int _value2 = oprot.readI32(); + + + _value1.add(_value2); + + } + oprot.readSetEnd(); + } + setMap2.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setSetMap2(setMap2); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _MAP_MAP: + if (__field.type == TType.MAP) { + Map, Integer> mapMap; + { + TMap _map = oprot.readMapBegin(); + mapMap = new HashMap, Integer>(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + Map _key1; + { + TMap _map1 = oprot.readMapBegin(); + _key1 = new HashMap(Math.max(0, _map1.size)); + for (int _i1 = 0; (_map1.size < 0) ? oprot.peekMap() : (_i1 < _map1.size); _i1++) { + + int _key2 = oprot.readI32(); + + int _value2 = oprot.readI32(); + _key1.put(_key2, _value2); + } + oprot.readMapEnd(); + } + int _value1 = oprot.readI32(); + mapMap.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setMapMap(mapMap); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + case _MAP_MAP_2: + if (__field.type == TType.MAP) { + Map> mapMap2; + { + TMap _map = oprot.readMapBegin(); + mapMap2 = new HashMap>(Math.max(0, _map.size)); + for (int _i = 0; (_map.size < 0) ? oprot.peekMap() : (_i < _map.size); _i++) { + + int _key1 = oprot.readI32(); + Map _value1; + { + TMap _map1 = oprot.readMapBegin(); + _value1 = new HashMap(Math.max(0, _map1.size)); + for (int _i1 = 0; (_map1.size < 0) ? oprot.peekMap() : (_i1 < _map1.size); _i1++) { + + + int _key2 = oprot.readI32(); + + + + int _value2 = oprot.readI32(); + + + _value1.put(_key2, _value2); + + } + } + oprot.readMapEnd(); + mapMap2.put(_key1, _value1); + } + } + oprot.readMapEnd(); + builder.setMapMap2(mapMap2); + } else { + TProtocolUtil.skip(oprot, __field.type); + } + break; + default: + TProtocolUtil.skip(oprot, __field.type); + break; + } + oprot.readFieldEnd(); + } + oprot.readStructEnd(); + return builder.build(); + } + + public void write0(TProtocol oprot) throws TException { + oprot.writeStructBegin(STRUCT_DESC); + if (structList != null) { + oprot.writeFieldBegin(STRUCT_LIST_FIELD_DESC); + List _iter0 = structList; + oprot.writeListBegin(new TList(TType.STRUCT, _iter0.size())); + for (test.fixtures.complex_struct.MyStruct _iter1 : _iter0) { + _iter1.write0(oprot); + } + oprot.writeListEnd(); + oprot.writeFieldEnd(); + } + if (unionList != null) { + oprot.writeFieldBegin(UNION_LIST_FIELD_DESC); + List _iter0 = unionList; + oprot.writeListBegin(new TList(TType.STRUCT, _iter0.size())); + for (test.fixtures.complex_struct.MyUnion _iter1 : _iter0) { + _iter1.write0(oprot); + } + oprot.writeListEnd(); + oprot.writeFieldEnd(); + } + if (enumList != null) { + oprot.writeFieldBegin(ENUM_LIST_FIELD_DESC); + List _iter0 = enumList; + oprot.writeListBegin(new TList(TType.I32, _iter0.size())); + for (test.fixtures.complex_struct.MyEnum _iter1 : _iter0) { + oprot.writeI32(_iter1 == null ? 0 : com.facebook.thrift.util.EnumUtil.getValue(_iter1)); + } + oprot.writeListEnd(); + oprot.writeFieldEnd(); + } + if (structSet != null) { + oprot.writeFieldBegin(STRUCT_SET_FIELD_DESC); + Set _iter0 = structSet; + oprot.writeSetBegin(new TSet(TType.STRUCT, _iter0.size())); + for (test.fixtures.complex_struct.MyStruct _iter1 : _iter0) { + _iter1.write0(oprot); + } + oprot.writeSetEnd(); + oprot.writeFieldEnd(); + } + if (unionSet != null) { + oprot.writeFieldBegin(UNION_SET_FIELD_DESC); + Set _iter0 = unionSet; + oprot.writeSetBegin(new TSet(TType.STRUCT, _iter0.size())); + for (test.fixtures.complex_struct.MyUnion _iter1 : _iter0) { + _iter1.write0(oprot); + } + oprot.writeSetEnd(); + oprot.writeFieldEnd(); + } + if (enumSet != null) { + oprot.writeFieldBegin(ENUM_SET_FIELD_DESC); + Set _iter0 = enumSet; + oprot.writeSetBegin(new TSet(TType.I32, _iter0.size())); + for (test.fixtures.complex_struct.MyEnum _iter1 : _iter0) { + oprot.writeI32(_iter1 == null ? 0 : com.facebook.thrift.util.EnumUtil.getValue(_iter1)); + } + oprot.writeSetEnd(); + oprot.writeFieldEnd(); + } + if (structMap != null) { + oprot.writeFieldBegin(STRUCT_MAP_FIELD_DESC); + Map _iter0 = structMap; + oprot.writeMapBegin(new TMap(TType.STRUCT, TType.I64, _iter0.size())); + for (Map.Entry _iter1 : _iter0.entrySet()) { + _iter1.getKey().write0(oprot); + oprot.writeI64(_iter1.getValue()); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (unionMap != null) { + oprot.writeFieldBegin(UNION_MAP_FIELD_DESC); + Map _iter0 = unionMap; + oprot.writeMapBegin(new TMap(TType.STRUCT, TType.I64, _iter0.size())); + for (Map.Entry _iter1 : _iter0.entrySet()) { + _iter1.getKey().write0(oprot); + oprot.writeI64(_iter1.getValue()); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (enumMap != null) { + oprot.writeFieldBegin(ENUM_MAP_FIELD_DESC); + Map _iter0 = enumMap; + oprot.writeMapBegin(new TMap(TType.I32, TType.I64, _iter0.size())); + for (Map.Entry _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1 == null ? 0 : com.facebook.thrift.util.EnumUtil.getValue(_iter1.getKey())); + oprot.writeI64(_iter1.getValue()); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (structMap2 != null) { + oprot.writeFieldBegin(STRUCT_MAP_2_FIELD_DESC); + Map _iter0 = structMap2; + oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, _iter0.size())); + for (Map.Entry _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1.getKey()); + _iter1.getValue().write0(oprot); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (unionMap2 != null) { + oprot.writeFieldBegin(UNION_MAP_2_FIELD_DESC); + Map _iter0 = unionMap2; + oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, _iter0.size())); + for (Map.Entry _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1.getKey()); + _iter1.getValue().write0(oprot); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (enumMap2 != null) { + oprot.writeFieldBegin(ENUM_MAP_2_FIELD_DESC); + Map _iter0 = enumMap2; + oprot.writeMapBegin(new TMap(TType.I32, TType.I32, _iter0.size())); + for (Map.Entry _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1.getKey()); + oprot.writeI32(_iter1 == null ? 0 : com.facebook.thrift.util.EnumUtil.getValue(_iter1.getValue())); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (listMap != null) { + oprot.writeFieldBegin(LIST_MAP_FIELD_DESC); + Map, Integer> _iter0 = listMap; + oprot.writeMapBegin(new TMap(TType.LIST, TType.I32, _iter0.size())); + for (Map.Entry, Integer> _iter1 : _iter0.entrySet()) { + oprot.writeListBegin(new TList(TType.I32, _iter1.getKey().size())); + for (int _iter2 : _iter1.getKey()) { + oprot.writeI32(_iter2); + } + oprot.writeListEnd(); + oprot.writeI32(_iter1.getValue()); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (listMap2 != null) { + oprot.writeFieldBegin(LIST_MAP_2_FIELD_DESC); + Map> _iter0 = listMap2; + oprot.writeMapBegin(new TMap(TType.I32, TType.LIST, _iter0.size())); + for (Map.Entry> _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1.getKey()); + oprot.writeListBegin(new TList(TType.I32, _iter1.getValue().size())); + for (int _iter2 : _iter1.getValue()) { + oprot.writeI32(_iter2); + } + oprot.writeListEnd(); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (setMap != null) { + oprot.writeFieldBegin(SET_MAP_FIELD_DESC); + Map, Integer> _iter0 = setMap; + oprot.writeMapBegin(new TMap(TType.SET, TType.I32, _iter0.size())); + for (Map.Entry, Integer> _iter1 : _iter0.entrySet()) { + oprot.writeSetBegin(new TSet(TType.I32, _iter1.getKey().size())); + for (int _iter2 : _iter1.getKey()) { + oprot.writeI32(_iter2); + } + oprot.writeSetEnd(); + oprot.writeI32(_iter1.getValue()); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (setMap2 != null) { + oprot.writeFieldBegin(SET_MAP_2_FIELD_DESC); + Map> _iter0 = setMap2; + oprot.writeMapBegin(new TMap(TType.I32, TType.SET, _iter0.size())); + for (Map.Entry> _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1.getKey()); + oprot.writeSetBegin(new TSet(TType.I32, _iter1.getValue().size())); + for (int _iter2 : _iter1.getValue()) { + oprot.writeI32(_iter2); + } + oprot.writeSetEnd(); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (mapMap != null) { + oprot.writeFieldBegin(MAP_MAP_FIELD_DESC); + Map, Integer> _iter0 = mapMap; + oprot.writeMapBegin(new TMap(TType.MAP, TType.I32, _iter0.size())); + for (Map.Entry, Integer> _iter1 : _iter0.entrySet()) { + oprot.writeMapBegin(new TMap(TType.I32, TType.I32, _iter1.getKey().size())); + for (Map.Entry _iter2 : _iter1.getKey().entrySet()) { + oprot.writeI32(_iter2.getKey()); + oprot.writeI32(_iter2.getValue()); + } + oprot.writeMapEnd(); + oprot.writeI32(_iter1.getValue()); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + if (mapMap2 != null) { + oprot.writeFieldBegin(MAP_MAP_2_FIELD_DESC); + Map> _iter0 = mapMap2; + oprot.writeMapBegin(new TMap(TType.I32, TType.MAP, _iter0.size())); + for (Map.Entry> _iter1 : _iter0.entrySet()) { + oprot.writeI32(_iter1.getKey()); + oprot.writeMapBegin(new TMap(TType.I32, TType.I32, _iter1.getValue().size())); + for (Map.Entry _iter2 : _iter1.getValue().entrySet()) { + oprot.writeI32(_iter2.getKey()); + oprot.writeI32(_iter2.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeMapEnd(); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + private static class _ContainersLazy { + private static final Containers _DEFAULT = new Containers.Builder().build(); + } + + public static Containers defaultInstance() { + return _ContainersLazy._DEFAULT; + } +} diff --git a/thrift/compiler/test/fixtures/complex-struct/out/java_deprecated/gen-javadeprecated/Containers.java b/thrift/compiler/test/fixtures/complex-struct/out/java_deprecated/gen-javadeprecated/Containers.java new file mode 100644 index 00000000000..9abc2c35594 --- /dev/null +++ b/thrift/compiler/test/fixtures/complex-struct/out/java_deprecated/gen-javadeprecated/Containers.java @@ -0,0 +1,2070 @@ +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.Set; +import java.util.HashSet; +import java.util.Collections; +import java.util.BitSet; +import java.util.Arrays; +import com.facebook.thrift.*; +import com.facebook.thrift.annotations.*; +import com.facebook.thrift.async.*; +import com.facebook.thrift.meta_data.*; +import com.facebook.thrift.server.*; +import com.facebook.thrift.transport.*; +import com.facebook.thrift.protocol.*; + +@SuppressWarnings({ "unused", "serial" }) +public class Containers implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("Containers"); + private static final TField STRUCT_LIST_FIELD_DESC = new TField("struct_list", TType.LIST, (short)1); + private static final TField UNION_LIST_FIELD_DESC = new TField("union_list", TType.LIST, (short)2); + private static final TField ENUM_LIST_FIELD_DESC = new TField("enum_list", TType.LIST, (short)3); + private static final TField STRUCT_SET_FIELD_DESC = new TField("struct_set", TType.SET, (short)4); + private static final TField UNION_SET_FIELD_DESC = new TField("union_set", TType.SET, (short)5); + private static final TField ENUM_SET_FIELD_DESC = new TField("enum_set", TType.SET, (short)6); + private static final TField STRUCT_MAP_FIELD_DESC = new TField("struct_map", TType.MAP, (short)7); + private static final TField UNION_MAP_FIELD_DESC = new TField("union_map", TType.MAP, (short)8); + private static final TField ENUM_MAP_FIELD_DESC = new TField("enum_map", TType.MAP, (short)9); + private static final TField STRUCT_MAP_2_FIELD_DESC = new TField("struct_map_2", TType.MAP, (short)10); + private static final TField UNION_MAP_2_FIELD_DESC = new TField("union_map_2", TType.MAP, (short)11); + private static final TField ENUM_MAP_2_FIELD_DESC = new TField("enum_map_2", TType.MAP, (short)12); + private static final TField LIST_MAP_FIELD_DESC = new TField("list_map", TType.MAP, (short)13); + private static final TField LIST_MAP_2_FIELD_DESC = new TField("list_map_2", TType.MAP, (short)14); + private static final TField SET_MAP_FIELD_DESC = new TField("set_map", TType.MAP, (short)15); + private static final TField SET_MAP_2_FIELD_DESC = new TField("set_map_2", TType.MAP, (short)16); + private static final TField MAP_MAP_FIELD_DESC = new TField("map_map", TType.MAP, (short)17); + private static final TField MAP_MAP_2_FIELD_DESC = new TField("map_map_2", TType.MAP, (short)18); + + public List struct_list; + public List union_list; + public List enum_list; + public Set struct_set; + public Set union_set; + public Set enum_set; + public Map struct_map; + public Map union_map; + public Map enum_map; + public Map struct_map_2; + public Map union_map_2; + public Map enum_map_2; + public Map,Integer> list_map; + public Map> list_map_2; + public Map,Integer> set_map; + public Map> set_map_2; + public Map,Integer> map_map; + public Map> map_map_2; + public static final int STRUCT_LIST = 1; + public static final int UNION_LIST = 2; + public static final int ENUM_LIST = 3; + public static final int STRUCT_SET = 4; + public static final int UNION_SET = 5; + public static final int ENUM_SET = 6; + public static final int STRUCT_MAP = 7; + public static final int UNION_MAP = 8; + public static final int ENUM_MAP = 9; + public static final int STRUCT_MAP_2 = 10; + public static final int UNION_MAP_2 = 11; + public static final int ENUM_MAP_2 = 12; + public static final int LIST_MAP = 13; + public static final int LIST_MAP_2 = 14; + public static final int SET_MAP = 15; + public static final int SET_MAP_2 = 16; + public static final int MAP_MAP = 17; + public static final int MAP_MAP_2 = 18; + + // isset id assignments + + public static final Map metaDataMap; + + static { + Map tmpMetaDataMap = new HashMap(); + tmpMetaDataMap.put(STRUCT_LIST, new FieldMetaData("struct_list", TFieldRequirementType.DEFAULT, + new ListMetaData(TType.LIST, + new StructMetaData(TType.STRUCT, MyStruct.class)))); + tmpMetaDataMap.put(UNION_LIST, new FieldMetaData("union_list", TFieldRequirementType.DEFAULT, + new ListMetaData(TType.LIST, + new StructMetaData(TType.STRUCT, MyUnion.class)))); + tmpMetaDataMap.put(ENUM_LIST, new FieldMetaData("enum_list", TFieldRequirementType.DEFAULT, + new ListMetaData(TType.LIST, + new FieldValueMetaData(TType.I32)))); + tmpMetaDataMap.put(STRUCT_SET, new FieldMetaData("struct_set", TFieldRequirementType.DEFAULT, + new SetMetaData(TType.SET, + new StructMetaData(TType.STRUCT, MyStruct.class)))); + tmpMetaDataMap.put(UNION_SET, new FieldMetaData("union_set", TFieldRequirementType.DEFAULT, + new SetMetaData(TType.SET, + new StructMetaData(TType.STRUCT, MyUnion.class)))); + tmpMetaDataMap.put(ENUM_SET, new FieldMetaData("enum_set", TFieldRequirementType.DEFAULT, + new SetMetaData(TType.SET, + new FieldValueMetaData(TType.I32)))); + tmpMetaDataMap.put(STRUCT_MAP, new FieldMetaData("struct_map", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new StructMetaData(TType.STRUCT, MyStruct.class), + new FieldValueMetaData(TType.I64)))); + tmpMetaDataMap.put(UNION_MAP, new FieldMetaData("union_map", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new StructMetaData(TType.STRUCT, MyUnion.class), + new FieldValueMetaData(TType.I64)))); + tmpMetaDataMap.put(ENUM_MAP, new FieldMetaData("enum_map", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new FieldValueMetaData(TType.I64)))); + tmpMetaDataMap.put(STRUCT_MAP_2, new FieldMetaData("struct_map_2", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new StructMetaData(TType.STRUCT, MyStruct.class)))); + tmpMetaDataMap.put(UNION_MAP_2, new FieldMetaData("union_map_2", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new StructMetaData(TType.STRUCT, MyUnion.class)))); + tmpMetaDataMap.put(ENUM_MAP_2, new FieldMetaData("enum_map_2", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new FieldValueMetaData(TType.I32)))); + tmpMetaDataMap.put(LIST_MAP, new FieldMetaData("list_map", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new ListMetaData(TType.LIST, + new FieldValueMetaData(TType.I32)), + new FieldValueMetaData(TType.I32)))); + tmpMetaDataMap.put(LIST_MAP_2, new FieldMetaData("list_map_2", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new ListMetaData(TType.LIST, + new FieldValueMetaData(TType.I32))))); + tmpMetaDataMap.put(SET_MAP, new FieldMetaData("set_map", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new SetMetaData(TType.SET, + new FieldValueMetaData(TType.I32)), + new FieldValueMetaData(TType.I32)))); + tmpMetaDataMap.put(SET_MAP_2, new FieldMetaData("set_map_2", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new SetMetaData(TType.SET, + new FieldValueMetaData(TType.I32))))); + tmpMetaDataMap.put(MAP_MAP, new FieldMetaData("map_map", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new FieldValueMetaData(TType.I32)), + new FieldValueMetaData(TType.I32)))); + tmpMetaDataMap.put(MAP_MAP_2, new FieldMetaData("map_map_2", TFieldRequirementType.DEFAULT, + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new MapMetaData(TType.MAP, + new FieldValueMetaData(TType.I32), + new FieldValueMetaData(TType.I32))))); + metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap); + } + + static { + FieldMetaData.addStructMetaDataMap(Containers.class, metaDataMap); + } + + public Containers() { + } + + public Containers( + List struct_list, + List union_list, + List enum_list, + Set struct_set, + Set union_set, + Set enum_set, + Map struct_map, + Map union_map, + Map enum_map, + Map struct_map_2, + Map union_map_2, + Map enum_map_2, + Map,Integer> list_map, + Map> list_map_2, + Map,Integer> set_map, + Map> set_map_2, + Map,Integer> map_map, + Map> map_map_2) { + this(); + this.struct_list = struct_list; + this.union_list = union_list; + this.enum_list = enum_list; + this.struct_set = struct_set; + this.union_set = union_set; + this.enum_set = enum_set; + this.struct_map = struct_map; + this.union_map = union_map; + this.enum_map = enum_map; + this.struct_map_2 = struct_map_2; + this.union_map_2 = union_map_2; + this.enum_map_2 = enum_map_2; + this.list_map = list_map; + this.list_map_2 = list_map_2; + this.set_map = set_map; + this.set_map_2 = set_map_2; + this.map_map = map_map; + this.map_map_2 = map_map_2; + } + + public static class Builder { + private List struct_list; + private List union_list; + private List enum_list; + private Set struct_set; + private Set union_set; + private Set enum_set; + private Map struct_map; + private Map union_map; + private Map enum_map; + private Map struct_map_2; + private Map union_map_2; + private Map enum_map_2; + private Map,Integer> list_map; + private Map> list_map_2; + private Map,Integer> set_map; + private Map> set_map_2; + private Map,Integer> map_map; + private Map> map_map_2; + + public Builder() { + } + + public Builder setStruct_list(final List struct_list) { + this.struct_list = struct_list; + return this; + } + + public Builder setUnion_list(final List union_list) { + this.union_list = union_list; + return this; + } + + public Builder setEnum_list(final List enum_list) { + this.enum_list = enum_list; + return this; + } + + public Builder setStruct_set(final Set struct_set) { + this.struct_set = struct_set; + return this; + } + + public Builder setUnion_set(final Set union_set) { + this.union_set = union_set; + return this; + } + + public Builder setEnum_set(final Set enum_set) { + this.enum_set = enum_set; + return this; + } + + public Builder setStruct_map(final Map struct_map) { + this.struct_map = struct_map; + return this; + } + + public Builder setUnion_map(final Map union_map) { + this.union_map = union_map; + return this; + } + + public Builder setEnum_map(final Map enum_map) { + this.enum_map = enum_map; + return this; + } + + public Builder setStruct_map_2(final Map struct_map_2) { + this.struct_map_2 = struct_map_2; + return this; + } + + public Builder setUnion_map_2(final Map union_map_2) { + this.union_map_2 = union_map_2; + return this; + } + + public Builder setEnum_map_2(final Map enum_map_2) { + this.enum_map_2 = enum_map_2; + return this; + } + + public Builder setList_map(final Map,Integer> list_map) { + this.list_map = list_map; + return this; + } + + public Builder setList_map_2(final Map> list_map_2) { + this.list_map_2 = list_map_2; + return this; + } + + public Builder setSet_map(final Map,Integer> set_map) { + this.set_map = set_map; + return this; + } + + public Builder setSet_map_2(final Map> set_map_2) { + this.set_map_2 = set_map_2; + return this; + } + + public Builder setMap_map(final Map,Integer> map_map) { + this.map_map = map_map; + return this; + } + + public Builder setMap_map_2(final Map> map_map_2) { + this.map_map_2 = map_map_2; + return this; + } + + public Containers build() { + Containers result = new Containers(); + result.setStruct_list(this.struct_list); + result.setUnion_list(this.union_list); + result.setEnum_list(this.enum_list); + result.setStruct_set(this.struct_set); + result.setUnion_set(this.union_set); + result.setEnum_set(this.enum_set); + result.setStruct_map(this.struct_map); + result.setUnion_map(this.union_map); + result.setEnum_map(this.enum_map); + result.setStruct_map_2(this.struct_map_2); + result.setUnion_map_2(this.union_map_2); + result.setEnum_map_2(this.enum_map_2); + result.setList_map(this.list_map); + result.setList_map_2(this.list_map_2); + result.setSet_map(this.set_map); + result.setSet_map_2(this.set_map_2); + result.setMap_map(this.map_map); + result.setMap_map_2(this.map_map_2); + return result; + } + } + + public static Builder builder() { + return new Builder(); + } + + /** + * Performs a deep copy on other. + */ + public Containers(Containers other) { + if (other.isSetStruct_list()) { + this.struct_list = TBaseHelper.deepCopy(other.struct_list); + } + if (other.isSetUnion_list()) { + this.union_list = TBaseHelper.deepCopy(other.union_list); + } + if (other.isSetEnum_list()) { + this.enum_list = TBaseHelper.deepCopy(other.enum_list); + } + if (other.isSetStruct_set()) { + this.struct_set = TBaseHelper.deepCopy(other.struct_set); + } + if (other.isSetUnion_set()) { + this.union_set = TBaseHelper.deepCopy(other.union_set); + } + if (other.isSetEnum_set()) { + this.enum_set = TBaseHelper.deepCopy(other.enum_set); + } + if (other.isSetStruct_map()) { + this.struct_map = TBaseHelper.deepCopy(other.struct_map); + } + if (other.isSetUnion_map()) { + this.union_map = TBaseHelper.deepCopy(other.union_map); + } + if (other.isSetEnum_map()) { + this.enum_map = TBaseHelper.deepCopy(other.enum_map); + } + if (other.isSetStruct_map_2()) { + this.struct_map_2 = TBaseHelper.deepCopy(other.struct_map_2); + } + if (other.isSetUnion_map_2()) { + this.union_map_2 = TBaseHelper.deepCopy(other.union_map_2); + } + if (other.isSetEnum_map_2()) { + this.enum_map_2 = TBaseHelper.deepCopy(other.enum_map_2); + } + if (other.isSetList_map()) { + this.list_map = TBaseHelper.deepCopy(other.list_map); + } + if (other.isSetList_map_2()) { + this.list_map_2 = TBaseHelper.deepCopy(other.list_map_2); + } + if (other.isSetSet_map()) { + this.set_map = TBaseHelper.deepCopy(other.set_map); + } + if (other.isSetSet_map_2()) { + this.set_map_2 = TBaseHelper.deepCopy(other.set_map_2); + } + if (other.isSetMap_map()) { + this.map_map = TBaseHelper.deepCopy(other.map_map); + } + if (other.isSetMap_map_2()) { + this.map_map_2 = TBaseHelper.deepCopy(other.map_map_2); + } + } + + public Containers deepCopy() { + return new Containers(this); + } + + public List getStruct_list() { + return this.struct_list; + } + + public Containers setStruct_list(List struct_list) { + this.struct_list = struct_list; + return this; + } + + public void unsetStruct_list() { + this.struct_list = null; + } + + // Returns true if field struct_list is set (has been assigned a value) and false otherwise + public boolean isSetStruct_list() { + return this.struct_list != null; + } + + public void setStruct_listIsSet(boolean __value) { + if (!__value) { + this.struct_list = null; + } + } + + public List getUnion_list() { + return this.union_list; + } + + public Containers setUnion_list(List union_list) { + this.union_list = union_list; + return this; + } + + public void unsetUnion_list() { + this.union_list = null; + } + + // Returns true if field union_list is set (has been assigned a value) and false otherwise + public boolean isSetUnion_list() { + return this.union_list != null; + } + + public void setUnion_listIsSet(boolean __value) { + if (!__value) { + this.union_list = null; + } + } + + public List getEnum_list() { + return this.enum_list; + } + + public Containers setEnum_list(List enum_list) { + this.enum_list = enum_list; + return this; + } + + public void unsetEnum_list() { + this.enum_list = null; + } + + // Returns true if field enum_list is set (has been assigned a value) and false otherwise + public boolean isSetEnum_list() { + return this.enum_list != null; + } + + public void setEnum_listIsSet(boolean __value) { + if (!__value) { + this.enum_list = null; + } + } + + public Set getStruct_set() { + return this.struct_set; + } + + public Containers setStruct_set(Set struct_set) { + this.struct_set = struct_set; + return this; + } + + public void unsetStruct_set() { + this.struct_set = null; + } + + // Returns true if field struct_set is set (has been assigned a value) and false otherwise + public boolean isSetStruct_set() { + return this.struct_set != null; + } + + public void setStruct_setIsSet(boolean __value) { + if (!__value) { + this.struct_set = null; + } + } + + public Set getUnion_set() { + return this.union_set; + } + + public Containers setUnion_set(Set union_set) { + this.union_set = union_set; + return this; + } + + public void unsetUnion_set() { + this.union_set = null; + } + + // Returns true if field union_set is set (has been assigned a value) and false otherwise + public boolean isSetUnion_set() { + return this.union_set != null; + } + + public void setUnion_setIsSet(boolean __value) { + if (!__value) { + this.union_set = null; + } + } + + public Set getEnum_set() { + return this.enum_set; + } + + public Containers setEnum_set(Set enum_set) { + this.enum_set = enum_set; + return this; + } + + public void unsetEnum_set() { + this.enum_set = null; + } + + // Returns true if field enum_set is set (has been assigned a value) and false otherwise + public boolean isSetEnum_set() { + return this.enum_set != null; + } + + public void setEnum_setIsSet(boolean __value) { + if (!__value) { + this.enum_set = null; + } + } + + public Map getStruct_map() { + return this.struct_map; + } + + public Containers setStruct_map(Map struct_map) { + this.struct_map = struct_map; + return this; + } + + public void unsetStruct_map() { + this.struct_map = null; + } + + // Returns true if field struct_map is set (has been assigned a value) and false otherwise + public boolean isSetStruct_map() { + return this.struct_map != null; + } + + public void setStruct_mapIsSet(boolean __value) { + if (!__value) { + this.struct_map = null; + } + } + + public Map getUnion_map() { + return this.union_map; + } + + public Containers setUnion_map(Map union_map) { + this.union_map = union_map; + return this; + } + + public void unsetUnion_map() { + this.union_map = null; + } + + // Returns true if field union_map is set (has been assigned a value) and false otherwise + public boolean isSetUnion_map() { + return this.union_map != null; + } + + public void setUnion_mapIsSet(boolean __value) { + if (!__value) { + this.union_map = null; + } + } + + public Map getEnum_map() { + return this.enum_map; + } + + public Containers setEnum_map(Map enum_map) { + this.enum_map = enum_map; + return this; + } + + public void unsetEnum_map() { + this.enum_map = null; + } + + // Returns true if field enum_map is set (has been assigned a value) and false otherwise + public boolean isSetEnum_map() { + return this.enum_map != null; + } + + public void setEnum_mapIsSet(boolean __value) { + if (!__value) { + this.enum_map = null; + } + } + + public Map getStruct_map_2() { + return this.struct_map_2; + } + + public Containers setStruct_map_2(Map struct_map_2) { + this.struct_map_2 = struct_map_2; + return this; + } + + public void unsetStruct_map_2() { + this.struct_map_2 = null; + } + + // Returns true if field struct_map_2 is set (has been assigned a value) and false otherwise + public boolean isSetStruct_map_2() { + return this.struct_map_2 != null; + } + + public void setStruct_map_2IsSet(boolean __value) { + if (!__value) { + this.struct_map_2 = null; + } + } + + public Map getUnion_map_2() { + return this.union_map_2; + } + + public Containers setUnion_map_2(Map union_map_2) { + this.union_map_2 = union_map_2; + return this; + } + + public void unsetUnion_map_2() { + this.union_map_2 = null; + } + + // Returns true if field union_map_2 is set (has been assigned a value) and false otherwise + public boolean isSetUnion_map_2() { + return this.union_map_2 != null; + } + + public void setUnion_map_2IsSet(boolean __value) { + if (!__value) { + this.union_map_2 = null; + } + } + + public Map getEnum_map_2() { + return this.enum_map_2; + } + + public Containers setEnum_map_2(Map enum_map_2) { + this.enum_map_2 = enum_map_2; + return this; + } + + public void unsetEnum_map_2() { + this.enum_map_2 = null; + } + + // Returns true if field enum_map_2 is set (has been assigned a value) and false otherwise + public boolean isSetEnum_map_2() { + return this.enum_map_2 != null; + } + + public void setEnum_map_2IsSet(boolean __value) { + if (!__value) { + this.enum_map_2 = null; + } + } + + public Map,Integer> getList_map() { + return this.list_map; + } + + public Containers setList_map(Map,Integer> list_map) { + this.list_map = list_map; + return this; + } + + public void unsetList_map() { + this.list_map = null; + } + + // Returns true if field list_map is set (has been assigned a value) and false otherwise + public boolean isSetList_map() { + return this.list_map != null; + } + + public void setList_mapIsSet(boolean __value) { + if (!__value) { + this.list_map = null; + } + } + + public Map> getList_map_2() { + return this.list_map_2; + } + + public Containers setList_map_2(Map> list_map_2) { + this.list_map_2 = list_map_2; + return this; + } + + public void unsetList_map_2() { + this.list_map_2 = null; + } + + // Returns true if field list_map_2 is set (has been assigned a value) and false otherwise + public boolean isSetList_map_2() { + return this.list_map_2 != null; + } + + public void setList_map_2IsSet(boolean __value) { + if (!__value) { + this.list_map_2 = null; + } + } + + public Map,Integer> getSet_map() { + return this.set_map; + } + + public Containers setSet_map(Map,Integer> set_map) { + this.set_map = set_map; + return this; + } + + public void unsetSet_map() { + this.set_map = null; + } + + // Returns true if field set_map is set (has been assigned a value) and false otherwise + public boolean isSetSet_map() { + return this.set_map != null; + } + + public void setSet_mapIsSet(boolean __value) { + if (!__value) { + this.set_map = null; + } + } + + public Map> getSet_map_2() { + return this.set_map_2; + } + + public Containers setSet_map_2(Map> set_map_2) { + this.set_map_2 = set_map_2; + return this; + } + + public void unsetSet_map_2() { + this.set_map_2 = null; + } + + // Returns true if field set_map_2 is set (has been assigned a value) and false otherwise + public boolean isSetSet_map_2() { + return this.set_map_2 != null; + } + + public void setSet_map_2IsSet(boolean __value) { + if (!__value) { + this.set_map_2 = null; + } + } + + public Map,Integer> getMap_map() { + return this.map_map; + } + + public Containers setMap_map(Map,Integer> map_map) { + this.map_map = map_map; + return this; + } + + public void unsetMap_map() { + this.map_map = null; + } + + // Returns true if field map_map is set (has been assigned a value) and false otherwise + public boolean isSetMap_map() { + return this.map_map != null; + } + + public void setMap_mapIsSet(boolean __value) { + if (!__value) { + this.map_map = null; + } + } + + public Map> getMap_map_2() { + return this.map_map_2; + } + + public Containers setMap_map_2(Map> map_map_2) { + this.map_map_2 = map_map_2; + return this; + } + + public void unsetMap_map_2() { + this.map_map_2 = null; + } + + // Returns true if field map_map_2 is set (has been assigned a value) and false otherwise + public boolean isSetMap_map_2() { + return this.map_map_2 != null; + } + + public void setMap_map_2IsSet(boolean __value) { + if (!__value) { + this.map_map_2 = null; + } + } + + @SuppressWarnings("unchecked") + public void setFieldValue(int fieldID, Object __value) { + switch (fieldID) { + case STRUCT_LIST: + if (__value == null) { + unsetStruct_list(); + } else { + setStruct_list((List)__value); + } + break; + + case UNION_LIST: + if (__value == null) { + unsetUnion_list(); + } else { + setUnion_list((List)__value); + } + break; + + case ENUM_LIST: + if (__value == null) { + unsetEnum_list(); + } else { + setEnum_list((List)__value); + } + break; + + case STRUCT_SET: + if (__value == null) { + unsetStruct_set(); + } else { + setStruct_set((Set)__value); + } + break; + + case UNION_SET: + if (__value == null) { + unsetUnion_set(); + } else { + setUnion_set((Set)__value); + } + break; + + case ENUM_SET: + if (__value == null) { + unsetEnum_set(); + } else { + setEnum_set((Set)__value); + } + break; + + case STRUCT_MAP: + if (__value == null) { + unsetStruct_map(); + } else { + setStruct_map((Map)__value); + } + break; + + case UNION_MAP: + if (__value == null) { + unsetUnion_map(); + } else { + setUnion_map((Map)__value); + } + break; + + case ENUM_MAP: + if (__value == null) { + unsetEnum_map(); + } else { + setEnum_map((Map)__value); + } + break; + + case STRUCT_MAP_2: + if (__value == null) { + unsetStruct_map_2(); + } else { + setStruct_map_2((Map)__value); + } + break; + + case UNION_MAP_2: + if (__value == null) { + unsetUnion_map_2(); + } else { + setUnion_map_2((Map)__value); + } + break; + + case ENUM_MAP_2: + if (__value == null) { + unsetEnum_map_2(); + } else { + setEnum_map_2((Map)__value); + } + break; + + case LIST_MAP: + if (__value == null) { + unsetList_map(); + } else { + setList_map((Map,Integer>)__value); + } + break; + + case LIST_MAP_2: + if (__value == null) { + unsetList_map_2(); + } else { + setList_map_2((Map>)__value); + } + break; + + case SET_MAP: + if (__value == null) { + unsetSet_map(); + } else { + setSet_map((Map,Integer>)__value); + } + break; + + case SET_MAP_2: + if (__value == null) { + unsetSet_map_2(); + } else { + setSet_map_2((Map>)__value); + } + break; + + case MAP_MAP: + if (__value == null) { + unsetMap_map(); + } else { + setMap_map((Map,Integer>)__value); + } + break; + + case MAP_MAP_2: + if (__value == null) { + unsetMap_map_2(); + } else { + setMap_map_2((Map>)__value); + } + break; + + default: + throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); + } + } + + public Object getFieldValue(int fieldID) { + switch (fieldID) { + case STRUCT_LIST: + return getStruct_list(); + + case UNION_LIST: + return getUnion_list(); + + case ENUM_LIST: + return getEnum_list(); + + case STRUCT_SET: + return getStruct_set(); + + case UNION_SET: + return getUnion_set(); + + case ENUM_SET: + return getEnum_set(); + + case STRUCT_MAP: + return getStruct_map(); + + case UNION_MAP: + return getUnion_map(); + + case ENUM_MAP: + return getEnum_map(); + + case STRUCT_MAP_2: + return getStruct_map_2(); + + case UNION_MAP_2: + return getUnion_map_2(); + + case ENUM_MAP_2: + return getEnum_map_2(); + + case LIST_MAP: + return getList_map(); + + case LIST_MAP_2: + return getList_map_2(); + + case SET_MAP: + return getSet_map(); + + case SET_MAP_2: + return getSet_map_2(); + + case MAP_MAP: + return getMap_map(); + + case MAP_MAP_2: + return getMap_map_2(); + + default: + throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); + } + } + + @Override + public boolean equals(Object _that) { + if (_that == null) + return false; + if (this == _that) + return true; + if (!(_that instanceof Containers)) + return false; + Containers that = (Containers)_that; + + if (!TBaseHelper.equalsNobinary(this.isSetStruct_list(), that.isSetStruct_list(), this.struct_list, that.struct_list)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetUnion_list(), that.isSetUnion_list(), this.union_list, that.union_list)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetEnum_list(), that.isSetEnum_list(), this.enum_list, that.enum_list)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetStruct_set(), that.isSetStruct_set(), this.struct_set, that.struct_set)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetUnion_set(), that.isSetUnion_set(), this.union_set, that.union_set)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetEnum_set(), that.isSetEnum_set(), this.enum_set, that.enum_set)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetStruct_map(), that.isSetStruct_map(), this.struct_map, that.struct_map)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetUnion_map(), that.isSetUnion_map(), this.union_map, that.union_map)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetEnum_map(), that.isSetEnum_map(), this.enum_map, that.enum_map)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetStruct_map_2(), that.isSetStruct_map_2(), this.struct_map_2, that.struct_map_2)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetUnion_map_2(), that.isSetUnion_map_2(), this.union_map_2, that.union_map_2)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetEnum_map_2(), that.isSetEnum_map_2(), this.enum_map_2, that.enum_map_2)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetList_map(), that.isSetList_map(), this.list_map, that.list_map)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetList_map_2(), that.isSetList_map_2(), this.list_map_2, that.list_map_2)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetSet_map(), that.isSetSet_map(), this.set_map, that.set_map)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetSet_map_2(), that.isSetSet_map_2(), this.set_map_2, that.set_map_2)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetMap_map(), that.isSetMap_map(), this.map_map, that.map_map)) { return false; } + + if (!TBaseHelper.equalsNobinary(this.isSetMap_map_2(), that.isSetMap_map_2(), this.map_map_2, that.map_map_2)) { return false; } + + return true; + } + + @Override + public int hashCode() { + return Arrays.deepHashCode(new Object[] {struct_list, union_list, enum_list, struct_set, union_set, enum_set, struct_map, union_map, enum_map, struct_map_2, union_map_2, enum_map_2, list_map, list_map_2, set_map, set_map_2, map_map, map_map_2}); + } + + public void read(TProtocol iprot) throws TException { + TField __field; + iprot.readStructBegin(metaDataMap); + while (true) + { + __field = iprot.readFieldBegin(); + if (__field.type == TType.STOP) { + break; + } + switch (__field.id) + { + case STRUCT_LIST: + if (__field.type == TType.LIST) { + { + TList _list453 = iprot.readListBegin(); + this.struct_list = new ArrayList(Math.max(0, _list453.size)); + for (int _i454 = 0; + (_list453.size < 0) ? iprot.peekList() : (_i454 < _list453.size); + ++_i454) + { + MyStruct _elem455; + _elem455 = new MyStruct(); + _elem455.read(iprot); + this.struct_list.add(_elem455); + } + iprot.readListEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case UNION_LIST: + if (__field.type == TType.LIST) { + { + TList _list456 = iprot.readListBegin(); + this.union_list = new ArrayList(Math.max(0, _list456.size)); + for (int _i457 = 0; + (_list456.size < 0) ? iprot.peekList() : (_i457 < _list456.size); + ++_i457) + { + MyUnion _elem458; + _elem458 = new MyUnion(); + _elem458.read(iprot); + this.union_list.add(_elem458); + } + iprot.readListEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case ENUM_LIST: + if (__field.type == TType.LIST) { + { + TList _list459 = iprot.readListBegin(); + this.enum_list = new ArrayList(Math.max(0, _list459.size)); + for (int _i460 = 0; + (_list459.size < 0) ? iprot.peekList() : (_i460 < _list459.size); + ++_i460) + { + MyEnum _elem461; + _elem461 = MyEnum.findByValue(iprot.readI32()); + this.enum_list.add(_elem461); + } + iprot.readListEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case STRUCT_SET: + if (__field.type == TType.SET) { + { + TSet _set462 = iprot.readSetBegin(); + this.struct_set = new HashSet(Math.max(0, 2*_set462.size)); + for (int _i463 = 0; + (_set462.size < 0) ? iprot.peekSet() : (_i463 < _set462.size); + ++_i463) + { + MyStruct _elem464; + _elem464 = new MyStruct(); + _elem464.read(iprot); + this.struct_set.add(_elem464); + } + iprot.readSetEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case UNION_SET: + if (__field.type == TType.SET) { + { + TSet _set465 = iprot.readSetBegin(); + this.union_set = new HashSet(Math.max(0, 2*_set465.size)); + for (int _i466 = 0; + (_set465.size < 0) ? iprot.peekSet() : (_i466 < _set465.size); + ++_i466) + { + MyUnion _elem467; + _elem467 = new MyUnion(); + _elem467.read(iprot); + this.union_set.add(_elem467); + } + iprot.readSetEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case ENUM_SET: + if (__field.type == TType.SET) { + { + TSet _set468 = iprot.readSetBegin(); + this.enum_set = new HashSet(Math.max(0, 2*_set468.size)); + for (int _i469 = 0; + (_set468.size < 0) ? iprot.peekSet() : (_i469 < _set468.size); + ++_i469) + { + MyEnum _elem470; + _elem470 = MyEnum.findByValue(iprot.readI32()); + this.enum_set.add(_elem470); + } + iprot.readSetEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case STRUCT_MAP: + if (__field.type == TType.MAP) { + { + TMap _map471 = iprot.readMapBegin(); + this.struct_map = new HashMap(Math.max(0, 2*_map471.size)); + for (int _i472 = 0; + (_map471.size < 0) ? iprot.peekMap() : (_i472 < _map471.size); + ++_i472) + { + MyStruct _key473; + long _val474; + _key473 = new MyStruct(); + _key473.read(iprot); + _val474 = iprot.readI64(); + this.struct_map.put(_key473, _val474); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case UNION_MAP: + if (__field.type == TType.MAP) { + { + TMap _map475 = iprot.readMapBegin(); + this.union_map = new HashMap(Math.max(0, 2*_map475.size)); + for (int _i476 = 0; + (_map475.size < 0) ? iprot.peekMap() : (_i476 < _map475.size); + ++_i476) + { + MyUnion _key477; + long _val478; + _key477 = new MyUnion(); + _key477.read(iprot); + _val478 = iprot.readI64(); + this.union_map.put(_key477, _val478); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case ENUM_MAP: + if (__field.type == TType.MAP) { + { + TMap _map479 = iprot.readMapBegin(); + this.enum_map = new HashMap(Math.max(0, 2*_map479.size)); + for (int _i480 = 0; + (_map479.size < 0) ? iprot.peekMap() : (_i480 < _map479.size); + ++_i480) + { + MyEnum _key481; + long _val482; + _key481 = MyEnum.findByValue(iprot.readI32()); + _val482 = iprot.readI64(); + this.enum_map.put(_key481, _val482); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case STRUCT_MAP_2: + if (__field.type == TType.MAP) { + { + TMap _map483 = iprot.readMapBegin(); + this.struct_map_2 = new HashMap(Math.max(0, 2*_map483.size)); + for (int _i484 = 0; + (_map483.size < 0) ? iprot.peekMap() : (_i484 < _map483.size); + ++_i484) + { + int _key485; + MyStruct _val486; + _key485 = iprot.readI32(); + _val486 = new MyStruct(); + _val486.read(iprot); + this.struct_map_2.put(_key485, _val486); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case UNION_MAP_2: + if (__field.type == TType.MAP) { + { + TMap _map487 = iprot.readMapBegin(); + this.union_map_2 = new HashMap(Math.max(0, 2*_map487.size)); + for (int _i488 = 0; + (_map487.size < 0) ? iprot.peekMap() : (_i488 < _map487.size); + ++_i488) + { + int _key489; + MyUnion _val490; + _key489 = iprot.readI32(); + _val490 = new MyUnion(); + _val490.read(iprot); + this.union_map_2.put(_key489, _val490); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case ENUM_MAP_2: + if (__field.type == TType.MAP) { + { + TMap _map491 = iprot.readMapBegin(); + this.enum_map_2 = new HashMap(Math.max(0, 2*_map491.size)); + for (int _i492 = 0; + (_map491.size < 0) ? iprot.peekMap() : (_i492 < _map491.size); + ++_i492) + { + int _key493; + MyEnum _val494; + _key493 = iprot.readI32(); + _val494 = MyEnum.findByValue(iprot.readI32()); + this.enum_map_2.put(_key493, _val494); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case LIST_MAP: + if (__field.type == TType.MAP) { + { + TMap _map495 = iprot.readMapBegin(); + this.list_map = new HashMap,Integer>(Math.max(0, 2*_map495.size)); + for (int _i496 = 0; + (_map495.size < 0) ? iprot.peekMap() : (_i496 < _map495.size); + ++_i496) + { + List _key497; + int _val498; + { + TList _list499 = iprot.readListBegin(); + _key497 = new ArrayList(Math.max(0, _list499.size)); + for (int _i500 = 0; + (_list499.size < 0) ? iprot.peekList() : (_i500 < _list499.size); + ++_i500) + { + int _elem501; + _elem501 = iprot.readI32(); + _key497.add(_elem501); + } + iprot.readListEnd(); + } + _val498 = iprot.readI32(); + this.list_map.put(_key497, _val498); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case LIST_MAP_2: + if (__field.type == TType.MAP) { + { + TMap _map502 = iprot.readMapBegin(); + this.list_map_2 = new HashMap>(Math.max(0, 2*_map502.size)); + for (int _i503 = 0; + (_map502.size < 0) ? iprot.peekMap() : (_i503 < _map502.size); + ++_i503) + { + int _key504; + List _val505; + _key504 = iprot.readI32(); + { + TList _list506 = iprot.readListBegin(); + _val505 = new ArrayList(Math.max(0, _list506.size)); + for (int _i507 = 0; + (_list506.size < 0) ? iprot.peekList() : (_i507 < _list506.size); + ++_i507) + { + int _elem508; + _elem508 = iprot.readI32(); + _val505.add(_elem508); + } + iprot.readListEnd(); + } + this.list_map_2.put(_key504, _val505); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case SET_MAP: + if (__field.type == TType.MAP) { + { + TMap _map509 = iprot.readMapBegin(); + this.set_map = new HashMap,Integer>(Math.max(0, 2*_map509.size)); + for (int _i510 = 0; + (_map509.size < 0) ? iprot.peekMap() : (_i510 < _map509.size); + ++_i510) + { + Set _key511; + int _val512; + { + TSet _set513 = iprot.readSetBegin(); + _key511 = new HashSet(Math.max(0, 2*_set513.size)); + for (int _i514 = 0; + (_set513.size < 0) ? iprot.peekSet() : (_i514 < _set513.size); + ++_i514) + { + int _elem515; + _elem515 = iprot.readI32(); + _key511.add(_elem515); + } + iprot.readSetEnd(); + } + _val512 = iprot.readI32(); + this.set_map.put(_key511, _val512); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case SET_MAP_2: + if (__field.type == TType.MAP) { + { + TMap _map516 = iprot.readMapBegin(); + this.set_map_2 = new HashMap>(Math.max(0, 2*_map516.size)); + for (int _i517 = 0; + (_map516.size < 0) ? iprot.peekMap() : (_i517 < _map516.size); + ++_i517) + { + int _key518; + Set _val519; + _key518 = iprot.readI32(); + { + TSet _set520 = iprot.readSetBegin(); + _val519 = new HashSet(Math.max(0, 2*_set520.size)); + for (int _i521 = 0; + (_set520.size < 0) ? iprot.peekSet() : (_i521 < _set520.size); + ++_i521) + { + int _elem522; + _elem522 = iprot.readI32(); + _val519.add(_elem522); + } + iprot.readSetEnd(); + } + this.set_map_2.put(_key518, _val519); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case MAP_MAP: + if (__field.type == TType.MAP) { + { + TMap _map523 = iprot.readMapBegin(); + this.map_map = new HashMap,Integer>(Math.max(0, 2*_map523.size)); + for (int _i524 = 0; + (_map523.size < 0) ? iprot.peekMap() : (_i524 < _map523.size); + ++_i524) + { + Map _key525; + int _val526; + { + TMap _map527 = iprot.readMapBegin(); + _key525 = new HashMap(Math.max(0, 2*_map527.size)); + for (int _i528 = 0; + (_map527.size < 0) ? iprot.peekMap() : (_i528 < _map527.size); + ++_i528) + { + int _key529; + int _val530; + _key529 = iprot.readI32(); + _val530 = iprot.readI32(); + _key525.put(_key529, _val530); + } + iprot.readMapEnd(); + } + _val526 = iprot.readI32(); + this.map_map.put(_key525, _val526); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + case MAP_MAP_2: + if (__field.type == TType.MAP) { + { + TMap _map531 = iprot.readMapBegin(); + this.map_map_2 = new HashMap>(Math.max(0, 2*_map531.size)); + for (int _i532 = 0; + (_map531.size < 0) ? iprot.peekMap() : (_i532 < _map531.size); + ++_i532) + { + int _key533; + Map _val534; + _key533 = iprot.readI32(); + { + TMap _map535 = iprot.readMapBegin(); + _val534 = new HashMap(Math.max(0, 2*_map535.size)); + for (int _i536 = 0; + (_map535.size < 0) ? iprot.peekMap() : (_i536 < _map535.size); + ++_i536) + { + int _key537; + int _val538; + _key537 = iprot.readI32(); + _val538 = iprot.readI32(); + _val534.put(_key537, _val538); + } + iprot.readMapEnd(); + } + this.map_map_2.put(_key533, _val534); + } + iprot.readMapEnd(); + } + } else { + TProtocolUtil.skip(iprot, __field.type); + } + break; + default: + TProtocolUtil.skip(iprot, __field.type); + break; + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + + // check for required fields of primitive type, which can't be checked in the validate method + validate(); + } + + public void write(TProtocol oprot) throws TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.struct_list != null) { + oprot.writeFieldBegin(STRUCT_LIST_FIELD_DESC); + { + oprot.writeListBegin(new TList(TType.STRUCT, this.struct_list.size())); + for (MyStruct _iter539 : this.struct_list) { + _iter539.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (this.union_list != null) { + oprot.writeFieldBegin(UNION_LIST_FIELD_DESC); + { + oprot.writeListBegin(new TList(TType.STRUCT, this.union_list.size())); + for (MyUnion _iter540 : this.union_list) { + _iter540.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (this.enum_list != null) { + oprot.writeFieldBegin(ENUM_LIST_FIELD_DESC); + { + oprot.writeListBegin(new TList(TType.I32, this.enum_list.size())); + for (MyEnum _iter541 : this.enum_list) { + oprot.writeI32(_iter541 == null ? 0 : _iter541.getValue()); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (this.struct_set != null) { + oprot.writeFieldBegin(STRUCT_SET_FIELD_DESC); + { + oprot.writeSetBegin(new TSet(TType.STRUCT, this.struct_set.size())); + for (MyStruct _iter542 : this.struct_set) { + _iter542.write(oprot); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + if (this.union_set != null) { + oprot.writeFieldBegin(UNION_SET_FIELD_DESC); + { + oprot.writeSetBegin(new TSet(TType.STRUCT, this.union_set.size())); + for (MyUnion _iter543 : this.union_set) { + _iter543.write(oprot); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + if (this.enum_set != null) { + oprot.writeFieldBegin(ENUM_SET_FIELD_DESC); + { + oprot.writeSetBegin(new TSet(TType.I32, this.enum_set.size())); + for (MyEnum _iter544 : this.enum_set) { + oprot.writeI32(_iter544 == null ? 0 : _iter544.getValue()); + } + oprot.writeSetEnd(); + } + oprot.writeFieldEnd(); + } + if (this.struct_map != null) { + oprot.writeFieldBegin(STRUCT_MAP_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.STRUCT, TType.I64, this.struct_map.size())); + for (Map.Entry _iter545 : this.struct_map.entrySet()) { + _iter545.getKey().write(oprot); + oprot.writeI64(_iter545.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.union_map != null) { + oprot.writeFieldBegin(UNION_MAP_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.STRUCT, TType.I64, this.union_map.size())); + for (Map.Entry _iter546 : this.union_map.entrySet()) { + _iter546.getKey().write(oprot); + oprot.writeI64(_iter546.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.enum_map != null) { + oprot.writeFieldBegin(ENUM_MAP_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.I64, this.enum_map.size())); + for (Map.Entry _iter547 : this.enum_map.entrySet()) { + oprot.writeI32(_iter547.getKey() == null ? 0 : _iter547.getKey().getValue()); + oprot.writeI64(_iter547.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.struct_map_2 != null) { + oprot.writeFieldBegin(STRUCT_MAP_2_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, this.struct_map_2.size())); + for (Map.Entry _iter548 : this.struct_map_2.entrySet()) { + oprot.writeI32(_iter548.getKey()); + _iter548.getValue().write(oprot); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.union_map_2 != null) { + oprot.writeFieldBegin(UNION_MAP_2_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, this.union_map_2.size())); + for (Map.Entry _iter549 : this.union_map_2.entrySet()) { + oprot.writeI32(_iter549.getKey()); + _iter549.getValue().write(oprot); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.enum_map_2 != null) { + oprot.writeFieldBegin(ENUM_MAP_2_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.I32, this.enum_map_2.size())); + for (Map.Entry _iter550 : this.enum_map_2.entrySet()) { + oprot.writeI32(_iter550.getKey()); + oprot.writeI32(_iter550.getValue() == null ? 0 : _iter550.getValue().getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.list_map != null) { + oprot.writeFieldBegin(LIST_MAP_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.LIST, TType.I32, this.list_map.size())); + for (Map.Entry, Integer> _iter551 : this.list_map.entrySet()) { + { + oprot.writeListBegin(new TList(TType.I32, _iter551.getKey().size())); + for (int _iter552 : _iter551.getKey()) { + oprot.writeI32(_iter552); + } + oprot.writeListEnd(); + } + oprot.writeI32(_iter551.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.list_map_2 != null) { + oprot.writeFieldBegin(LIST_MAP_2_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.LIST, this.list_map_2.size())); + for (Map.Entry> _iter553 : this.list_map_2.entrySet()) { + oprot.writeI32(_iter553.getKey()); + { + oprot.writeListBegin(new TList(TType.I32, _iter553.getValue().size())); + for (int _iter554 : _iter553.getValue()) { + oprot.writeI32(_iter554); + } + oprot.writeListEnd(); + } + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.set_map != null) { + oprot.writeFieldBegin(SET_MAP_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.SET, TType.I32, this.set_map.size())); + for (Map.Entry, Integer> _iter555 : this.set_map.entrySet()) { + { + oprot.writeSetBegin(new TSet(TType.I32, _iter555.getKey().size())); + for (int _iter556 : _iter555.getKey()) { + oprot.writeI32(_iter556); + } + oprot.writeSetEnd(); + } + oprot.writeI32(_iter555.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.set_map_2 != null) { + oprot.writeFieldBegin(SET_MAP_2_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.SET, this.set_map_2.size())); + for (Map.Entry> _iter557 : this.set_map_2.entrySet()) { + oprot.writeI32(_iter557.getKey()); + { + oprot.writeSetBegin(new TSet(TType.I32, _iter557.getValue().size())); + for (int _iter558 : _iter557.getValue()) { + oprot.writeI32(_iter558); + } + oprot.writeSetEnd(); + } + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.map_map != null) { + oprot.writeFieldBegin(MAP_MAP_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.MAP, TType.I32, this.map_map.size())); + for (Map.Entry, Integer> _iter559 : this.map_map.entrySet()) { + { + oprot.writeMapBegin(new TMap(TType.I32, TType.I32, _iter559.getKey().size())); + for (Map.Entry _iter560 : _iter559.getKey().entrySet()) { + oprot.writeI32(_iter560.getKey()); + oprot.writeI32(_iter560.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeI32(_iter559.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + if (this.map_map_2 != null) { + oprot.writeFieldBegin(MAP_MAP_2_FIELD_DESC); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.MAP, this.map_map_2.size())); + for (Map.Entry> _iter561 : this.map_map_2.entrySet()) { + oprot.writeI32(_iter561.getKey()); + { + oprot.writeMapBegin(new TMap(TType.I32, TType.I32, _iter561.getValue().size())); + for (Map.Entry _iter562 : _iter561.getValue().entrySet()) { + oprot.writeI32(_iter562.getKey()); + oprot.writeI32(_iter562.getValue()); + } + oprot.writeMapEnd(); + } + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + return toString(1, true); + } + + @Override + public String toString(int indent, boolean prettyPrint) { + String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : ""; + String newLine = prettyPrint ? "\n" : ""; + String space = prettyPrint ? " " : ""; + StringBuilder sb = new StringBuilder("Containers"); + sb.append(space); + sb.append("("); + sb.append(newLine); + boolean first = true; + + sb.append(indentStr); + sb.append("struct_list"); + sb.append(space); + sb.append(":").append(space); + if (this.getStruct_list() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getStruct_list(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("union_list"); + sb.append(space); + sb.append(":").append(space); + if (this.getUnion_list() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getUnion_list(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("enum_list"); + sb.append(space); + sb.append(":").append(space); + if (this.getEnum_list() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getEnum_list(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("struct_set"); + sb.append(space); + sb.append(":").append(space); + if (this.getStruct_set() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getStruct_set(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("union_set"); + sb.append(space); + sb.append(":").append(space); + if (this.getUnion_set() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getUnion_set(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("enum_set"); + sb.append(space); + sb.append(":").append(space); + if (this.getEnum_set() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getEnum_set(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("struct_map"); + sb.append(space); + sb.append(":").append(space); + if (this.getStruct_map() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getStruct_map(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("union_map"); + sb.append(space); + sb.append(":").append(space); + if (this.getUnion_map() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getUnion_map(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("enum_map"); + sb.append(space); + sb.append(":").append(space); + if (this.getEnum_map() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getEnum_map(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("struct_map_2"); + sb.append(space); + sb.append(":").append(space); + if (this.getStruct_map_2() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getStruct_map_2(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("union_map_2"); + sb.append(space); + sb.append(":").append(space); + if (this.getUnion_map_2() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getUnion_map_2(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("enum_map_2"); + sb.append(space); + sb.append(":").append(space); + if (this.getEnum_map_2() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getEnum_map_2(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("list_map"); + sb.append(space); + sb.append(":").append(space); + if (this.getList_map() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getList_map(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("list_map_2"); + sb.append(space); + sb.append(":").append(space); + if (this.getList_map_2() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getList_map_2(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("set_map"); + sb.append(space); + sb.append(":").append(space); + if (this.getSet_map() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getSet_map(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("set_map_2"); + sb.append(space); + sb.append(":").append(space); + if (this.getSet_map_2() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getSet_map_2(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("map_map"); + sb.append(space); + sb.append(":").append(space); + if (this.getMap_map() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getMap_map(), indent + 1, prettyPrint)); + } + first = false; + if (!first) sb.append("," + newLine); + sb.append(indentStr); + sb.append("map_map_2"); + sb.append(space); + sb.append(":").append(space); + if (this.getMap_map_2() == null) { + sb.append("null"); + } else { + sb.append(TBaseHelper.toString(this.getMap_map_2(), indent + 1, prettyPrint)); + } + first = false; + sb.append(newLine + TBaseHelper.reduceIndent(indentStr)); + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + +} + diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_abstract_types.py b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_abstract_types.py index 45427ebb3b6..509b6009fce 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_abstract_types.py +++ b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_abstract_types.py @@ -511,6 +511,70 @@ def _to_python(self) -> "module.thrift_types.complexException": ... # type: ign def _to_py3(self) -> "module.types.complexException": ... # type: ignore def _to_py_deprecated(self) -> "module.ttypes.complexException": ... # type: ignore _fbthrift_complexException = complexException +class Containers(_abc.ABC): + @_fbthrift_property + @_abc.abstractmethod + def struct_list(self) -> _typing.Sequence[_fbthrift_MyStruct]: ... + @_fbthrift_property + @_abc.abstractmethod + def union_list(self) -> _typing.Sequence[_fbthrift_MyUnion]: ... + @_fbthrift_property + @_abc.abstractmethod + def enum_list(self) -> _typing.Sequence[_fbthrift_MyEnum]: ... + @_fbthrift_property + @_abc.abstractmethod + def struct_set(self) -> _typing.AbstractSet[_fbthrift_MyStruct]: ... + @_fbthrift_property + @_abc.abstractmethod + def union_set(self) -> _typing.AbstractSet[_fbthrift_MyUnion]: ... + @_fbthrift_property + @_abc.abstractmethod + def enum_set(self) -> _typing.AbstractSet[_fbthrift_MyEnum]: ... + @_fbthrift_property + @_abc.abstractmethod + def struct_map(self) -> _typing.Mapping[_fbthrift_MyStruct, int]: ... + @_fbthrift_property + @_abc.abstractmethod + def union_map(self) -> _typing.Mapping[_fbthrift_MyUnion, int]: ... + @_fbthrift_property + @_abc.abstractmethod + def enum_map(self) -> _typing.Mapping[_fbthrift_MyEnum, int]: ... + @_fbthrift_property + @_abc.abstractmethod + def struct_map_2(self) -> _typing.Mapping[int, _fbthrift_MyStruct]: ... + @_fbthrift_property + @_abc.abstractmethod + def union_map_2(self) -> _typing.Mapping[int, _fbthrift_MyUnion]: ... + @_fbthrift_property + @_abc.abstractmethod + def enum_map_2(self) -> _typing.Mapping[int, _fbthrift_MyEnum]: ... + @_fbthrift_property + @_abc.abstractmethod + def list_map(self) -> _typing.Mapping[_typing.Sequence[int], int]: ... + @_fbthrift_property + @_abc.abstractmethod + def list_map_2(self) -> _typing.Mapping[int, _typing.Sequence[int]]: ... + @_fbthrift_property + @_abc.abstractmethod + def set_map(self) -> _typing.Mapping[_typing.AbstractSet[int], int]: ... + @_fbthrift_property + @_abc.abstractmethod + def set_map_2(self) -> _typing.Mapping[int, _typing.AbstractSet[int]]: ... + @_fbthrift_property + @_abc.abstractmethod + def map_map(self) -> _typing.Mapping[_typing.Mapping[int, int], int]: ... + @_fbthrift_property + @_abc.abstractmethod + def map_map_2(self) -> _typing.Mapping[int, _typing.Mapping[int, int]]: ... + @_abc.abstractmethod + def _to_mutable_python(self) -> "module.thrift_mutable_types.Containers": ... # type: ignore + @_abc.abstractmethod + def _to_python(self) -> "module.thrift_types.Containers": ... # type: ignore + @_abc.abstractmethod + def _to_py3(self) -> "module.types.Containers": ... # type: ignore + @_abc.abstractmethod + def _to_py_deprecated(self) -> "module.ttypes.Containers": ... # type: ignore +_fbthrift_Containers = Containers stringTypedef = str longTypeDef = int diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_metadata.py b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_metadata.py index fff8ce03677..8772b7e9e61 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_metadata.py +++ b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_metadata.py @@ -692,6 +692,95 @@ def _fbthrift_gen_metadata_exception_complexException(metadata_struct: _fbthrift def gen_metadata_exception_complexException() -> _fbthrift_metadata.ThriftMetadata: return _fbthrift_gen_metadata_exception_complexException(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={})) +# TODO (ffrancet): This general pattern can be optimized by using tuples and dicts +# instead of re-generating thrift structs +def _fbthrift_gen_metadata_struct_Containers(metadata_struct: _fbthrift_metadata.ThriftMetadata) -> _fbthrift_metadata.ThriftMetadata: + qualified_name = "module.Containers" + + if qualified_name in metadata_struct.structs: + return metadata_struct + fields = [ + _fbthrift_metadata.ThriftField(id=1, type=_fbthrift_metadata.ThriftType(t_list=_fbthrift_metadata.ThriftListType(valueType=_fbthrift_metadata.ThriftType(t_struct=_fbthrift_metadata.ThriftStructType(name="module.MyStruct")))), name="struct_list", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=2, type=_fbthrift_metadata.ThriftType(t_list=_fbthrift_metadata.ThriftListType(valueType=_fbthrift_metadata.ThriftType(t_union=_fbthrift_metadata.ThriftUnionType(name="module.MyUnion")))), name="union_list", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=3, type=_fbthrift_metadata.ThriftType(t_list=_fbthrift_metadata.ThriftListType(valueType=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum")))), name="enum_list", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=4, type=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_struct=_fbthrift_metadata.ThriftStructType(name="module.MyStruct")))), name="struct_set", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=5, type=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_union=_fbthrift_metadata.ThriftUnionType(name="module.MyUnion")))), name="union_set", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=6, type=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum")))), name="enum_set", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=7, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_struct=_fbthrift_metadata.ThriftStructType(name="module.MyStruct")),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I64_TYPE))), name="struct_map", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=8, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_union=_fbthrift_metadata.ThriftUnionType(name="module.MyUnion")),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I64_TYPE))), name="union_map", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=9, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum")),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I64_TYPE))), name="enum_map", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=10, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_struct=_fbthrift_metadata.ThriftStructType(name="module.MyStruct")))), name="struct_map_2", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=11, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_union=_fbthrift_metadata.ThriftUnionType(name="module.MyUnion")))), name="union_map_2", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=12, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_enum=_fbthrift_metadata.ThriftEnumType(name="module.MyEnum")))), name="enum_map_2", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=13, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_list=_fbthrift_metadata.ThriftListType(valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))), name="list_map", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=14, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_list=_fbthrift_metadata.ThriftListType(valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))))), name="list_map_2", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=15, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))), name="set_map", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=16, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_set=_fbthrift_metadata.ThriftSetType(valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))))), name="set_map_2", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=17, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))), name="map_map", is_optional=False, structured_annotations=[ + ]), + _fbthrift_metadata.ThriftField(id=18, type=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_map=_fbthrift_metadata.ThriftMapType(keyType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE),valueType=_fbthrift_metadata.ThriftType(t_primitive=_fbthrift_metadata.ThriftPrimitiveType.THRIFT_I32_TYPE))))), name="map_map_2", is_optional=False, structured_annotations=[ + ]), + ] + struct_dict = dict(metadata_struct.structs) + struct_dict[qualified_name] = _fbthrift_metadata.ThriftStruct(name=qualified_name, fields=fields, + is_union=False, + structured_annotations=[ + ]) + new_struct = metadata_struct(structs=struct_dict) + + # struct_list + new_struct = _fbthrift_gen_metadata_struct_MyStruct(new_struct) # union_list + new_struct = _fbthrift_gen_metadata_struct_MyUnion(new_struct) # enum_list + new_struct = module.thrift_enums._fbthrift_gen_metadata_enum_MyEnum(new_struct) # struct_set + new_struct = _fbthrift_gen_metadata_struct_MyStruct(new_struct) # union_set + new_struct = _fbthrift_gen_metadata_struct_MyUnion(new_struct) # enum_set + new_struct = module.thrift_enums._fbthrift_gen_metadata_enum_MyEnum(new_struct) # struct_map + new_struct = _fbthrift_gen_metadata_struct_MyStruct(new_struct) # key + # val # union_map + new_struct = _fbthrift_gen_metadata_struct_MyUnion(new_struct) # key + # val # enum_map + new_struct = module.thrift_enums._fbthrift_gen_metadata_enum_MyEnum(new_struct) # key + # val # struct_map_2 + # key + new_struct = _fbthrift_gen_metadata_struct_MyStruct(new_struct) # val # union_map_2 + # key + new_struct = _fbthrift_gen_metadata_struct_MyUnion(new_struct) # val # enum_map_2 + # key + new_struct = module.thrift_enums._fbthrift_gen_metadata_enum_MyEnum(new_struct) # val # list_map + # key + # val # list_map_2 + # key + # val # set_map + # key + # val # set_map_2 + # key + # val # map_map + # key + # val # key + # val # map_map_2 + # key + # key + # val # val + return new_struct +def gen_metadata_struct_Containers() -> _fbthrift_metadata.ThriftMetadata: + return _fbthrift_gen_metadata_struct_Containers(_fbthrift_metadata.ThriftMetadata(structs={}, enums={}, exceptions={}, services={})) + def getThriftModuleMetadata() -> _fbthrift_metadata.ThriftMetadata: @@ -712,4 +801,5 @@ def getThriftModuleMetadata() -> _fbthrift_metadata.ThriftMetadata: meta = _fbthrift_gen_metadata_exception_reqXcep(meta) meta = _fbthrift_gen_metadata_exception_optXcep(meta) meta = _fbthrift_gen_metadata_exception_complexException(meta) + meta = _fbthrift_gen_metadata_struct_Containers(meta) return meta diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.py b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.py index 94b94adcbfd..d751b32bef0 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.py +++ b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.py @@ -1909,6 +1909,249 @@ def _to_py_deprecated(self): return thrift.util.converter.to_py_struct(py_asyncio_types.complexException, self) _fbthrift_complexException = complexException +class Containers(metaclass=_fbthrift_python_mutable_types.MutableStructMeta): + _fbthrift_SPEC = ( + _fbthrift_python_types.FieldInfo( + 1, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_list", # name + "struct_list", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableListTypeInfo(_fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyStruct)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 14, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 2, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_list", # name + "union_list", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableListTypeInfo(_fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyUnion)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 14, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 3, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_list", # name + "enum_list", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableListTypeInfo(_fbthrift_python_types.EnumTypeInfo(MyEnum)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 14, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 4, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_set", # name + "struct_set", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableSetTypeInfo(_fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyStruct)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 15, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 5, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_set", # name + "union_set", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableSetTypeInfo(_fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyUnion)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 15, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 6, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_set", # name + "enum_set", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableSetTypeInfo(_fbthrift_python_types.EnumTypeInfo(MyEnum)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 15, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 7, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_map", # name + "struct_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyStruct), _fbthrift_python_types.typeinfo_i64), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 8, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_map", # name + "union_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyUnion), _fbthrift_python_types.typeinfo_i64), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 9, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_map", # name + "enum_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.EnumTypeInfo(MyEnum), _fbthrift_python_types.typeinfo_i64), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 10, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_map_2", # name + "struct_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyStruct)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 11, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_map_2", # name + "union_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_mutable_typeinfos.MutableStructTypeInfo(MyUnion)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 12, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_map_2", # name + "enum_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.EnumTypeInfo(MyEnum)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 13, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "list_map", # name + "list_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_mutable_typeinfos.MutableListTypeInfo(_fbthrift_python_types.typeinfo_i32), _fbthrift_python_types.typeinfo_i32), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 14, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "list_map_2", # name + "list_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_mutable_typeinfos.MutableListTypeInfo(_fbthrift_python_types.typeinfo_i32)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 15, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "set_map", # name + "set_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_mutable_typeinfos.MutableSetTypeInfo(_fbthrift_python_types.typeinfo_i32), _fbthrift_python_types.typeinfo_i32), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 16, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "set_map_2", # name + "set_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_mutable_typeinfos.MutableSetTypeInfo(_fbthrift_python_types.typeinfo_i32)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 17, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "map_map", # name + "map_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i32), _fbthrift_python_types.typeinfo_i32), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 18, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "map_map_2", # name + "map_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_mutable_typeinfos.MutableMapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i32)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + ) + + @staticmethod + def __get_thrift_name__() -> str: + return "module.Containers" + + @staticmethod + def __get_thrift_uri__(): + return None + + @staticmethod + def __get_metadata__(): + raise NotImplementedError(f"__get_metadata__() is not yet implemented for mutable thrift-python structs: {type(self)}") + + + def _to_python(self): + import thrift.python.converter + import importlib + immutable_types = importlib.import_module("module.thrift_types") + return thrift.python.converter.to_python_struct(immutable_types.Containers, self) + + def _to_mutable_python(self): + return self + + def _to_py3(self): + import importlib + py3_types = importlib.import_module("module.types") + import thrift.py3.converter + return thrift.py3.converter.to_py3_struct(py3_types.Containers, self) + + def _to_py_deprecated(self): + import importlib + import thrift.util.converter + try: + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.Containers, self) + except ModuleNotFoundError: + py_asyncio_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_asyncio_types.Containers, self) + +_fbthrift_ABCMeta.register(_fbthrift_abstract_types.Containers, Containers) +_fbthrift_Containers = Containers + _fbthrift_all_enums = [ MyEnum, @@ -1931,6 +2174,7 @@ def _to_py_deprecated(self): reqXcep, optXcep, complexException, + Containers, ] _fbthrift_python_mutable_types.fill_specs(*_fbthrift_all_structs) diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.pyi b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.pyi index e9b550f8ae4..785cfb7cb3e 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.pyi +++ b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_mutable_types.pyi @@ -1178,6 +1178,169 @@ class complexException(_fbthrift_python_mutable_exceptions.MutableGeneratedError def _to_py_deprecated(self) -> "module.ttypes.complexException": ... # type: ignore _fbthrift_complexException = complexException +class _fbthrift_compatible_with_Containers: + pass + + +class Containers(_fbthrift_python_mutable_types.MutableStruct, _fbthrift_compatible_with_Containers, _fbthrift_python_abstract_types.Containers): + + @property + def struct_list(self) -> _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyStruct]: ... + @struct_list.setter + def struct_list(self, value: _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyStruct] | _fbthrift_python_mutable_types._ThriftListWrapper) -> None: ... + + + @property + def union_list(self) -> _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyUnion]: ... + @union_list.setter + def union_list(self, value: _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyUnion] | _fbthrift_python_mutable_types._ThriftListWrapper) -> None: ... + + + @property + def enum_list(self) -> _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyEnum]: ... + @enum_list.setter + def enum_list(self, value: _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyEnum] | _fbthrift_python_mutable_types._ThriftListWrapper) -> None: ... + + + @property + def struct_set(self) -> _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyStruct]: ... + @struct_set.setter + def struct_set(self, value: _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyStruct] | _fbthrift_python_mutable_types._ThriftSetWrapper) -> None: ... + + + @property + def union_set(self) -> _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyUnion]: ... + @union_set.setter + def union_set(self, value: _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyUnion] | _fbthrift_python_mutable_types._ThriftSetWrapper) -> None: ... + + + @property + def enum_set(self) -> _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyEnum]: ... + @enum_set.setter + def enum_set(self, value: _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyEnum] | _fbthrift_python_mutable_types._ThriftSetWrapper) -> None: ... + + + @property + def struct_map(self) -> _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyStruct, int]: ... + @struct_map.setter + def struct_map(self, value: _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyStruct, int] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def union_map(self) -> _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyUnion, int]: ... + @union_map.setter + def union_map(self, value: _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyUnion, int] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def enum_map(self) -> _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyEnum, int]: ... + @enum_map.setter + def enum_map(self, value: _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyEnum, int] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def struct_map_2(self) -> _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyStruct]: ... + @struct_map_2.setter + def struct_map_2(self, value: _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyStruct] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def union_map_2(self) -> _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyUnion]: ... + @union_map_2.setter + def union_map_2(self, value: _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyUnion] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def enum_map_2(self) -> _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyEnum]: ... + @enum_map_2.setter + def enum_map_2(self, value: _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyEnum] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def list_map(self) -> _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableList[int], int]: ... + @list_map.setter + def list_map(self, value: _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableList[int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def list_map_2(self) -> _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableList[int]]: ... + @list_map_2.setter + def list_map_2(self, value: _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableList[int]] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def set_map(self) -> _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableSet[int], int]: ... + @set_map.setter + def set_map(self, value: _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableSet[int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def set_map_2(self) -> _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableSet[int]]: ... + @set_map_2.setter + def set_map_2(self, value: _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableSet[int]] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def map_map(self) -> _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableMap[int, int], int]: ... + @map_map.setter + def map_map(self, value: _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableMap[int, int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + + @property + def map_map_2(self) -> _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableMap[int, int]]: ... + @map_map_2.setter + def map_map_2(self, value: _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableMap[int, int]] | _fbthrift_python_mutable_types._ThriftMapWrapper) -> None: ... + + def __init__( + self, *, + struct_list: _typing.Optional[_fbthrift_python_mutable_containers.MutableList[_fbthrift_compatible_with_MyStruct] | _fbthrift_python_mutable_types._ThriftListWrapper]=..., + union_list: _typing.Optional[_fbthrift_python_mutable_containers.MutableList[_fbthrift_compatible_with_MyUnion] | _fbthrift_python_mutable_types._ThriftListWrapper]=..., + enum_list: _typing.Optional[_fbthrift_python_mutable_containers.MutableList[_fbthrift_compatible_with_MyEnum] | _fbthrift_python_mutable_types._ThriftListWrapper]=..., + struct_set: _typing.Optional[_fbthrift_python_mutable_containers.MutableSet[_fbthrift_compatible_with_MyStruct] | _fbthrift_python_mutable_types._ThriftSetWrapper]=..., + union_set: _typing.Optional[_fbthrift_python_mutable_containers.MutableSet[_fbthrift_compatible_with_MyUnion] | _fbthrift_python_mutable_types._ThriftSetWrapper]=..., + enum_set: _typing.Optional[_fbthrift_python_mutable_containers.MutableSet[_fbthrift_compatible_with_MyEnum] | _fbthrift_python_mutable_types._ThriftSetWrapper]=..., + struct_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyStruct, int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + union_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyUnion, int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + enum_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyEnum, int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + struct_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_compatible_with_MyStruct] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + union_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_compatible_with_MyUnion] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + enum_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_compatible_with_MyEnum] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + list_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableList[int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + list_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableList[int]] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + set_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableSet[int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + set_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableSet[int]] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + map_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableMap[int, int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + map_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableMap[int, int]] | _fbthrift_python_mutable_types._ThriftMapWrapper]=... + ) -> None: ... + + def __call__( + self, *, + struct_list: _typing.Optional[_fbthrift_python_mutable_containers.MutableList[_fbthrift_compatible_with_MyStruct] | _fbthrift_python_mutable_types._ThriftListWrapper]=..., + union_list: _typing.Optional[_fbthrift_python_mutable_containers.MutableList[_fbthrift_compatible_with_MyUnion] | _fbthrift_python_mutable_types._ThriftListWrapper]=..., + enum_list: _typing.Optional[_fbthrift_python_mutable_containers.MutableList[_fbthrift_compatible_with_MyEnum] | _fbthrift_python_mutable_types._ThriftListWrapper]=..., + struct_set: _typing.Optional[_fbthrift_python_mutable_containers.MutableSet[_fbthrift_compatible_with_MyStruct] | _fbthrift_python_mutable_types._ThriftSetWrapper]=..., + union_set: _typing.Optional[_fbthrift_python_mutable_containers.MutableSet[_fbthrift_compatible_with_MyUnion] | _fbthrift_python_mutable_types._ThriftSetWrapper]=..., + enum_set: _typing.Optional[_fbthrift_python_mutable_containers.MutableSet[_fbthrift_compatible_with_MyEnum] | _fbthrift_python_mutable_types._ThriftSetWrapper]=..., + struct_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyStruct, int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + union_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyUnion, int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + enum_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyEnum, int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + struct_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_compatible_with_MyStruct] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + union_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_compatible_with_MyUnion] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + enum_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_compatible_with_MyEnum] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + list_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableList[int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + list_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableList[int]] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + set_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableSet[int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + set_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableSet[int]] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + map_map: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableMap[int, int], int] | _fbthrift_python_mutable_types._ThriftMapWrapper]=..., + map_map_2: _typing.Optional[_fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableMap[int, int]] | _fbthrift_python_mutable_types._ThriftMapWrapper]=... + ) -> _typing.Self: ... + def __iter__(self) -> _typing.Iterator[_typing.Tuple[str, _typing.Union[_fbthrift_python_mutable_containers.MutableList[_fbthrift_MyStruct], _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyUnion], _fbthrift_python_mutable_containers.MutableList[_fbthrift_MyEnum], _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyStruct], _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyUnion], _fbthrift_python_mutable_containers.MutableSet[_fbthrift_MyEnum], _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyStruct, int], _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyUnion, int], _fbthrift_python_mutable_containers.MutableMap[_fbthrift_MyEnum, int], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyStruct], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyUnion], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_MyEnum], _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableList[int], int], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableList[int]], _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableSet[int], int], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableSet[int]], _fbthrift_python_mutable_containers.MutableMap[_fbthrift_python_mutable_containers.MutableMap[int, int], int], _fbthrift_python_mutable_containers.MutableMap[int, _fbthrift_python_mutable_containers.MutableMap[int, int]]]]]: ... + def _to_python(self) -> "module.thrift_types.Containers": ... # type: ignore + def _to_mutable_python(self) -> _typing.Self: ... + def _to_py3(self) -> "module.types.Containers": ... # type: ignore + def _to_py_deprecated(self) -> "module.ttypes.Containers": ... # type: ignore +_fbthrift_Containers = Containers + DEFAULT_PORT_NUM: int = ... diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.py b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.py index 7e813695bd6..4a7c6f6d9aa 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.py +++ b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.py @@ -1891,6 +1891,248 @@ def _to_py_deprecated(self): return thrift.util.converter.to_py_struct(py_asyncio_types.complexException, self) _fbthrift_complexException = complexException +class Containers(metaclass=_fbthrift_python_types.StructMeta): + _fbthrift_SPEC = ( + _fbthrift_python_types.FieldInfo( + 1, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_list", # name + "struct_list", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.ListTypeInfo(_fbthrift_python_types.StructTypeInfo(MyStruct)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 14, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 2, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_list", # name + "union_list", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.ListTypeInfo(_fbthrift_python_types.StructTypeInfo(MyUnion)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 14, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 3, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_list", # name + "enum_list", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.ListTypeInfo(_fbthrift_python_types.EnumTypeInfo(MyEnum)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 14, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 4, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_set", # name + "struct_set", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.SetTypeInfo(_fbthrift_python_types.StructTypeInfo(MyStruct)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 15, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 5, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_set", # name + "union_set", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.SetTypeInfo(_fbthrift_python_types.StructTypeInfo(MyUnion)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 15, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 6, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_set", # name + "enum_set", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.SetTypeInfo(_fbthrift_python_types.EnumTypeInfo(MyEnum)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 15, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 7, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_map", # name + "struct_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.StructTypeInfo(MyStruct), _fbthrift_python_types.typeinfo_i64), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 8, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_map", # name + "union_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.StructTypeInfo(MyUnion), _fbthrift_python_types.typeinfo_i64), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 9, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_map", # name + "enum_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.EnumTypeInfo(MyEnum), _fbthrift_python_types.typeinfo_i64), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 10, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "struct_map_2", # name + "struct_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.StructTypeInfo(MyStruct)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 11, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "union_map_2", # name + "union_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.StructTypeInfo(MyUnion)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 12, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "enum_map_2", # name + "enum_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.EnumTypeInfo(MyEnum)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 13, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "list_map", # name + "list_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.ListTypeInfo(_fbthrift_python_types.typeinfo_i32), _fbthrift_python_types.typeinfo_i32), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 14, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "list_map_2", # name + "list_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.ListTypeInfo(_fbthrift_python_types.typeinfo_i32)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 15, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "set_map", # name + "set_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.SetTypeInfo(_fbthrift_python_types.typeinfo_i32), _fbthrift_python_types.typeinfo_i32), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 16, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "set_map_2", # name + "set_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.SetTypeInfo(_fbthrift_python_types.typeinfo_i32)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 17, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "map_map", # name + "map_map", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i32), _fbthrift_python_types.typeinfo_i32), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + _fbthrift_python_types.FieldInfo( + 18, # id + _fbthrift_python_types.FieldQualifier.Unqualified, # qualifier + "map_map_2", # name + "map_map_2", # python name (from @python.Name annotation) + lambda: _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.MapTypeInfo(_fbthrift_python_types.typeinfo_i32, _fbthrift_python_types.typeinfo_i32)), # typeinfo + None, # default value + None, # adapter info + False, # field type is primitive + 16, # IDL type (see BaseTypeEnum) + ), + ) + + @staticmethod + def __get_thrift_name__() -> str: + return "module.Containers" + + @staticmethod + def __get_thrift_uri__(): + return None + + @staticmethod + def __get_metadata__(): + return _fbthrift_metadata__struct_Containers() + + def _to_python(self): + return self + + def _to_mutable_python(self): + import thrift.python.mutable_converter + import importlib + mutable_types = importlib.import_module("module.thrift_mutable_types") + return thrift.python.mutable_converter.to_mutable_python_struct_or_union(mutable_types.Containers, self) + + def _to_py3(self): + import importlib + py3_types = importlib.import_module("module.types") + import thrift.py3.converter + return thrift.py3.converter.to_py3_struct(py3_types.Containers, self) + + def _to_py_deprecated(self): + import importlib + import thrift.util.converter + try: + py_deprecated_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_deprecated_types.Containers, self) + except ModuleNotFoundError: + py_asyncio_types = importlib.import_module("module.ttypes") + return thrift.util.converter.to_py_struct(py_asyncio_types.Containers, self) + +_fbthrift_ABCMeta.register(_fbthrift_abstract_types.Containers, Containers) +_fbthrift_Containers = Containers + # This unfortunately has to be down here to prevent circular imports import module.thrift_metadata @@ -1959,6 +2201,10 @@ def _fbthrift_metadata__exception_complexException(): return module.thrift_metadata.gen_metadata_exception_complexException() +def _fbthrift_metadata__struct_Containers(): + return module.thrift_metadata.gen_metadata_struct_Containers() + + _fbthrift_all_structs = [ MyStructFloatFieldThrowExp, MyStructMapFloatThrowExp, @@ -1975,6 +2221,7 @@ def _fbthrift_metadata__exception_complexException(): reqXcep, optXcep, complexException, + Containers, ] _fbthrift_python_types.fill_specs(*_fbthrift_all_structs) diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.pyi b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.pyi index 4f2ff810a73..5743828a607 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.pyi +++ b/thrift/compiler/test/fixtures/complex-struct/out/python/gen-python/module/thrift_types.pyi @@ -643,6 +643,79 @@ class complexException(_fbthrift_python_exceptions.GeneratedError, _fbthrift_com def _to_py_deprecated(self) -> "module.ttypes.complexException": ... # type: ignore _fbthrift_complexException = complexException +class _fbthrift_compatible_with_Containers: + pass + + +class Containers(_fbthrift_python_types.Struct, _fbthrift_compatible_with_Containers, _fbthrift_python_abstract_types.Containers): + struct_list: _typing.Final[_typing.Sequence[_fbthrift_MyStruct]] = ... + union_list: _typing.Final[_typing.Sequence[_fbthrift_MyUnion]] = ... + enum_list: _typing.Final[_typing.Sequence[_fbthrift_MyEnum]] = ... + struct_set: _typing.Final[_typing.AbstractSet[_fbthrift_MyStruct]] = ... + union_set: _typing.Final[_typing.AbstractSet[_fbthrift_MyUnion]] = ... + enum_set: _typing.Final[_typing.AbstractSet[_fbthrift_MyEnum]] = ... + struct_map: _typing.Final[_typing.Mapping[_fbthrift_MyStruct, int]] = ... + union_map: _typing.Final[_typing.Mapping[_fbthrift_MyUnion, int]] = ... + enum_map: _typing.Final[_typing.Mapping[_fbthrift_MyEnum, int]] = ... + struct_map_2: _typing.Final[_typing.Mapping[int, _fbthrift_MyStruct]] = ... + union_map_2: _typing.Final[_typing.Mapping[int, _fbthrift_MyUnion]] = ... + enum_map_2: _typing.Final[_typing.Mapping[int, _fbthrift_MyEnum]] = ... + list_map: _typing.Final[_typing.Mapping[_typing.Sequence[int], int]] = ... + list_map_2: _typing.Final[_typing.Mapping[int, _typing.Sequence[int]]] = ... + set_map: _typing.Final[_typing.Mapping[_typing.AbstractSet[int], int]] = ... + set_map_2: _typing.Final[_typing.Mapping[int, _typing.AbstractSet[int]]] = ... + map_map: _typing.Final[_typing.Mapping[_typing.Mapping[int, int], int]] = ... + map_map_2: _typing.Final[_typing.Mapping[int, _typing.Mapping[int, int]]] = ... + def __init__( + self, *, + struct_list: _typing.Optional[_typing.Sequence[_fbthrift_compatible_with_MyStruct]]=..., + union_list: _typing.Optional[_typing.Sequence[_fbthrift_compatible_with_MyUnion]]=..., + enum_list: _typing.Optional[_typing.Sequence[_fbthrift_compatible_with_MyEnum]]=..., + struct_set: _typing.Optional[_typing.AbstractSet[_fbthrift_compatible_with_MyStruct]]=..., + union_set: _typing.Optional[_typing.AbstractSet[_fbthrift_compatible_with_MyUnion]]=..., + enum_set: _typing.Optional[_typing.AbstractSet[_fbthrift_compatible_with_MyEnum]]=..., + struct_map: _typing.Optional[_typing.Mapping[_fbthrift_MyStruct, int]]=..., + union_map: _typing.Optional[_typing.Mapping[_fbthrift_MyUnion, int]]=..., + enum_map: _typing.Optional[_typing.Mapping[_fbthrift_MyEnum, int]]=..., + struct_map_2: _typing.Optional[_typing.Mapping[int, _fbthrift_compatible_with_MyStruct]]=..., + union_map_2: _typing.Optional[_typing.Mapping[int, _fbthrift_compatible_with_MyUnion]]=..., + enum_map_2: _typing.Optional[_typing.Mapping[int, _fbthrift_compatible_with_MyEnum]]=..., + list_map: _typing.Optional[_typing.Mapping[_typing.Sequence[int], int]]=..., + list_map_2: _typing.Optional[_typing.Mapping[int, _typing.Sequence[int]]]=..., + set_map: _typing.Optional[_typing.Mapping[_typing.AbstractSet[int], int]]=..., + set_map_2: _typing.Optional[_typing.Mapping[int, _typing.AbstractSet[int]]]=..., + map_map: _typing.Optional[_typing.Mapping[_typing.Mapping[int, int], int]]=..., + map_map_2: _typing.Optional[_typing.Mapping[int, _typing.Mapping[int, int]]]=... + ) -> None: ... + + def __call__( + self, *, + struct_list: _typing.Optional[_typing.Sequence[_fbthrift_compatible_with_MyStruct]]=..., + union_list: _typing.Optional[_typing.Sequence[_fbthrift_compatible_with_MyUnion]]=..., + enum_list: _typing.Optional[_typing.Sequence[_fbthrift_compatible_with_MyEnum]]=..., + struct_set: _typing.Optional[_typing.AbstractSet[_fbthrift_compatible_with_MyStruct]]=..., + union_set: _typing.Optional[_typing.AbstractSet[_fbthrift_compatible_with_MyUnion]]=..., + enum_set: _typing.Optional[_typing.AbstractSet[_fbthrift_compatible_with_MyEnum]]=..., + struct_map: _typing.Optional[_typing.Mapping[_fbthrift_MyStruct, int]]=..., + union_map: _typing.Optional[_typing.Mapping[_fbthrift_MyUnion, int]]=..., + enum_map: _typing.Optional[_typing.Mapping[_fbthrift_MyEnum, int]]=..., + struct_map_2: _typing.Optional[_typing.Mapping[int, _fbthrift_compatible_with_MyStruct]]=..., + union_map_2: _typing.Optional[_typing.Mapping[int, _fbthrift_compatible_with_MyUnion]]=..., + enum_map_2: _typing.Optional[_typing.Mapping[int, _fbthrift_compatible_with_MyEnum]]=..., + list_map: _typing.Optional[_typing.Mapping[_typing.Sequence[int], int]]=..., + list_map_2: _typing.Optional[_typing.Mapping[int, _typing.Sequence[int]]]=..., + set_map: _typing.Optional[_typing.Mapping[_typing.AbstractSet[int], int]]=..., + set_map_2: _typing.Optional[_typing.Mapping[int, _typing.AbstractSet[int]]]=..., + map_map: _typing.Optional[_typing.Mapping[_typing.Mapping[int, int], int]]=..., + map_map_2: _typing.Optional[_typing.Mapping[int, _typing.Mapping[int, int]]]=... + ) -> _typing.Self: ... + def __iter__(self) -> _typing.Iterator[_typing.Tuple[str, _typing.Union[_typing.Sequence[_fbthrift_MyStruct], _typing.Sequence[_fbthrift_MyUnion], _typing.Sequence[_fbthrift_MyEnum], _typing.AbstractSet[_fbthrift_MyStruct], _typing.AbstractSet[_fbthrift_MyUnion], _typing.AbstractSet[_fbthrift_MyEnum], _typing.Mapping[_fbthrift_MyStruct, int], _typing.Mapping[_fbthrift_MyUnion, int], _typing.Mapping[_fbthrift_MyEnum, int], _typing.Mapping[int, _fbthrift_MyStruct], _typing.Mapping[int, _fbthrift_MyUnion], _typing.Mapping[int, _fbthrift_MyEnum], _typing.Mapping[_typing.Sequence[int], int], _typing.Mapping[int, _typing.Sequence[int]], _typing.Mapping[_typing.AbstractSet[int], int], _typing.Mapping[int, _typing.AbstractSet[int]], _typing.Mapping[_typing.Mapping[int, int], int], _typing.Mapping[int, _typing.Mapping[int, int]]]]]: ... + def _to_python(self) -> _typing.Self: ... + def _to_mutable_python(self) -> "module.thrift_mutable_types.Containers": ... # type: ignore + def _to_py3(self) -> "module.types.Containers": ... # type: ignore + def _to_py_deprecated(self) -> "module.ttypes.Containers": ... # type: ignore +_fbthrift_Containers = Containers + DEFAULT_PORT_NUM: int = ... diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pxd b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pxd index 0f7c4b31d4b..4c8196d353e 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pxd +++ b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pxd @@ -38,6 +38,8 @@ cdef extern from "thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_t coptXcep() cdef cppclass ccomplexException "::cpp2::complexException": ccomplexException() + cdef cppclass cContainers "::cpp2::Containers": + cContainers() cdef extern from "thrift/compiler/test/fixtures/complex-struct/gen-cpp2/module_types.h": cdef cppclass cMyEnum "::cpp2::MyEnum": @@ -87,3 +89,6 @@ cdef object optXcep_from_cpp(const coptXcep& c_struct) cdef ccomplexException complexException_convert_to_cpp(object inst) except* cdef object complexException_from_cpp(const ccomplexException& c_struct) +cdef cContainers Containers_convert_to_cpp(object inst) except* +cdef object Containers_from_cpp(const cContainers& c_struct) + diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pyx b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pyx index 8f9287d1983..44eb88d73b6 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pyx +++ b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_converter.pyx @@ -102,3 +102,9 @@ cdef ccomplexException complexException_convert_to_cpp(object inst) except *: cdef object complexException_from_cpp(const ccomplexException& c_struct): return cpp_to_python[ccomplexException](c_struct) +cdef cContainers Containers_convert_to_cpp(object inst) except *: + return cmove(python_to_cpp[cContainers](inst)) + +cdef object Containers_from_cpp(const cContainers& c_struct): + return cpp_to_python[cContainers](c_struct) + diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.cpp b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.cpp index 28e1385102f..a89641ba8e6 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.cpp +++ b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.cpp @@ -58,6 +58,9 @@ bool ensure_module_imported() { static constexpr std::int16_t _fbthrift__complexException__tuple_pos[6] = { 1, 2, 3, 4, 5, 6 }; + static constexpr std::int16_t _fbthrift__Containers__tuple_pos[18] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 + }; } // namespace ExtractorResult<::cpp2::MyStructFloatFieldThrowExp> @@ -2558,6 +2561,323 @@ PyObject* Constructor<::apache::thrift::python::capi::ComposedStruct< } +ExtractorResult<::cpp2::Containers> +Extractor<::cpp2::Containers>::operator()(PyObject* obj) { + int tCheckResult = typeCheck(obj); + if (tCheckResult != 1) { + if (tCheckResult == 0) { + PyErr_SetString(PyExc_TypeError, "Not a Containers"); + } + return extractorError<::cpp2::Containers>( + "Marshal error: Containers"); + } + StrongRef fbThriftData(getThriftData(obj)); + return Extractor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>>{}(*fbThriftData); +} + +ExtractorResult<::cpp2::Containers> +Extractor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>>::operator()(PyObject* fbThriftData) { + ::cpp2::Containers cpp; + std::optional error; + Extractor>>{}.extractInto( + cpp.struct_list_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[0]), + error); + Extractor>>{}.extractInto( + cpp.union_list_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[1]), + error); + Extractor>>{}.extractInto( + cpp.enum_list_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[2]), + error); + Extractor>>{}.extractInto( + cpp.struct_set_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[3]), + error); + Extractor>>{}.extractInto( + cpp.union_set_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[4]), + error); + Extractor>>{}.extractInto( + cpp.enum_set_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[5]), + error); + Extractor, int64_t>>{}.extractInto( + cpp.struct_map_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[6]), + error); + Extractor, int64_t>>{}.extractInto( + cpp.union_map_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[7]), + error); + Extractor, int64_t>>{}.extractInto( + cpp.enum_map_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[8]), + error); + Extractor>>{}.extractInto( + cpp.struct_map_2_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[9]), + error); + Extractor>>{}.extractInto( + cpp.union_map_2_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[10]), + error); + Extractor>>{}.extractInto( + cpp.enum_map_2_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[11]), + error); + Extractor, int32_t>>{}.extractInto( + cpp.list_map_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[12]), + error); + Extractor>>{}.extractInto( + cpp.list_map_2_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[13]), + error); + Extractor, int32_t>>{}.extractInto( + cpp.set_map_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[14]), + error); + Extractor>>{}.extractInto( + cpp.set_map_2_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[15]), + error); + Extractor, int32_t>>{}.extractInto( + cpp.map_map_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[16]), + error); + Extractor>>{}.extractInto( + cpp.map_map_2_ref(), + PyTuple_GET_ITEM(fbThriftData, _fbthrift__Containers__tuple_pos[17]), + error); + if (error) { + return folly::makeUnexpected(*error); + } + return cpp; +} + + +int Extractor<::cpp2::Containers>::typeCheck(PyObject* obj) { + if (!ensure_module_imported()) { + ::folly::python::handlePythonError( + "Module module import error"); + } + int result = + can_extract__module__Containers(obj); + if (result < 0) { + ::folly::python::handlePythonError( + "Unexpected type check error: Containers"); + } + return result; +} + + +PyObject* Constructor<::cpp2::Containers>::operator()( + const ::cpp2::Containers& val) { + if (!ensure_module_imported()) { + DCHECK(PyErr_Occurred() != nullptr); + return nullptr; + } + Constructor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>> ctor; + StrongRef fbthrift_data(ctor(val)); + if (!fbthrift_data) { + return nullptr; + } + return init__module__Containers(*fbthrift_data); +} + +PyObject* Constructor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>>::operator()( + [[maybe_unused]] const ::cpp2::Containers& val) { + StrongRef fbthrift_data(createStructTuple(18)); + StrongRef _fbthrift__struct_list( + Constructor>>{} + .constructFrom(val.struct_list_ref())); + if (!_fbthrift__struct_list || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[0], + *_fbthrift__struct_list) == -1) { + return nullptr; + } + StrongRef _fbthrift__union_list( + Constructor>>{} + .constructFrom(val.union_list_ref())); + if (!_fbthrift__union_list || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[1], + *_fbthrift__union_list) == -1) { + return nullptr; + } + StrongRef _fbthrift__enum_list( + Constructor>>{} + .constructFrom(val.enum_list_ref())); + if (!_fbthrift__enum_list || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[2], + *_fbthrift__enum_list) == -1) { + return nullptr; + } + StrongRef _fbthrift__struct_set( + Constructor>>{} + .constructFrom(val.struct_set_ref())); + if (!_fbthrift__struct_set || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[3], + *_fbthrift__struct_set) == -1) { + return nullptr; + } + StrongRef _fbthrift__union_set( + Constructor>>{} + .constructFrom(val.union_set_ref())); + if (!_fbthrift__union_set || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[4], + *_fbthrift__union_set) == -1) { + return nullptr; + } + StrongRef _fbthrift__enum_set( + Constructor>>{} + .constructFrom(val.enum_set_ref())); + if (!_fbthrift__enum_set || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[5], + *_fbthrift__enum_set) == -1) { + return nullptr; + } + StrongRef _fbthrift__struct_map( + Constructor, int64_t>>{} + .constructFrom(val.struct_map_ref())); + if (!_fbthrift__struct_map || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[6], + *_fbthrift__struct_map) == -1) { + return nullptr; + } + StrongRef _fbthrift__union_map( + Constructor, int64_t>>{} + .constructFrom(val.union_map_ref())); + if (!_fbthrift__union_map || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[7], + *_fbthrift__union_map) == -1) { + return nullptr; + } + StrongRef _fbthrift__enum_map( + Constructor, int64_t>>{} + .constructFrom(val.enum_map_ref())); + if (!_fbthrift__enum_map || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[8], + *_fbthrift__enum_map) == -1) { + return nullptr; + } + StrongRef _fbthrift__struct_map_2( + Constructor>>{} + .constructFrom(val.struct_map_2_ref())); + if (!_fbthrift__struct_map_2 || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[9], + *_fbthrift__struct_map_2) == -1) { + return nullptr; + } + StrongRef _fbthrift__union_map_2( + Constructor>>{} + .constructFrom(val.union_map_2_ref())); + if (!_fbthrift__union_map_2 || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[10], + *_fbthrift__union_map_2) == -1) { + return nullptr; + } + StrongRef _fbthrift__enum_map_2( + Constructor>>{} + .constructFrom(val.enum_map_2_ref())); + if (!_fbthrift__enum_map_2 || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[11], + *_fbthrift__enum_map_2) == -1) { + return nullptr; + } + StrongRef _fbthrift__list_map( + Constructor, int32_t>>{} + .constructFrom(val.list_map_ref())); + if (!_fbthrift__list_map || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[12], + *_fbthrift__list_map) == -1) { + return nullptr; + } + StrongRef _fbthrift__list_map_2( + Constructor>>{} + .constructFrom(val.list_map_2_ref())); + if (!_fbthrift__list_map_2 || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[13], + *_fbthrift__list_map_2) == -1) { + return nullptr; + } + StrongRef _fbthrift__set_map( + Constructor, int32_t>>{} + .constructFrom(val.set_map_ref())); + if (!_fbthrift__set_map || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[14], + *_fbthrift__set_map) == -1) { + return nullptr; + } + StrongRef _fbthrift__set_map_2( + Constructor>>{} + .constructFrom(val.set_map_2_ref())); + if (!_fbthrift__set_map_2 || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[15], + *_fbthrift__set_map_2) == -1) { + return nullptr; + } + StrongRef _fbthrift__map_map( + Constructor, int32_t>>{} + .constructFrom(val.map_map_ref())); + if (!_fbthrift__map_map || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[16], + *_fbthrift__map_map) == -1) { + return nullptr; + } + StrongRef _fbthrift__map_map_2( + Constructor>>{} + .constructFrom(val.map_map_2_ref())); + if (!_fbthrift__map_map_2 || + setStructField( + *fbthrift_data, + _fbthrift__Containers__tuple_pos[17], + *_fbthrift__map_map_2) == -1) { + return nullptr; + } + return std::move(fbthrift_data).release(); +} + + ExtractorResult<::cpp2::MyEnum> Extractor<::cpp2::MyEnum>::operator()(PyObject* obj) { long val = PyLong_AsLong(obj); diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.h b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.h index 99cf1d8d06b..f8bccbacba8 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.h +++ b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.h @@ -483,6 +483,37 @@ struct Constructor<::apache::thrift::python::capi::ComposedStruct< PyObject* operator()(const ::cpp2::complexException& val); }; +template <> +struct Extractor<::cpp2::Containers> + : public BaseExtractor<::cpp2::Containers> { + static const bool kUsingMarshal = true; + ExtractorResult<::cpp2::Containers> operator()(PyObject* obj); + int typeCheck(PyObject* obj); +}; + +template <> +struct Extractor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>> + : public BaseExtractor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>> { + ExtractorResult<::cpp2::Containers> operator()(PyObject* obj); +}; + +template <> +struct Constructor<::cpp2::Containers> + : public BaseConstructor<::cpp2::Containers> { + static const bool kUsingMarshal = true; + PyObject* operator()(const ::cpp2::Containers& val); +}; + +template <> +struct Constructor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>> + : public BaseConstructor<::apache::thrift::python::capi::ComposedStruct< + ::cpp2::Containers>> { + PyObject* operator()(const ::cpp2::Containers& val); +}; + template <> struct Extractor<::cpp2::MyEnum> : public BaseExtractor<::cpp2::MyEnum> { diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pxd b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pxd index db5fad39648..cce1363f624 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pxd +++ b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pxd @@ -88,6 +88,11 @@ cdef api int can_extract__module__complexException(object) except -1 cdef api object init__module__complexException(object data) +cdef api int can_extract__module__Containers(object) except -1 + + +cdef api object init__module__Containers(object data) + cdef api int can_extract__module__MyEnum(object) except -1 cdef api object construct__module__MyEnum(int64_t) diff --git a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pyx b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pyx index 76a15ca3469..b26e24060d3 100644 --- a/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pyx +++ b/thrift/compiler/test/fixtures/complex-struct/out/python_capi/gen-python-capi/module/thrift_types_capi.pyx @@ -124,6 +124,13 @@ cdef api int can_extract__module__complexException(object __obj) except -1: cdef api object init__module__complexException(object data): return __thrift_types.complexException._fbthrift_create(data) +cdef api int can_extract__module__Containers(object __obj) except -1: + return 1 if isinstance(__obj, __thrift_types.Containers) else 0 + + +cdef api object init__module__Containers(object data): + return __thrift_types.Containers._fbthrift_create(data) + cdef api int can_extract__module__MyEnum(object __obj) except -1: return 1 if isinstance(__obj, __thrift_types.MyEnum) else 0 diff --git a/thrift/compiler/test/fixtures/complex-struct/src/module.thrift b/thrift/compiler/test/fixtures/complex-struct/src/module.thrift index 06b6906edea..5dc5f67a2b9 100644 --- a/thrift/compiler/test/fixtures/complex-struct/src/module.thrift +++ b/thrift/compiler/test/fixtures/complex-struct/src/module.thrift @@ -213,3 +213,30 @@ typedef map ( typedef map ( java.swift.type = "it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap", ) map_i64_string_5732 + +struct Containers { + 1: list struct_list; + 2: list union_list; + 3: list enum_list; + + 4: set struct_set; + 5: set union_set; + 6: set enum_set; + + 7: map struct_map; + 8: map union_map; + 9: map enum_map; + + 10: map struct_map_2; + 11: map union_map_2; + 12: map enum_map_2; + + 13: map, i32> list_map; + 14: map> list_map_2; + + 15: map, i32> set_map; + 16: map> set_map_2; + + 17: map, i32> map_map; + 18: map> map_map_2; +}