├── bazel └── BUILD ├── .bazelversion ├── CLAUDE.md ├── javascript ├── .npmrc ├── .gitignore ├── benchmark │ ├── sample.jpg │ └── platform-buffer.jpg ├── packages │ ├── fory │ │ ├── README.md │ │ ├── package.json │ │ └── lib │ │ │ └── error.ts │ └── hps │ │ ├── README.md │ │ ├── package.json │ │ └── binding.gyp └── package.json ├── .gitattributes ├── dart ├── CHANGELOG.md ├── packages │ ├── fory │ │ ├── CHANGELOG.md │ │ ├── .gitignore │ │ ├── lib │ │ │ ├── src │ │ │ │ ├── serializer │ │ │ │ │ ├── collection │ │ │ │ │ │ └── list │ │ │ │ │ │ │ └── linked_list_serializer.dart │ │ │ │ │ └── custom_serializer.dart │ │ │ │ ├── config │ │ │ │ │ └── config.dart │ │ │ │ ├── dev_annotation │ │ │ │ │ ├── optimize.dart │ │ │ │ │ └── maybe_modified.dart │ │ │ │ ├── furiable.dart │ │ │ │ ├── annotation │ │ │ │ │ └── fory_object.dart │ │ │ │ ├── codegen │ │ │ │ │ ├── const │ │ │ │ │ │ ├── location_level.dart │ │ │ │ │ │ ├── annotation_target.dart │ │ │ │ │ │ └── fory_const.dart │ │ │ │ │ ├── entity │ │ │ │ │ │ ├── import_prefix.dart │ │ │ │ │ │ ├── struct_hash_pair.dart │ │ │ │ │ │ ├── either.dart │ │ │ │ │ │ └── fields_cache_unit.dart │ │ │ │ │ ├── config │ │ │ │ │ │ └── codegen_style.dart │ │ │ │ │ ├── analyze │ │ │ │ │ │ ├── interface │ │ │ │ │ │ │ ├── enum_analyzer.dart │ │ │ │ │ │ │ └── class_analyzer.dart │ │ │ │ │ │ └── annotation │ │ │ │ │ │ │ └── location_level_ensure.dart │ │ │ │ │ ├── meta │ │ │ │ │ │ ├── custom_type_spec_gen.dart │ │ │ │ │ │ ├── impl │ │ │ │ │ │ │ └── enum_brief.dart │ │ │ │ │ │ └── lib_import_pack.dart │ │ │ │ │ └── generate │ │ │ │ │ │ └── builders.dart │ │ │ │ ├── const │ │ │ │ │ ├── deser_flags.dart │ │ │ │ │ ├── meta_string_const.dart │ │ │ │ │ ├── fory_header_const.dart │ │ │ │ │ ├── lang.dart │ │ │ │ │ └── ref_flag.dart │ │ │ │ ├── memory │ │ │ │ │ └── mem_range.dart │ │ │ │ ├── resolver │ │ │ │ │ ├── meta_string_handler.dart │ │ │ │ │ └── tag_str_encode_resolver.dart │ │ │ │ ├── util │ │ │ │ │ ├── extension │ │ │ │ │ │ └── int_extensions.dart │ │ │ │ │ ├── hash_util.dart │ │ │ │ │ ├── math_checker.dart │ │ │ │ │ └── date_util.dart │ │ │ │ ├── codec │ │ │ │ │ ├── meta_string_codecs.dart │ │ │ │ │ └── entity │ │ │ │ │ │ └── str_stat.dart │ │ │ │ ├── meta │ │ │ │ │ ├── specs │ │ │ │ │ │ └── custom_type_spec.dart │ │ │ │ │ └── spec_wraps │ │ │ │ │ │ └── enum_spec_wrap.dart │ │ │ │ ├── exception │ │ │ │ │ └── fory_exception.dart │ │ │ │ └── pack.dart │ │ │ └── fory_test.dart │ │ ├── analysis_options.yaml │ │ ├── build.yaml │ │ └── pubspec.yaml │ └── fory-test │ │ ├── CHANGELOG.md │ │ ├── .gitignore │ │ ├── test_config.yaml │ │ ├── analysis_options.yaml │ │ ├── README.md │ │ ├── lib │ │ ├── extensions │ │ │ ├── num_ext.dart │ │ │ └── obj_ext.dart │ │ └── entity │ │ │ ├── enum_foo.dart │ │ │ ├── some_class.dart │ │ │ └── simple_struct1.dart │ │ ├── build.yaml │ │ └── pubspec.yaml ├── .gitignore ├── note │ └── analysis │ │ ├── general.txt │ │ └── constructor.txt ├── analysis_options.yaml ├── example │ ├── enum_example.dart │ ├── nested_collection_example.dart │ ├── typed_data_array_example.dart │ └── enum_example.g.dart ├── build.yaml └── pubspec.yaml ├── rust ├── .gitignore ├── rustfmt.toml ├── rust-toolchain.toml ├── tests │ ├── tests │ │ ├── compatible │ │ │ └── mod.rs │ │ └── mod.rs │ └── Cargo.toml ├── fory-core │ └── src │ │ ├── resolver │ │ └── mod.rs │ │ └── row │ │ ├── bit_util.rs │ │ └── mod.rs └── fory-derive │ └── src │ └── object │ └── mod.rs ├── .idea ├── icon.png └── vcs.xml ├── docs ├── images │ ├── idea_jdk11.png │ ├── logo │ │ ├── fory-icon.png │ │ ├── fory-vertical.png │ │ ├── fory-vertical1.png │ │ ├── fory-horizontal.png │ │ ├── fory-horizontal1.png │ │ ├── fory-icon-black.png │ │ ├── fory-icon-white.png │ │ ├── fory-vertical-black.png │ │ ├── fory-vertical-white.png │ │ ├── fory-horizontal-black.png │ │ ├── fory-horizontal-black1.png │ │ ├── fory-horizontal-white.png │ │ ├── fory-horizontal-white1.png │ │ ├── fory-vertical-black1.png │ │ └── fory-vertical-white1.png │ ├── jmp_generate_file.png │ ├── vscode_debug_fory.jpg │ └── vscode_select_debug_run.png └── benchmarks │ ├── rust │ ├── company.png │ ├── person.png │ ├── simple_map.png │ ├── simple_list.png │ ├── simple_struct.png │ ├── system_data.png │ └── ecommerce_data.png │ ├── cpp │ └── throughput.png │ ├── serialization │ ├── bench_serialize_SAMPLE_to_array_tps.png │ ├── bench_serialize_STRUCT2_to_array_tps.png │ ├── bench_serialize_STRUCT_to_array_tps.png │ ├── bench_serialize_MEDIA_CONTENT_to_array_tps.png │ ├── bench_serialize_SAMPLE_to_directBuffer_tps.png │ ├── bench_serialize_STRUCT2_to_directBuffer_tps.png │ ├── bench_serialize_STRUCT_to_directBuffer_tps.png │ ├── bench_serialize_compatible_SAMPLE_to_array_tps.png │ ├── bench_serialize_compatible_STRUCT_to_array_tps.png │ ├── bench_serialize_MEDIA_CONTENT_to_directBuffer_tps.png │ ├── bench_serialize_compatible_STRUCT2_to_array_tps.png │ ├── bench_serialize_compatible_SAMPLE_to_directBuffer_tps.png │ ├── bench_serialize_compatible_STRUCT2_to_directBuffer_tps.png │ └── bench_serialize_compatible_MEDIA_CONTENT_to_directBuffer_tps.png │ ├── deserialization │ ├── bench_deserialize_SAMPLE_from_array_tps.png │ ├── bench_deserialize_STRUCT_from_array_tps.png │ ├── bench_deserialize_STRUCT2_from_array_tps.png │ ├── bench_deserialize_MEDIA_CONTENT_from_array_tps.png │ ├── bench_deserialize_SAMPLE_from_directBuffer_tps.png │ ├── bench_deserialize_STRUCT2_from_directBuffer_tps.png │ ├── bench_deserialize_STRUCT_from_directBuffer_tps.png │ ├── bench_deserialize_compatible_SAMPLE_from_array_tps.png │ ├── bench_deserialize_compatible_STRUCT2_from_array_tps.png │ ├── bench_deserialize_compatible_STRUCT_from_array_tps.png │ ├── bench_deserialize_MEDIA_CONTENT_from_directBuffer_tps.png │ ├── bench_deserialize_compatible_SAMPLE_from_directBuffer_tps.png │ ├── bench_deserialize_compatible_STRUCT2_from_directBuffer_tps.png │ └── bench_deserialize_compatible_MEDIA_CONTENT_from_directBuffer_tps.png │ ├── zerocopy │ ├── zero_copy_bench_serialize_BUFFER_to_array_tps.png │ ├── zero_copy_bench_deserialize_BUFFER_from_array_tps.png │ ├── zero_copy_bench_serialize_BUFFER_to_directBuffer_tps.png │ ├── zero_copy_bench_serialize_PRIMITIVE_ARRAY_to_array_tps.png │ ├── zero_copy_bench_deserialize_BUFFER_from_directBuffer_tps.png │ ├── zero_copy_bench_deserialize_PRIMITIVE_ARRAY_from_array_tps.png │ ├── zero_copy_bench_serialize_PRIMITIVE_ARRAY_to_directBuffer_tps.png │ └── zero_copy_bench_deserialize_PRIMITIVE_ARRAY_from_directBuffer_tps.png │ └── compatible │ ├── bench_serialize_compatible_MEDIA_CONTENT_to_array_tps.png │ ├── bench_serialize_compatible_STRUCT_to_directBuffer_tps.png │ ├── bench_deserialize_compatible_MEDIA_CONTENT_from_array_tps.png │ └── bench_deserialize_compatible_STRUCT_from_directBuffer_tps.png ├── .yamllint ├── java ├── fory-graalvm-feature │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.graalvm.nativeimage.hosted.Feature ├── fory-testsuite │ └── README.md ├── fory-core │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ ├── native-image │ │ │ │ └── org.apache.fory │ │ │ │ │ └── fory-core │ │ │ │ │ ├── reflection-config.json │ │ │ │ │ └── serialization-config.json │ │ │ │ └── NOTICE │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── fory │ │ │ ├── builder │ │ │ └── package-info.java │ │ │ ├── util │ │ │ └── function │ │ │ │ ├── ToByteFunction.java │ │ │ │ ├── ToCharFunction.java │ │ │ │ ├── ToFloatFunction.java │ │ │ │ ├── ToShortFunction.java │ │ │ │ ├── SerializableSupplier.java │ │ │ │ ├── SerializableTriFunction.java │ │ │ │ ├── SerializableFunction.java │ │ │ │ └── SerializableBiFunction.java │ │ │ ├── config │ │ │ └── Language.java │ │ │ ├── ForyCopyable.java │ │ │ ├── memory │ │ │ └── BigEndian.java │ │ │ ├── serializer │ │ │ └── SerializerFactory.java │ │ │ ├── collection │ │ │ └── ObjectMap.java │ │ │ ├── annotation │ │ │ ├── Public.java │ │ │ ├── CodegenInvoke.java │ │ │ ├── Ignore.java │ │ │ └── Expose.java │ │ │ └── exception │ │ │ ├── ClassUnregisteredException.java │ │ │ └── InsecureException.java │ │ └── test │ │ └── java │ │ ├── javax │ │ └── fory │ │ │ └── test │ │ │ └── Accessor.java │ │ └── org │ │ └── apache │ │ └── fory │ │ ├── resolver │ │ └── longlongpkg │ │ │ ├── C1.java │ │ │ ├── C2.java │ │ │ └── C3.java │ │ ├── codegen │ │ └── javalangnameconflict │ │ │ └── Object.java │ │ ├── builder │ │ └── pkg │ │ │ └── AccessLevelClass.java │ │ └── collection │ │ ├── Tuple2Test.java │ │ └── Tuple3Test.java ├── fory-format │ └── src │ │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── NOTICE │ │ └── java │ │ └── org │ │ └── apache │ │ └── fory │ │ └── format │ │ ├── encoder │ │ ├── CustomCollectionFactory.java │ │ └── GeneratedArrayEncoder.java │ │ └── row │ │ ├── MapData.java │ │ └── ArrayData.java └── fory-test-core │ └── src │ ├── test │ └── java │ │ └── org │ │ └── apache │ │ └── fory │ │ └── test │ │ └── bean │ │ └── StructTest.java │ └── main │ └── resources │ └── log4j2.xml ├── cpp └── fory │ ├── BUILD │ ├── thirdparty │ ├── BUILD │ ├── MurmurHash3.h │ └── CMakeLists.txt │ ├── encoder │ └── BUILD │ ├── row │ ├── BUILD │ ├── type.cc │ └── type.h │ ├── type │ └── BUILD │ ├── util │ └── time_util.h │ └── python │ └── pyfory.h ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── config.yml ├── sync.yml └── workflows │ └── sync.yml ├── integration_tests ├── graalvm_tests │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── native-image │ │ │ │ └── org.apache.fory │ │ │ │ └── graalvm_tests │ │ │ │ └── proxy-config.json │ │ │ └── java │ │ │ └── org │ │ │ └── apache │ │ │ └── fory │ │ │ └── graalvm │ │ │ └── record │ │ │ └── Foo.java │ └── README.md ├── README.md └── jpms_tests │ └── src │ └── main │ └── java │ └── module-info.java ├── python └── pyfory │ ├── __init__.pxd │ ├── meta │ └── __init__.py │ ├── tests │ ├── __init__.py │ ├── test_type.py │ └── core.py │ ├── includes │ └── __init__.pxd │ ├── lib │ ├── tests │ │ ├── __init__.py │ │ ├── test_mmh3.py │ │ └── test_collection.py │ ├── __init__.py │ ├── mmh3 │ │ ├── __init__.py │ │ └── __init__.pxd │ └── __init__.pxd │ ├── format │ ├── tests │ │ └── __init__.py │ └── _format.pyx │ ├── buffer.py │ └── error.py ├── scala └── project │ ├── build.properties │ └── plugins.sbt ├── ci └── tasks │ ├── __init__.py │ ├── go.py │ ├── javascript.py │ └── kotlin.py ├── .editorconfig ├── WORKSPACE ├── NOTICE ├── examples └── cpp │ ├── hello_world │ ├── BUILD │ └── BUILD.standalone │ └── hello_row │ └── BUILD ├── go └── fory │ ├── endian_big.go │ ├── endian_little.go │ └── go.mod ├── licenses ├── LICENSE-murmurHash3.js.txt └── LICENSE-cython-abseil-example.txt └── benchmarks └── go_benchmark └── go.mod /bazel/BUILD: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 8.2.1 -------------------------------------------------------------------------------- /CLAUDE.md: -------------------------------------------------------------------------------- 1 | AGENTS.md -------------------------------------------------------------------------------- /javascript/.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | java/benchmark export-ignore 2 | -------------------------------------------------------------------------------- /dart/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /rust/.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | /target 3 | **/generated -------------------------------------------------------------------------------- /javascript/.gitignore: -------------------------------------------------------------------------------- 1 | coverage 2 | packages/hps/includes 3 | -------------------------------------------------------------------------------- /dart/packages/fory/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /.idea/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/.idea/icon.png -------------------------------------------------------------------------------- /dart/packages/fory-test/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /docs/images/idea_jdk11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/idea_jdk11.png -------------------------------------------------------------------------------- /dart/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ -------------------------------------------------------------------------------- /docs/images/logo/fory-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-icon.png -------------------------------------------------------------------------------- /docs/benchmarks/rust/company.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/company.png -------------------------------------------------------------------------------- /docs/benchmarks/rust/person.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/person.png -------------------------------------------------------------------------------- /docs/images/jmp_generate_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/jmp_generate_file.png -------------------------------------------------------------------------------- /docs/images/vscode_debug_fory.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/vscode_debug_fory.jpg -------------------------------------------------------------------------------- /javascript/benchmark/sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/javascript/benchmark/sample.jpg -------------------------------------------------------------------------------- /docs/benchmarks/cpp/throughput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/cpp/throughput.png -------------------------------------------------------------------------------- /docs/benchmarks/rust/simple_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/simple_map.png -------------------------------------------------------------------------------- /docs/images/logo/fory-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-vertical.png -------------------------------------------------------------------------------- /docs/images/logo/fory-vertical1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-vertical1.png -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | extends: default 2 | 3 | rules: 4 | document-start: false 5 | line-length: false 6 | truthy: false 7 | -------------------------------------------------------------------------------- /docs/benchmarks/rust/simple_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/simple_list.png -------------------------------------------------------------------------------- /docs/benchmarks/rust/simple_struct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/simple_struct.png -------------------------------------------------------------------------------- /docs/benchmarks/rust/system_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/system_data.png -------------------------------------------------------------------------------- /docs/images/logo/fory-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-horizontal.png -------------------------------------------------------------------------------- /docs/images/logo/fory-horizontal1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-horizontal1.png -------------------------------------------------------------------------------- /docs/images/logo/fory-icon-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-icon-black.png -------------------------------------------------------------------------------- /docs/images/logo/fory-icon-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-icon-white.png -------------------------------------------------------------------------------- /javascript/packages/fory/README.md: -------------------------------------------------------------------------------- 1 | # Apache Fory™ JavaScript 2 | 3 | Javascript implementation for the Fory protocol. 4 | -------------------------------------------------------------------------------- /docs/benchmarks/rust/ecommerce_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/rust/ecommerce_data.png -------------------------------------------------------------------------------- /docs/images/logo/fory-vertical-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-vertical-black.png -------------------------------------------------------------------------------- /docs/images/logo/fory-vertical-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-vertical-white.png -------------------------------------------------------------------------------- /docs/images/vscode_select_debug_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/vscode_select_debug_run.png -------------------------------------------------------------------------------- /javascript/benchmark/platform-buffer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/javascript/benchmark/platform-buffer.jpg -------------------------------------------------------------------------------- /docs/images/logo/fory-horizontal-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-horizontal-black.png -------------------------------------------------------------------------------- /docs/images/logo/fory-horizontal-black1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-horizontal-black1.png -------------------------------------------------------------------------------- /docs/images/logo/fory-horizontal-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-horizontal-white.png -------------------------------------------------------------------------------- /docs/images/logo/fory-horizontal-white1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-horizontal-white1.png -------------------------------------------------------------------------------- /docs/images/logo/fory-vertical-black1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-vertical-black1.png -------------------------------------------------------------------------------- /docs/images/logo/fory-vertical-white1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/images/logo/fory-vertical-white1.png -------------------------------------------------------------------------------- /java/fory-graalvm-feature/src/main/resources/META-INF/services/org.graalvm.nativeimage.hosted.Feature: -------------------------------------------------------------------------------- 1 | org.apache.fory.graalvm.feature.ForyGraalVMFeature -------------------------------------------------------------------------------- /dart/packages/fory-test/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | */generated_file/** 5 | **.g.dart -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_SAMPLE_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_SAMPLE_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_STRUCT2_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_STRUCT2_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_STRUCT_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_STRUCT_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_SAMPLE_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_SAMPLE_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_STRUCT_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_STRUCT_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_serialize_BUFFER_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_serialize_BUFFER_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_STRUCT2_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_STRUCT2_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_MEDIA_CONTENT_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_MEDIA_CONTENT_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_SAMPLE_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_SAMPLE_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_STRUCT2_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_STRUCT2_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_STRUCT_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_STRUCT_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_deserialize_BUFFER_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_deserialize_BUFFER_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_compatible_SAMPLE_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_compatible_SAMPLE_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_compatible_STRUCT_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_compatible_STRUCT_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_MEDIA_CONTENT_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_MEDIA_CONTENT_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_SAMPLE_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_SAMPLE_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_STRUCT2_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_STRUCT2_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_STRUCT_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_STRUCT_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_MEDIA_CONTENT_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_MEDIA_CONTENT_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_compatible_STRUCT2_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_compatible_STRUCT2_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_serialize_BUFFER_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_serialize_BUFFER_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_serialize_PRIMITIVE_ARRAY_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_serialize_PRIMITIVE_ARRAY_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/compatible/bench_serialize_compatible_MEDIA_CONTENT_to_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/compatible/bench_serialize_compatible_MEDIA_CONTENT_to_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/compatible/bench_serialize_compatible_STRUCT_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/compatible/bench_serialize_compatible_STRUCT_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_deserialize_BUFFER_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_deserialize_BUFFER_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/compatible/bench_deserialize_compatible_MEDIA_CONTENT_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/compatible/bench_deserialize_compatible_MEDIA_CONTENT_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/compatible/bench_deserialize_compatible_STRUCT_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/compatible/bench_deserialize_compatible_STRUCT_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_compatible_SAMPLE_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_compatible_SAMPLE_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_compatible_STRUCT2_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_compatible_STRUCT2_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_compatible_STRUCT_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_compatible_STRUCT_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_compatible_SAMPLE_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_compatible_SAMPLE_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_compatible_STRUCT2_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_compatible_STRUCT2_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_deserialize_PRIMITIVE_ARRAY_from_array_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_deserialize_PRIMITIVE_ARRAY_from_array_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_MEDIA_CONTENT_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_MEDIA_CONTENT_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_serialize_PRIMITIVE_ARRAY_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_serialize_PRIMITIVE_ARRAY_to_directBuffer_tps.png -------------------------------------------------------------------------------- /dart/note/analysis/general.txt: -------------------------------------------------------------------------------- 1 | Even if there are some syntax errors, dart analyzer can still analyze. 2 | For example, if a class uses an undefined mixin, it can still be analyzed, but ClassElement::mixins will not record it. 3 | -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_compatible_SAMPLE_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_compatible_SAMPLE_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_compatible_STRUCT2_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_compatible_STRUCT2_from_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/serialization/bench_serialize_compatible_MEDIA_CONTENT_to_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/serialization/bench_serialize_compatible_MEDIA_CONTENT_to_directBuffer_tps.png -------------------------------------------------------------------------------- /docs/benchmarks/zerocopy/zero_copy_bench_deserialize_PRIMITIVE_ARRAY_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/zerocopy/zero_copy_bench_deserialize_PRIMITIVE_ARRAY_from_directBuffer_tps.png -------------------------------------------------------------------------------- /cpp/fory/BUILD: -------------------------------------------------------------------------------- 1 | load("@rules_cc//cc:defs.bzl", "cc_library") 2 | 3 | cc_library( 4 | name = "fory", 5 | deps = [ 6 | "//cpp/fory/row:fory_row_format", 7 | ], 8 | visibility = ["//visibility:public"], 9 | ) 10 | -------------------------------------------------------------------------------- /docs/benchmarks/deserialization/bench_deserialize_compatible_MEDIA_CONTENT_from_directBuffer_tps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/fory/HEAD/docs/benchmarks/deserialization/bench_deserialize_compatible_MEDIA_CONTENT_from_directBuffer_tps.png -------------------------------------------------------------------------------- /dart/packages/fory/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | 5 | # Avoid committing pubspec.lock for library packages; see 6 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 7 | pubspec.lock 8 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | java @chaokunyang 2 | scala @chaokunyang 3 | go @chaokunyang 4 | integration_tests @chaokunyang 5 | python @chaokunyang 6 | cpp @chaokunyang @PragmaTwice 7 | rust @theweipeng @chaokunyang 8 | javascript @theweipeng 9 | docs @chaokunyang @theweipeng @PragmaTwice 10 | bazel @chaokunyang 11 | -------------------------------------------------------------------------------- /java/fory-testsuite/README.md: -------------------------------------------------------------------------------- 1 | # Fory Test Suite 2 | 3 | Fory write many tests to ensure the correctness of serialization, but there may be still some corner case which are not covered. 4 | 5 | Such cases can be covered in a test suite module, and uses of fory can contribute to this module to ensure their correctness further. 6 | -------------------------------------------------------------------------------- /java/fory-core/src/main/resources/META-INF/native-image/org.apache.fory/fory-core/reflection-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "java.lang.reflect.Proxy", 4 | "allDeclaredConstructors": true, 5 | "allPublicConstructors": true, 6 | "allDeclaredMethods": true, 7 | "allPublicMethods": true 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /cpp/fory/thirdparty/BUILD: -------------------------------------------------------------------------------- 1 | load("@rules_cc//cc:defs.bzl", "cc_library") 2 | 3 | cc_library( 4 | name = "libmmh3", 5 | srcs = ["MurmurHash3.cc"], 6 | hdrs = ["MurmurHash3.h"], 7 | strip_include_prefix = "/cpp", 8 | alwayslink=True, 9 | linkstatic=True, 10 | visibility = ["//visibility:public"], 11 | ) 12 | -------------------------------------------------------------------------------- /integration_tests/graalvm_tests/src/main/resources/META-INF/native-image/org.apache.fory/graalvm_tests/proxy-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "interfaces": [ 4 | "java.util.function.Function" 5 | ], 6 | "condition": { 7 | "typeReachable": "org.apache.fory.graalvm.ProxyExample$TestInvocationHandler" 8 | } 9 | } 10 | ] -------------------------------------------------------------------------------- /javascript/packages/hps/README.md: -------------------------------------------------------------------------------- 1 | # Apache Fory™ JavaScript 2 | 3 | Node.js high-performance suite, ensuring that your Node.js version is 20 or later. 4 | 5 | `hps` is use for detect the string type in v8. Fory support latin1 and utf8 string both, we should get the certain type of string before write it 6 | in buffer. It is slow to detect the string is latin1 or utf8, but hps can detect it by a hack way, which is called FASTCALL in v8. 7 | so it is not stable now. 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /integration_tests/graalvm_tests/README.md: -------------------------------------------------------------------------------- 1 | # Graalvm native image Tests 2 | 3 | Examples and tests for Fory serialization in graalvm native image 4 | 5 | ## Test 6 | 7 | ```bash 8 | mvn -DskipTests=true -Pnative package 9 | ``` 10 | 11 | ## Benchmark 12 | 13 | ```bash 14 | BENCHMARK_REPEAT=400000 mvn -Pnative -Dagent=true -DskipTests -DskipNativeBuild=true package exec:exec@java-agent 15 | BENCHMARK_REPEAT=400000 mvn -DskipTests=true -Pnative -Dagent=true package 16 | ``` 17 | 18 | `-Dagent=true` is needed by JDK serialization only to build reflection config, it's not needed for fory serialization. 19 | -------------------------------------------------------------------------------- /cpp/fory/encoder/BUILD: -------------------------------------------------------------------------------- 1 | load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") 2 | 3 | cc_library( 4 | name = "fory_encoder", 5 | srcs = glob(["*.cc"], exclude=["*test.cc"], allow_empty = True), 6 | hdrs = glob(["*.h"]), 7 | strip_include_prefix = "/cpp", 8 | deps = [ 9 | "//cpp/fory/row:fory_row_format", 10 | "//cpp/fory/meta:fory_meta" 11 | ], 12 | visibility = ["//visibility:public"], 13 | ) 14 | 15 | cc_test( 16 | name = "row_encoder_test", 17 | srcs = glob(["*_test.cc"]), 18 | deps = [ 19 | ":fory_encoder", 20 | "@googletest//:gtest", 21 | ], 22 | ) 23 | -------------------------------------------------------------------------------- /cpp/fory/row/BUILD: -------------------------------------------------------------------------------- 1 | load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") 2 | 3 | cc_library( 4 | name = "fory_row_format", 5 | srcs = glob(["*.cc"], exclude=["*test.cc"]), 6 | hdrs = glob(["*.h"]), 7 | strip_include_prefix = "/cpp", 8 | deps = [ 9 | "//cpp/fory/serialization:fory_serialization", 10 | "//cpp/fory/util:fory_util", 11 | "//cpp/fory/type:fory_type" 12 | ], 13 | visibility = ["//visibility:public"], 14 | ) 15 | 16 | cc_test( 17 | name = "row_test", 18 | srcs = ["row_test.cc"], 19 | deps = [ 20 | ":fory_row_format", 21 | "@googletest//:gtest", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /cpp/fory/type/BUILD: -------------------------------------------------------------------------------- 1 | load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") 2 | 3 | cc_library( 4 | name = "fory_type", 5 | srcs = glob(["*.cc"], exclude=["*test.cc"], allow_empty = True), 6 | hdrs = glob(["*.h"]), 7 | copts = select({ 8 | "@platforms//cpu:x86_64": ["-mavx2"], 9 | "//conditions:default": [], 10 | }), 11 | linkopts = select({ 12 | "@platforms//cpu:x86_64": ["-mavx2"], 13 | "//conditions:default": [], 14 | }), 15 | strip_include_prefix = "/cpp", 16 | alwayslink=True, 17 | linkstatic=True, 18 | deps = [ 19 | ], 20 | visibility = ["//visibility:public"], 21 | ) 22 | -------------------------------------------------------------------------------- /integration_tests/README.md: -------------------------------------------------------------------------------- 1 | # Integration tests for fory: 2 | 3 | - [jdk_compatibility_tests](jdk_compatibility_tests): test fory compatibility across multiple jdk versions. 4 | - [latest_jdk_tests](latest_jdk_tests): test latest jdk. 5 | - [graalvm_tests](graalvm_tests): test graalvm native image support. 6 | - [jpms_tests](jpms_tests): test JPMS module names. 7 | - [cpython_benchmark](cpython_benchmark): fory CPython microbenchmark. 8 | 9 | > Note that this integration_tests is not designed as a maven multi-module project on purpose, so we can introduce features of higher jdk version without breaking compilation for lower jdk, and add integration tests for other languages. 10 | -------------------------------------------------------------------------------- /javascript/packages/hps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apache-fory/hps", 3 | "version": "0.14.0", 4 | "description": "Apache Fory™ nodejs high-performance suite", 5 | "main": "dist/index.js", 6 | "files": [ 7 | "dist", 8 | "src", 9 | "scripts/preinstall.js", 10 | "binding.gyp" 11 | ], 12 | "gypfile": false, 13 | "scripts": { 14 | "preinstall": "node ./scripts/preinstall.js", 15 | "build": "node ./scripts/build.js", 16 | "prepublishOnly": "npm run build" 17 | }, 18 | "license": "Apache-2.0", 19 | "dependencies": { 20 | "bindings": "~1.2.1", 21 | "fs-extra": "^11.3.0", 22 | "nan": "^2.22.0", 23 | "node-gyp": "^11.0.0" 24 | }, 25 | "engines": { 26 | "node": "^20.0.0" 27 | } 28 | } -------------------------------------------------------------------------------- /javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "test": "npm run build && jest", 4 | "clear": "rm -rf ./packages/fory/dist && rm -rf ./packages/hps/dist", 5 | "build": "npm run clear && npm run build -w packages/fory -w packages/hps", 6 | "lint": "eslint .", 7 | "lint-fix": "eslint . --fix" 8 | }, 9 | "repository": "git@github.com:apache/fory.git", 10 | "workspaces": [ 11 | "packages/hps", 12 | "packages/fory" 13 | ], 14 | "devDependencies": { 15 | "@stylistic/eslint-plugin": "^1.5.1", 16 | "@types/js-beautify": "^1.14.3", 17 | "eslint": "^8.55.0", 18 | "js-beautify": "^1.14.11", 19 | "jest": "^29.5.0", 20 | "jest-junit": "^16.0.0", 21 | "ts-jest": "^29.0.2", 22 | "typescript": "^4.8.4" 23 | } 24 | } -------------------------------------------------------------------------------- /java/fory-format/src/main/resources/META-INF/NOTICE: -------------------------------------------------------------------------------- 1 | Apache Fory™ 2 | Copyright 2023-2025 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | ================================================================ 8 | 9 | This product includes a number of Dependencies/Code with separate copyright notices 10 | and license terms. Your use of these submodules is subject to the terms and 11 | conditions of the following licenses. 12 | 13 | ================================================================ 14 | 15 | Apache Spark (https://github.com/apache/spark) 16 | Copyright 2014 and onwards The Apache Software Foundation. 17 | 18 | ================================================================ 19 | -------------------------------------------------------------------------------- /java/fory-core/src/main/resources/META-INF/native-image/org.apache.fory/fory-core/serialization-config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "java.lang.reflect.Proxy", 4 | "fields": [], 5 | "methods": [ 6 | { "name": "" }, 7 | { "name": "writeReplace" } 8 | ], 9 | "customTargetConstructorClass": "java.lang.Object" 10 | }, 11 | { "name": "java.lang.Throwable" }, 12 | { "name": "java.lang.Exception" }, 13 | { "name": "java.lang.RuntimeException" }, 14 | { "name": "java.lang.IllegalArgumentException" }, 15 | { "name": "java.lang.IllegalStateException" }, 16 | { "name": "java.lang.NullPointerException" }, 17 | { "name": "java.lang.IndexOutOfBoundsException" }, 18 | { "name": "java.lang.ArrayIndexOutOfBoundsException" }, 19 | { "name": "java.io.IOException" } 20 | ] 21 | -------------------------------------------------------------------------------- /python/pyfory/__init__.pxd: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /python/pyfory/meta/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /python/pyfory/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /python/pyfory/tests/test_type.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /python/pyfory/includes/__init__.pxd: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /python/pyfory/lib/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /python/pyfory/format/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | -------------------------------------------------------------------------------- /javascript/packages/fory/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@apache-fory/fory", 3 | "version": "0.14.0", 4 | "description": "Apache Fory™ is a blazingly fast multi-language serialization framework powered by jit and zero-copy", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "prepublishOnly": "npm run build" 9 | }, 10 | "files": [ 11 | "dist" 12 | ], 13 | "license": "Apache-2.0", 14 | "devDependencies": { 15 | "@types/node": "^18.7.21", 16 | "@typescript-eslint/eslint-plugin": "^5.40.0", 17 | "@typescript-eslint/parser": "^5.40.0", 18 | "benchmark": "^2.1.4", 19 | "eslint": "^8.25.0", 20 | "protobufjs": "^7.2.4" 21 | }, 22 | "dependencies": { 23 | "node-gyp": "^9.4.0", 24 | "tslib": "^2.4.0" 25 | }, 26 | "repository": "git@github.com:apache/fory.git", 27 | "workspaces": [ 28 | "packages/hps" 29 | ] 30 | } -------------------------------------------------------------------------------- /scala/project/build.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | sbt.version=1.9.9 19 | -------------------------------------------------------------------------------- /rust/rustfmt.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | edition = "2021" 19 | reorder_imports = true 20 | -------------------------------------------------------------------------------- /ci/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # This file makes the tasks directory a Python package 19 | -------------------------------------------------------------------------------- /cpp/fory/thirdparty/MurmurHash3.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH3_H_ 6 | #define _MURMURHASH3_H_ 7 | 8 | #include 9 | 10 | //----------------------------------------------------------------------------- 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | void MurmurHash3_x86_32(const void *key, int len, uint32_t seed, void *out); 16 | 17 | void MurmurHash3_x86_128(const void *key, int len, uint32_t seed, void *out); 18 | 19 | void MurmurHash3_x64_128(const void *key, int len, uint32_t seed, void *out); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | //----------------------------------------------------------------------------- 26 | 27 | #endif // _MURMURHASH3_H_ -------------------------------------------------------------------------------- /dart/packages/fory-test/test_config.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | python: 19 | executable: python 20 | -------------------------------------------------------------------------------- /dart/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | analyzer: 19 | errors: 20 | prefer_relative_imports: ignore 21 | -------------------------------------------------------------------------------- /python/pyfory/buffer.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | from pyfory._util import Buffer # noqa: F401 # pylint: disable=unused-import 19 | -------------------------------------------------------------------------------- /python/pyfory/lib/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | from pyfory.lib import mmh3 # noqa: F401 # pylint: disable=unused-import 19 | -------------------------------------------------------------------------------- /python/pyfory/lib/mmh3/__init__.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | from .mmh3 import * # noqa: F401,F403 # pylint: disable=unused-import 19 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/serializer/collection/list/linked_list_serializer.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | -------------------------------------------------------------------------------- /dart/note/analysis/constructor.txt: -------------------------------------------------------------------------------- 1 | Fish(int? para1, double? para2,) : 2 | _g = para1, i = para2; 3 | This is not considered a Redirecting Constructor 4 | 5 | ConstructorElement::superConstructor parameter is the parent class constructor used by the current constructor. 6 | Since a class can have more than one constructor, this represents which parent class constructor is chosen by the current constructor being analyzed. 7 | Note that using super.param in the parameters also counts as using the parent class constructor (obviously, this is the unnamed constructor of the parent class). 8 | 9 | ConstructorElement::redirectedConstructor parameter is the redirecting constructor used by the current constructor. 10 | Note that the parent class constructor is not a redirecting constructor, even if it is called using :super(...). 11 | 12 | Even if a class does not declare a constructor, there will be a default constructor, in which case isDefaultConstructor will be true. 13 | -------------------------------------------------------------------------------- /rust/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [toolchain] 19 | channel = "stable" 20 | components = ["rustfmt", "clippy", "rust-analyzer"] 21 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/config/config.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | abstract class Config{ 21 | const Config(); 22 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/dev_annotation/optimize.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | const inline = pragma('vm:prefer-inline'); -------------------------------------------------------------------------------- /dart/packages/fory/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | include: package:lints/recommended.yaml 19 | 20 | analyzer: 21 | exclude: 22 | - vault/** 23 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/furiable.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | abstract interface class Furiable { 21 | Type get $foryType; 22 | } -------------------------------------------------------------------------------- /dart/packages/fory-test/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | include: package:lints/recommended.yaml 19 | 20 | analyzer: 21 | exclude: 22 | - vault/** 23 | -------------------------------------------------------------------------------- /rust/tests/tests/compatible/mod.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | mod test_basic_type; 19 | mod test_container; 20 | mod test_struct; 21 | mod test_struct_enum; 22 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/annotation/fory_object.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | abstract class ForyObject { 21 | const ForyObject(); 22 | } 23 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/const/location_level.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | enum LocationLevel{ 21 | clsLevel, 22 | fieldLevel, 23 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/const/deser_flags.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class DeserFlags{ 21 | static const int notSupportXLangFlag = 0; 22 | } -------------------------------------------------------------------------------- /rust/tests/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | mod compatible; 19 | mod test_any; 20 | mod test_collection; 21 | mod test_max_dyn_depth; 22 | mod test_tuple; 23 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | root = true 19 | 20 | [*] 21 | end_of_line = lf 22 | indent_style = space 23 | insert_final_newline = true 24 | trim_trailing_whitespace = true 25 | -------------------------------------------------------------------------------- /python/pyfory/lib/__init__.pxd: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # distutils: language = c++ 19 | # cython: embedsignature = True 20 | # cython: language_level = 3 21 | # cython: annotate = True 22 | -------------------------------------------------------------------------------- /dart/packages/fory-test/README.md: -------------------------------------------------------------------------------- 1 | ## Testing Approach 2 | 3 | The test suite is inspired by Apache Fory™ Java's testing approach and includes: 4 | 5 | - **Datatype Tests**: Validates custom data types implemented for Dart 6 | - **Code Generation Tests**: Ensures correctness of the generated static code 7 | - **Buffer Tests**: Validates correct memory handling for primitive types 8 | - **Cross-Language Tests**: Tests functionality against other Apache Fory™ implementations 9 | - **Performance Tests**: Simple benchmarks for serialization/deserialization performance 10 | 11 | ### Running Tests 12 | 13 | Tests use the standard [dart test](https://pub.dev/packages/test) framework. 14 | 15 | To run tests: 16 | 17 | ```bash 18 | # First, generate necessary code 19 | cd fory-test 20 | dart run build_runner build 21 | 22 | # Run all tests 23 | dart test 24 | 25 | # For more options (skipping tests, platform-specific tests, etc.) 26 | # See: https://github.com/dart-lang/test/blob/master/pkgs/test/README.md 27 | ``` 28 | -------------------------------------------------------------------------------- /python/pyfory/lib/mmh3/__init__.pxd: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # distutils: language = c++ 19 | # cython: embedsignature = True 20 | # cython: language_level = 3 21 | # cython: annotate = True 22 | -------------------------------------------------------------------------------- /WORKSPACE: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # This file is intentionally kept minimal. 19 | # Dependencies are managed via MODULE.bazel using bzlmod. 20 | # See MODULE.bazel for the list of dependencies. 21 | -------------------------------------------------------------------------------- /dart/packages/fory-test/lib/extensions/num_ext.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | // extension Int64Extensions on int { 21 | // int get maxValue => 0x7FFFFFFFFFFFFFFF; 22 | // } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/memory/mem_range.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'dart:typed_data'; 21 | 22 | typedef MemRange = ({ByteBuffer buffer, int offset, int len}); -------------------------------------------------------------------------------- /java/fory-core/src/test/java/javax/fory/test/Accessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package javax.fory.test; 21 | 22 | public class Accessor { 23 | int f1; 24 | } 25 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/const/meta_string_const.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class MetaStringConst{ 21 | static const int metaStrMaxLen = 32767; // int16 max value 22 | } -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/resolver/longlongpkg/C1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.resolver.longlongpkg; 21 | 22 | public class C1 {} 23 | -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/resolver/longlongpkg/C2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.resolver.longlongpkg; 21 | 22 | public class C2 {} 23 | -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/resolver/longlongpkg/C3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.resolver.longlongpkg; 21 | 22 | public class C3 {} 23 | -------------------------------------------------------------------------------- /rust/fory-core/src/resolver/mod.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | pub mod context; 19 | pub mod meta_resolver; 20 | pub mod meta_string_resolver; 21 | pub mod ref_resolver; 22 | pub mod type_resolver; 23 | -------------------------------------------------------------------------------- /cpp/fory/row/type.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | // This file is kept for backward compatibility. 21 | // All type definitions are now inline in schema.h 22 | #include "fory/row/type.h" 23 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/fory_test.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | 21 | // export lib for test. 22 | export 'src/util/murmur3hash.dart'; 23 | export 'src/resolver/dart_type_resolver.dart'; -------------------------------------------------------------------------------- /python/pyfory/lib/tests/test_mmh3.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | from pyfory.lib import mmh3 19 | 20 | 21 | def test_mmh3(): 22 | assert mmh3.hash_buffer(bytearray([1, 2, 3]), seed=47)[0] == -7373655978913577904 23 | -------------------------------------------------------------------------------- /dart/example/enum_example.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/fory.dart'; 21 | 22 | part 'enum_example.g.dart'; 23 | 24 | @foryEnum 25 | enum Color { 26 | Red, 27 | Gray, 28 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/const/annotation_target.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | // enum AnnotationTarget { 21 | // CLASS, 22 | // FIELD, 23 | // METHOD, 24 | // PARAMETER, 25 | // } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/resolver/meta_string_handler.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | abstract class MataStringHandler{ 21 | const MataStringHandler(); 22 | final int smallStringThreshold = 16; 23 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/builder/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /** encoder package is used for codegen based serialization. */ 21 | package org.apache.fory.builder; 22 | -------------------------------------------------------------------------------- /cpp/fory/row/type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | // This file is kept for backward compatibility. 23 | // All type definitions are now in schema.h 24 | #include "fory/row/schema.h" 25 | -------------------------------------------------------------------------------- /rust/fory-core/src/row/bit_util.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | const WORD_SIZE: usize = 8; 19 | 20 | pub fn calculate_bitmap_width_in_bytes(num_fields: usize) -> usize { 21 | ((num_fields + 63) / 64) * WORD_SIZE 22 | } 23 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/util/extension/int_extensions.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | extension IntExtensions on int { 21 | int rotateLeft(int n) { 22 | return (this << n) | (this >>> (64 - n)); 23 | } 24 | } -------------------------------------------------------------------------------- /rust/fory-derive/src/object/mod.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | mod derive_enum; 19 | mod misc; 20 | pub(crate) mod read; 21 | mod serializer; 22 | pub(crate) mod util; 23 | mod write; 24 | 25 | pub use serializer::derive_serializer; 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | blank_issues_enabled: false 19 | contact_links: 20 | - name: Community Support 21 | url: https://github.com/apache/fory/discussions 22 | about: Please ask and answer questions here. 23 | -------------------------------------------------------------------------------- /dart/build.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | targets: 19 | $default: 20 | builders: 21 | source_gen:combining_builder: 22 | options: 23 | build_extensions: 24 | '^lib/entity/{{}}.dart': 'lib/generated/{{}}.g.dart' 25 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/const/fory_const.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class ForyConst{ 21 | static const String importPath = 'fory/fory.dart'; 22 | static const String intermediateMark = 'fory_meta'; 23 | } -------------------------------------------------------------------------------- /scala/project/plugins.sbt: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.12.2") 20 | addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1") 21 | addSbtPlugin("org.mdedetrich" % "sbt-apache-sonatype" % "0.1.12") 22 | -------------------------------------------------------------------------------- /.github/sync.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | apache/fory-site@main: 19 | - source: docs/guide/ 20 | dest: docs/docs/guide/ 21 | - source: docs/specification/ 22 | dest: docs/specification/ 23 | - source: docs/benchmarks/ 24 | dest: static/img/benchmarks/ 25 | -------------------------------------------------------------------------------- /cpp/fory/util/time_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | 25 | namespace fory { 26 | 27 | std::string FormatTimePoint(std::chrono::system_clock::time_point tp); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /dart/packages/fory-test/build.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | targets: 19 | $default: 20 | builders: 21 | source_gen:combining_builder: 22 | options: 23 | build_extensions: 24 | '^lib/entity/{{}}.dart': 'lib/generated/{{}}.g.dart' 25 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codec/meta_string_codecs.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | abstract class MetaStringCodecs { 21 | final int specialChar1; 22 | final int specialChar2; 23 | 24 | const MetaStringCodecs(this.specialChar1, this.specialChar2); 25 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/ToByteFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | @FunctionalInterface 23 | public interface ToByteFunction { 24 | byte applyAsByte(T value); 25 | } 26 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/ToCharFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | @FunctionalInterface 23 | public interface ToCharFunction { 24 | char applyAsChar(T value); 25 | } 26 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/util/hash_util.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class HashUtil { 21 | static int hashIntList(List list){ 22 | int res = 1; 23 | for (var i in list) { 24 | res = 31 * res + i; 25 | } 26 | return res; 27 | } 28 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/ToFloatFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | @FunctionalInterface 23 | public interface ToFloatFunction { 24 | float applyAsFloat(T value); 25 | } 26 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/ToShortFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | @FunctionalInterface 23 | public interface ToShortFunction { 24 | short applyAsShort(T value); 25 | } 26 | -------------------------------------------------------------------------------- /python/pyfory/error.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | 19 | class ForyError(Exception): 20 | pass 21 | 22 | 23 | class TypeNotCompatibleError(ForyError): 24 | pass 25 | 26 | 27 | class TypeUnregisteredError(ForyError): 28 | pass 29 | 30 | 31 | class CompileError(ForyError): 32 | pass 33 | -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/codegen/javalangnameconflict/Object.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.codegen.javalangnameconflict; 21 | 22 | /** this is just in place to trigger the name conflict for #1363 */ 23 | public class Object {} 24 | -------------------------------------------------------------------------------- /dart/packages/fory-test/lib/extensions/obj_ext.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | extension ObjExt on Object { 21 | bool strEquals(Object other) { 22 | if (identical(this, other)) { 23 | return true; 24 | } 25 | return toString() == other.toString(); 26 | } 27 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/dev_annotation/maybe_modified.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:meta/meta_meta.dart'; 21 | 22 | @Target({TargetKind.parameter}) 23 | class MayBeModified { 24 | const MayBeModified(); 25 | } 26 | 27 | const mayBeModified = MayBeModified(); -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/serializer/custom_serializer.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/serializer/serializer.dart'; 21 | 22 | abstract base class CustomSerializer extends Serializer{ 23 | const CustomSerializer(super.objType, super.writeRef); 24 | } -------------------------------------------------------------------------------- /dart/packages/fory-test/lib/entity/enum_foo.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/fory.dart'; 21 | 22 | part '../generated/enum_foo.g.dart'; 23 | 24 | @foryEnum 25 | enum EnumFoo { 26 | A, 27 | B 28 | } 29 | @foryEnum 30 | enum EnumSubClass { 31 | A, 32 | B; 33 | } -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Fory™ 2 | Copyright 2023-2025 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | ================================================================ 8 | 9 | This product includes a number of Dependencies/Code with separate copyright notices 10 | and license terms. Your use of these submodules is subject to the terms and 11 | conditions of the following licenses. 12 | 13 | ================================================================ 14 | 15 | Apache Spark (https://github.com/apache/spark) 16 | Copyright 2014 and onwards The Apache Software Foundation. 17 | 18 | ================================================================ 19 | 20 | Apache Commons IO (https://github.com/apache/commons-io) 21 | Copyright 2002-2025 The Apache Software Foundation 22 | 23 | ================================================================ 24 | 25 | Apache Commons Lang (https://github.com/apache/commons-lang) 26 | Copyright 2002-2025 The Apache Software Foundation 27 | 28 | ================================================================ 29 | -------------------------------------------------------------------------------- /rust/fory-core/src/row/mod.rs: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | mod bit_util; 19 | mod reader; 20 | #[allow(clippy::module_inception)] 21 | mod row; 22 | mod writer; 23 | 24 | pub use reader::{from_row, ArrayViewer, StructViewer}; 25 | pub use row::Row; 26 | pub use writer::{to_row, ArrayWriter, StructWriter}; 27 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/entity/import_prefix.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:meta/meta.dart'; 21 | 22 | @immutable 23 | class ImportPrefix{ 24 | final int analyzeLibId; 25 | final String prefix; 26 | 27 | const ImportPrefix(this.analyzeLibId, this.prefix); 28 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/meta/specs/custom_type_spec.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/const/obj_type.dart'; 21 | 22 | abstract class CustomTypeSpec{ 23 | final Type dartType; 24 | final ObjType objType; 25 | const CustomTypeSpec(this.dartType, this.objType); 26 | } -------------------------------------------------------------------------------- /examples/cpp/hello_world/BUILD: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | load("@rules_cc//cc:defs.bzl", "cc_binary") 19 | 20 | cc_binary( 21 | name = "hello_world", 22 | srcs = ["main.cc"], 23 | deps = [ 24 | "//cpp/fory/serialization:fory_serialization", 25 | ], 26 | visibility = ["//visibility:public"], 27 | ) 28 | -------------------------------------------------------------------------------- /ci/tasks/go.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import logging 19 | from . import common 20 | 21 | 22 | def run(): 23 | """Run Go CI tasks.""" 24 | logging.info("Executing fory go tests") 25 | common.cd_project_subdir("go/fory") 26 | common.exec_cmd("go test -v") 27 | logging.info("Executing fory go tests succeeds") 28 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/config/codegen_style.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class CodegenStyle{ 21 | static const int indent = 2; 22 | static const String magicSign = r'//$FORY '; 23 | static const String markSep = ' '; 24 | static const String importAsPrefix = 'fory_imp'; 25 | } 26 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/util/math_checker.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/dev_annotation/optimize.dart'; 21 | 22 | class MathChecker{ 23 | 24 | @inline 25 | static bool validInt32(int value) { 26 | return value >= -2147483648 && value <= 2147483647; 27 | } 28 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/entity/struct_hash_pair.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:meta/meta.dart'; 21 | 22 | @immutable 23 | class StructHashPair{ 24 | final int fromForyHash; 25 | final int toForyHash; 26 | 27 | const StructHashPair(this.fromForyHash, this.toForyHash); 28 | } -------------------------------------------------------------------------------- /integration_tests/graalvm_tests/src/main/java/org/apache/fory/graalvm/record/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.graalvm.record; 21 | 22 | import java.util.List; 23 | import java.util.Map; 24 | 25 | public record Foo(int f1, String f2, List f3, Map f4) {} 26 | -------------------------------------------------------------------------------- /rust/tests/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | [package] 19 | name = "tests" 20 | version.workspace = true 21 | edition.workspace = true 22 | rust-version.workspace = true 23 | publish = false 24 | 25 | [dependencies] 26 | fory-core = { path = "../fory-core" } 27 | fory-derive = { path = "../fory-derive" } 28 | 29 | chrono = "0.4" 30 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/analyze/interface/enum_analyzer.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:analyzer/dart/element/element.dart'; 21 | import 'package:fory/src/codegen/meta/impl/enum_spec_gen.dart'; 22 | 23 | abstract class EnumAnalyzer{ 24 | EnumSpecGen analyze(EnumElement enumElement); 25 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/config/Language.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.config; 21 | 22 | /** Language supported by fory. */ 23 | public enum Language { 24 | XLANG, 25 | JAVA, 26 | PYTHON, 27 | CPP, 28 | GO, 29 | JAVASCRIPT, 30 | RUST, 31 | DART, 32 | } 33 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/analyze/interface/class_analyzer.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:analyzer/dart/element/element.dart'; 21 | import 'package:fory/src/codegen/meta/impl/class_spec_gen.dart'; 22 | 23 | abstract class ClassAnalyzer { 24 | ClassSpecGen analyze(ClassElement clsElement); 25 | } -------------------------------------------------------------------------------- /go/fory/endian_big.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | //go:build mips || mips64 || ppc64 || s390x 19 | 20 | package fory 21 | 22 | // isLittleEndian is a compile-time constant for big-endian architectures. 23 | // This enables dead code elimination - the compiler removes little-endian branches entirely. 24 | const isLittleEndian = false 25 | -------------------------------------------------------------------------------- /java/fory-format/src/main/java/org/apache/fory/format/encoder/CustomCollectionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.format.encoder; 21 | 22 | import java.util.Collection; 23 | 24 | public interface CustomCollectionFactory> { 25 | C newCollection(int size); 26 | } 27 | -------------------------------------------------------------------------------- /examples/cpp/hello_row/BUILD: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | load("@rules_cc//cc:defs.bzl", "cc_binary") 19 | 20 | cc_binary( 21 | name = "hello_row", 22 | srcs = ["main.cc"], 23 | deps = [ 24 | "//cpp/fory/encoder:fory_encoder", 25 | "//cpp/fory/row:fory_row_format", 26 | ], 27 | visibility = ["//visibility:public"], 28 | ) 29 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/ForyCopyable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory; 21 | 22 | /** 23 | * Fory copy interface. Customize the copy method of the class 24 | * 25 | * @param custom copy interface object 26 | */ 27 | public interface ForyCopyable { 28 | T copy(Fory fory); 29 | } 30 | -------------------------------------------------------------------------------- /java/fory-core/src/main/resources/META-INF/NOTICE: -------------------------------------------------------------------------------- 1 | Apache Fory™ 2 | Copyright 2023-2025 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | ================================================================ 8 | 9 | This product includes a number of Dependencies/Code with separate copyright notices 10 | and license terms. Your use of these submodules is subject to the terms and 11 | conditions of the following licenses. 12 | 13 | ================================================================ 14 | 15 | Apache Spark (https://github.com/apache/spark) 16 | Copyright 2014 and onwards The Apache Software Foundation. 17 | 18 | ================================================================ 19 | 20 | Apache Commons IO (https://github.com/apache/commons-io) 21 | Copyright 2002-2025 The Apache Software Foundation 22 | 23 | ================================================================ 24 | 25 | Apache Commons Lang (https://github.com/apache/commons-lang) 26 | Copyright 2002-2025 The Apache Software Foundation 27 | 28 | ================================================================ 29 | -------------------------------------------------------------------------------- /licenses/LICENSE-murmurHash3.js.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2020 Karan Lyons 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /javascript/packages/hps/binding.gyp: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | { 19 | "targets": [ 20 | { 21 | "target_name": "hps", 22 | "sources": [ 23 | "src/fastcall.cc" 24 | ], 25 | "include_dirs" : [ 26 | " names; 28 | late final Map> map; 29 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/const/fory_header_const.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class ForyHeaderConst{ 21 | static const int magicNumber = 0x62d4; 22 | 23 | static const int nullFlag = 1; 24 | static const int littleEndianFlag = 1 << 1; 25 | static const int crossLanguageFlag = 1 << 2; 26 | static const int outOfBandFlag = 1 << 3; 27 | } -------------------------------------------------------------------------------- /java/fory-format/src/main/java/org/apache/fory/format/row/MapData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.format.row; 21 | 22 | /** Interface for map in row format. */ 23 | public interface MapData { 24 | int numElements(); 25 | 26 | ArrayData keyArray(); 27 | 28 | ArrayData valueArray(); 29 | 30 | MapData copy(); 31 | } 32 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/memory/BigEndian.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.memory; 21 | 22 | public class BigEndian { 23 | /** Get short in big endian order from provided buffer. */ 24 | public static short getShortB(byte[] b, int off) { 25 | return (short) ((b[off + 1] & 0xFF) + (b[off] << 8)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/SerializableSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | import java.io.Serializable; 23 | import java.util.function.Supplier; 24 | 25 | /** Serializable {@link Supplier}. */ 26 | public interface SerializableSupplier extends Supplier, Serializable {} 27 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/SerializableTriFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | import java.io.Serializable; 23 | 24 | /** Serializable {@link TriFunction}. */ 25 | public interface SerializableTriFunction 26 | extends TriFunction, Serializable {} 27 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/SerializableFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | import java.io.Serializable; 23 | import java.util.function.Function; 24 | 25 | /** Serializable {@link Function}. */ 26 | public interface SerializableFunction extends Function, Serializable {} 27 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/analyze/annotation/location_level_ensure.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:meta/meta_meta.dart'; 21 | import 'package:fory/src/codegen/const/location_level.dart'; 22 | 23 | @Target({TargetKind.parameter}) 24 | class LocationEnsure{ 25 | final LocationLevel locationLevel; 26 | const LocationEnsure(this.locationLevel); 27 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/const/lang.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | /// Language supported by fory. 21 | enum Language{ 22 | xlang, 23 | java, 24 | python, 25 | cpp, 26 | go, 27 | javascript, 28 | rust, 29 | dart; 30 | 31 | static int get peerLangBeginIndex => Language.java.index; 32 | static int get peerLangEndIndex => Language.dart.index; 33 | } 34 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/exception/fory_exception.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | abstract class ForyException extends Error{ 21 | ForyException(); 22 | 23 | void giveExceptionMessage(StringBuffer buf){} 24 | 25 | @override 26 | String toString() { 27 | final buf = StringBuffer(); 28 | giveExceptionMessage(buf); 29 | return buf.toString(); 30 | } 31 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/serializer/SerializerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.serializer; 21 | 22 | import org.apache.fory.Fory; 23 | 24 | /** Serializer factory for customizing serializer creation. */ 25 | public interface SerializerFactory { 26 | 27 | Serializer createSerializer(Fory fory, Class cls); 28 | } 29 | -------------------------------------------------------------------------------- /go/fory/endian_little.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | //go:build amd64 || arm64 || 386 || arm || loong64 || mips64le || mipsle || ppc64le || riscv64 || wasm 19 | 20 | package fory 21 | 22 | // isLittleEndian is a compile-time constant for little-endian architectures. 23 | // This enables dead code elimination - the compiler removes big-endian branches entirely. 24 | const isLittleEndian = true 25 | -------------------------------------------------------------------------------- /ci/tasks/javascript.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import logging 19 | from . import common 20 | 21 | 22 | def run(): 23 | """Run JavaScript CI tasks.""" 24 | logging.info("Executing fory javascript tests.") 25 | common.cd_project_subdir("javascript") 26 | common.exec_cmd("npm install") 27 | common.exec_cmd("npm run test") 28 | 29 | logging.info("Executing fory javascript tests succeeds.") 30 | -------------------------------------------------------------------------------- /dart/example/typed_data_array_example.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'dart:typed_data'; 21 | 22 | import 'package:fory/fory.dart'; 23 | 24 | part 'typed_data_array_example.g.dart'; 25 | 26 | @foryClass 27 | class TypedDataArrayExample with _$TypedDataArrayExampleFory{ 28 | late final Uint8List bytes; 29 | late final Int32List nums; 30 | late final BoolList bools; 31 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/util/function/SerializableBiFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.util.function; 21 | 22 | import java.io.Serializable; 23 | import java.util.function.BiFunction; 24 | 25 | /** Serializable {@link BiFunction}. */ 26 | public interface SerializableBiFunction extends BiFunction, Serializable {} 27 | -------------------------------------------------------------------------------- /python/pyfory/tests/core.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import pytest 19 | 20 | try: 21 | import pyarrow as pa 22 | except ImportError: 23 | pa = None 24 | 25 | 26 | def require_pyarrow(func): 27 | arrow_not_installed = pa is None or not hasattr(pa, "get_library_dirs") 28 | mark_decorator = pytest.mark.skipif(arrow_not_installed, reason="pyarrow not installed")(func) 29 | return mark_decorator 30 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codec/entity/str_stat.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | final class StrStat{ 21 | final int digitCount; 22 | final int upperCount; 23 | final bool canLUDS; // LowerUpperDigitSpecial 24 | final bool canLS; // LowerSpecial 25 | 26 | const StrStat( 27 | this.digitCount, 28 | this.upperCount, 29 | this.canLUDS, 30 | this.canLS, 31 | ); 32 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/meta/custom_type_spec_gen.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/codegen/meta/gen_export.dart'; 21 | import 'package:meta/meta.dart'; 22 | 23 | @immutable 24 | abstract class CustomTypeSpecGen extends GenExport{ 25 | final String name; 26 | final String importPath; 27 | 28 | const CustomTypeSpecGen(this.name, this.importPath); 29 | } -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/meta/impl/enum_brief.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | class EnumBrief{ 21 | // These two fields embed the Enum's Spec directly into TypeSpec when the Type is Enum, to reduce runtime overhead 22 | final String importPrefix; 23 | final String enumName; 24 | 25 | const EnumBrief( 26 | this.importPrefix, 27 | this.enumName, 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /python/pyfory/lib/tests/test_collection.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | from pyfory.lib.collection import WeakIdentityKeyDictionary 19 | 20 | 21 | def test_weak_identity_key_dict(): 22 | d = WeakIdentityKeyDictionary() 23 | 24 | class A: 25 | def __hash__(self): 26 | raise Exception 27 | 28 | a = A() 29 | d[a] = 1 30 | assert d[a] == 1 31 | del a 32 | assert len(d) == 0 33 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/entity/either.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:meta/meta.dart'; 21 | 22 | @immutable 23 | class Either { 24 | final L? left; 25 | final R? right; 26 | 27 | Either.left(this.left) : right = null; 28 | Either.right(this.right) : left = null; 29 | 30 | bool get isLeft => left != null; 31 | bool get isRight => right != null; 32 | } -------------------------------------------------------------------------------- /dart/packages/fory-test/lib/entity/some_class.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/fory.dart'; 21 | 22 | part '../generated/some_class.g.dart'; 23 | 24 | @foryClass 25 | class SomeClass with _$SomeClassFory { 26 | late int id; 27 | late String name; 28 | late Map map; 29 | 30 | SomeClass(this.id, this.name, this.map); 31 | 32 | SomeClass.noArgs(); 33 | } -------------------------------------------------------------------------------- /dart/pubspec.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: fory_dart 19 | description: apache fory dart support 20 | version: 1.0.0 21 | # repository: https://github.com/my_org/my_repo 22 | 23 | environment: 24 | sdk: ^3.6.1 25 | 26 | # Add regular dependencies here. 27 | dependencies: 28 | fory: 1.0.0 29 | build_runner: ^2.4.13 30 | dev_dependencies: 31 | lints: ^5.0.0 32 | workspace: 33 | - packages/fory 34 | - packages/fory-test 35 | -------------------------------------------------------------------------------- /dart/packages/fory-test/lib/entity/simple_struct1.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/fory.dart'; 21 | part '../generated/simple_struct1.g.dart'; 22 | 23 | @foryClass 24 | class SimpleStruct1 with _$SimpleStruct1Fory { 25 | late Int32 a; 26 | 27 | @override 28 | bool operator ==(Object other) { 29 | if (other is! SimpleStruct1) return false; 30 | return a == other.a; 31 | } 32 | } -------------------------------------------------------------------------------- /python/pyfory/format/_format.pyx: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # distutils: language = c++ 19 | # cython: embedsignature = True 20 | # cython: language_level = 3 21 | # cython: annotate = True 22 | 23 | from libc.stdint cimport * 24 | from libcpp.memory cimport * 25 | 26 | # include "buffer.pxi" 27 | 28 | # Fory schema types 29 | include "schema.pxi" 30 | 31 | include "row.pxi" 32 | 33 | # Python encoder for row format 34 | include "encoder.pxi" 35 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/pack.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/resolver/struct_hash_resolver.dart'; 21 | 22 | typedef GetTagByType = String Function(Type type); 23 | 24 | abstract base class Pack { 25 | final StructHashResolver structHashResolver; 26 | final GetTagByType getTagByDartType; 27 | 28 | const Pack( 29 | this.structHashResolver, 30 | this.getTagByDartType, 31 | ); 32 | } -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/builder/pkg/AccessLevelClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.builder.pkg; 21 | 22 | public class AccessLevelClass { 23 | static class PkgLevelClass { 24 | int f1; 25 | } 26 | 27 | static class PrivateLevelClass { 28 | int f1; 29 | } 30 | 31 | PkgLevelClass f1; 32 | PrivateLevelClass f2; 33 | private PrivateLevelClass f3; 34 | } 35 | -------------------------------------------------------------------------------- /java/fory-format/src/main/java/org/apache/fory/format/row/ArrayData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.format.row; 21 | 22 | /** Interface for array in row format. */ 23 | public interface ArrayData extends Getters, Setters { 24 | int numElements(); 25 | 26 | ArrayData copy(); 27 | 28 | default void update(int i, Object value) { 29 | throw new UnsupportedOperationException(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/collection/ObjectMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.collection; 21 | 22 | /** An unordered map which has better `get` performance than {@link java.util.HashMap}. */ 23 | public final class ObjectMap extends ForyObjectMap { 24 | public ObjectMap(int initialCapacity, float loadFactor) { 25 | super(initialCapacity, loadFactor); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dart/packages/fory/build.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | builders: 19 | fory_obj_builder: 20 | import: "package:fory/src/codegen/generate/builders.dart" 21 | builder_factories: ["foryObjSpecBuilder"] 22 | build_extensions: {".dart": ["fory_meta.g.part"]} # Process .dart files and generate .g.part files 23 | auto_apply: dependents 24 | build_to: cache 25 | applies_builders: ["source_gen|combining_builder"] # Ensure execution after source_gen 26 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/resolver/tag_str_encode_resolver.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/meta/meta_string.dart'; 21 | import 'package:fory/src/resolver/impl/tag_str_encode_resolver_impl.dart'; 22 | 23 | abstract class TagStringEncodeResolver{ 24 | static TagStringEncodeResolver get newInst => TagStringEncodeResolverImpl(); 25 | MetaString encodeTypeName(String tag); 26 | MetaString encodeNs(String ns); 27 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/annotation/Public.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.annotation; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Target; 25 | 26 | /** Annotation for marking classes as public, stable interfaces. */ 27 | @Documented 28 | @Target(ElementType.TYPE) 29 | @Public 30 | public @interface Public {} 31 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/const/ref_flag.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | enum RefFlag{ 21 | NULL(-3), 22 | TRACKED_ALREADY(-2), 23 | UNTRACKED_NOT_NULL(-1), 24 | TRACK_FIRST(0); 25 | 26 | final int id; 27 | 28 | const RefFlag(this.id); 29 | 30 | // static bool checkAllow(int id){ 31 | // return id >= NULL.id && id <= TRACK_FIRST.id; 32 | // } 33 | 34 | bool get noNeedToSer => (this == NULL || this == TRACKED_ALREADY); 35 | } -------------------------------------------------------------------------------- /cpp/fory/thirdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | add_library(fory_thirdparty 19 | MurmurHash3.cc 20 | ) 21 | add_library(fory::thirdparty ALIAS fory_thirdparty) 22 | 23 | target_include_directories(fory_thirdparty 24 | PUBLIC 25 | $ 26 | $ 27 | ) 28 | 29 | set_target_properties(fory_thirdparty PROPERTIES 30 | POSITION_INDEPENDENT_CODE ON 31 | OUTPUT_NAME fory_thirdparty 32 | ) 33 | -------------------------------------------------------------------------------- /dart/example/enum_example.g.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | // GENERATED CODE - DO NOT MODIFY BY HAND 21 | 22 | part of 'enum_example.dart'; 23 | 24 | // ************************************************************************** 25 | // ForyObjSpecGenerator 26 | // ************************************************************************** 27 | 28 | const $Color = EnumSpec( 29 | Color, 30 | [ 31 | Color.Red, 32 | Color.Gray, 33 | ], 34 | ); 35 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/entity/fields_cache_unit.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/codegen/meta/impl/field_spec_immutable.dart'; 21 | 22 | class FieldsCacheUnit { 23 | final List fieldImmutables; 24 | final Set fieldNames; 25 | final bool allFieldIndependent; 26 | bool fieldSorted = false; 27 | 28 | FieldsCacheUnit(this.fieldImmutables, this.allFieldIndependent, this.fieldNames); 29 | } -------------------------------------------------------------------------------- /ci/tasks/kotlin.py: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | import logging 19 | from . import common 20 | 21 | 22 | def run(): 23 | """Run Kotlin CI tasks.""" 24 | logging.info("Executing fory kotlin tests") 25 | common.cd_project_subdir("kotlin") 26 | 27 | # Using the same command as in run_ci.sh 28 | common.exec_cmd( 29 | "mvn -T16 --batch-mode --no-transfer-progress test -DfailIfNoTests=false" 30 | ) 31 | 32 | logging.info("Executing fory kotlin tests succeeds") 33 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/util/date_util.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/dev_annotation/optimize.dart'; 21 | 22 | class DateUtil{ 23 | static final DateTime epoch = DateTime(1970, 1, 1); 24 | 25 | @inline 26 | static int toEpochDay(DateTime date) { 27 | return date.difference(epoch).inDays; 28 | } 29 | 30 | @inline 31 | static DateTime fromEpochDay(int days) { 32 | return epoch.add(Duration(days: days)); 33 | } 34 | } -------------------------------------------------------------------------------- /integration_tests/jpms_tests/src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | module org.apache.fory.integration_tests { 21 | 22 | requires org.apache.fory.benchmark; 23 | requires org.apache.fory.core; 24 | requires org.apache.fory.format; 25 | requires org.apache.fory.test.core; 26 | 27 | // we can't really test any classes from this module because it only contains test-classes 28 | requires org.apache.fory.test.suite; 29 | } 30 | -------------------------------------------------------------------------------- /cpp/fory/python/pyfory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | #pragma once 21 | #include "Python.h" 22 | #include "fory/util/buffer.h" 23 | 24 | namespace fory { 25 | int Fory_PyBooleanSequenceWriteToBuffer(PyObject *collection, Buffer *buffer, 26 | Py_ssize_t start_index); 27 | int Fory_PyFloatSequenceWriteToBuffer(PyObject *collection, Buffer *buffer, 28 | Py_ssize_t start_index); 29 | } // namespace fory -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/annotation/CodegenInvoke.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.annotation; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * An annotation to mark a method will be invoked by generated method. This annotation is used for 27 | * documentation only. 28 | */ 29 | @Retention(RetentionPolicy.SOURCE) 30 | public @interface CodegenInvoke {} 31 | -------------------------------------------------------------------------------- /dart/packages/fory-test/pubspec.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: fory_test 19 | description: test for fory dart 20 | version: 1.0.0 21 | 22 | environment: 23 | sdk: ^3.6.1 24 | 25 | resolution: workspace 26 | 27 | dependencies: 28 | fory: 1.0.0 29 | checks: ^0.3.0 30 | path: ^1.9.1 31 | yaml: ^3.1.3 32 | dev_dependencies: 33 | lints: ^5.0.0 34 | build_runner: any 35 | test: ^1.24.0 36 | build_test: ^2.2.3 37 | analyzer: '>=6.5.0 <8.0.0' 38 | collection: ^1.19.1 39 | build: any 40 | -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/collection/Tuple2Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.collection; 21 | 22 | import static org.testng.Assert.*; 23 | 24 | import org.testng.annotations.Test; 25 | 26 | public class Tuple2Test { 27 | 28 | @Test 29 | public void testEquals() { 30 | assertEquals(Tuple2.of(1, "a"), Tuple2.of(1, "a")); 31 | assertEquals(Tuple2.of(1, "a").hashCode(), Tuple2.of(1, "a").hashCode()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.github/workflows/sync.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: Sync Files 19 | 20 | on: 21 | push: 22 | branches: 23 | - main 24 | 25 | jobs: 26 | sync: 27 | runs-on: ubuntu-latest 28 | if: github.repository == 'apache/fory' 29 | steps: 30 | - uses: actions/checkout@v5 31 | - name: Sync files 32 | uses: betahuhn/repo-file-sync-action@8b92be3375cf1d1b0cd579af488a9255572e4619 33 | with: 34 | GH_PAT: ${{ secrets.GH_PAT }} 35 | SKIP_PR: true 36 | -------------------------------------------------------------------------------- /benchmarks/go_benchmark/go.mod: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | module github.com/apache/fory/benchmarks/go_benchmark 19 | 20 | go 1.24.0 21 | 22 | require ( 23 | github.com/apache/fory/go/fory v0.0.0 24 | github.com/vmihailenco/msgpack/v5 v5.4.1 25 | google.golang.org/protobuf v1.36.0 26 | ) 27 | 28 | require ( 29 | github.com/spaolacci/murmur3 v1.1.0 // indirect 30 | github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect 31 | ) 32 | 33 | replace github.com/apache/fory/go/fory => ../../go/fory 34 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/meta/lib_import_pack.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:meta/meta.dart'; 21 | 22 | @immutable 23 | class LibImportPack{ 24 | final String? dartCorePrefix; 25 | final Map _libIdToPrefix; 26 | 27 | const LibImportPack(this._libIdToPrefix, this.dartCorePrefix); 28 | 29 | String? getPrefixByLibId(int libId){ 30 | return _libIdToPrefix[libId]; 31 | } 32 | 33 | bool get noPrefix =>_libIdToPrefix.isEmpty; 34 | } -------------------------------------------------------------------------------- /dart/packages/fory/pubspec.yaml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | name: fory 19 | description: apache fory dart support 20 | version: 1.0.0 21 | 22 | resolution: workspace 23 | 24 | environment: 25 | sdk: ^3.6.1 26 | 27 | # Add regular dependencies here. 28 | dependencies: 29 | analyzer: '>=6.5.0 <8.0.0' 30 | build: ^2.4.1 31 | build_config: ^1.1.0 32 | collection: ^1.19.1 33 | meta: ^1.14.0 34 | source_gen: ^2.0.0 35 | glob: ^2.1.3 36 | decimal: ^3.2.1 37 | 38 | dev_dependencies: 39 | lints: ^5.0.0 40 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/exception/ClassUnregisteredException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.exception; 21 | 22 | public class ClassUnregisteredException extends ForyException { 23 | 24 | public ClassUnregisteredException(Class cls) { 25 | this(cls.getName()); 26 | } 27 | 28 | public ClassUnregisteredException(String qualifiedName) { 29 | super(String.format("Class %s is not registered", qualifiedName)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/exception/InsecureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.exception; 21 | 22 | /** 23 | * If class registration is enabled, and class of object which is being serialized is not 24 | * registered(i.e. not in white-list), then this exception will be thrown. 25 | */ 26 | public class InsecureException extends ForyException { 27 | public InsecureException(String message) { 28 | super(message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/meta/spec_wraps/enum_spec_wrap.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:fory/src/meta/specs/enum_spec.dart'; 21 | import 'package:fory/src/serializer/serializer.dart'; 22 | 23 | final class EnumSpecWrap{ 24 | final List values; 25 | late final Serializer ser; 26 | 27 | EnumSpecWrap._( 28 | this.values, 29 | ); 30 | 31 | factory EnumSpecWrap.of( 32 | EnumSpec spec, 33 | ){ 34 | return EnumSpecWrap._(spec.values); 35 | } 36 | } -------------------------------------------------------------------------------- /go/fory/go.mod: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | module github.com/apache/fory/go/fory 19 | 20 | go 1.24.0 21 | 22 | require ( 23 | github.com/spaolacci/murmur3 v1.1.0 24 | github.com/stretchr/testify v1.7.0 25 | golang.org/x/tools v0.39.0 26 | ) 27 | 28 | require ( 29 | github.com/davecgh/go-spew v1.1.1 // indirect 30 | github.com/pmezard/go-difflib v1.0.0 // indirect 31 | golang.org/x/mod v0.30.0 // indirect 32 | golang.org/x/sync v0.18.0 // indirect 33 | gopkg.in/yaml.v3 v3.0.1 // indirect 34 | ) 35 | -------------------------------------------------------------------------------- /java/fory-test-core/src/test/java/org/apache/fory/test/bean/StructTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.test.bean; 21 | 22 | import org.testng.Assert; 23 | import org.testng.annotations.Test; 24 | 25 | public class StructTest { 26 | 27 | @Test 28 | public void testStruct() { 29 | Class structClass = Struct.createStructClass("StructTestClass", 1); 30 | Assert.assertEquals(Struct.createPOJO(structClass), Struct.createPOJO(structClass)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/fory-core/src/test/java/org/apache/fory/collection/Tuple3Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.collection; 21 | 22 | import static org.testng.Assert.*; 23 | 24 | import org.testng.annotations.Test; 25 | 26 | public class Tuple3Test { 27 | 28 | @Test 29 | public void testEquals() { 30 | assertEquals(Tuple3.of(1, "a", 1.1), Tuple3.of(1, "a", 1.1)); 31 | assertEquals(Tuple3.of(1, "a", 1.1).hashCode(), Tuple3.of(1, "a", 1.1).hashCode()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/cpp/hello_world/BUILD.standalone: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | # Example BUILD file for standalone projects using Fory as external dependency 19 | # Use this BUILD file when Fory is added via MODULE.bazel as external dependency 20 | 21 | load("@rules_cc//cc:defs.bzl", "cc_binary") 22 | 23 | cc_binary( 24 | name = "hello_world", 25 | srcs = ["main.cc"], 26 | deps = [ 27 | # When using Fory as external dependency via bzlmod 28 | "@fory//cpp/fory/serialization:fory_serialization", 29 | ], 30 | ) 31 | -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/annotation/Ignore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.annotation; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | /** Ignore properties just like transient. */ 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target({ElementType.FIELD, ElementType.METHOD}) 30 | public @interface Ignore {} 31 | -------------------------------------------------------------------------------- /java/fory-format/src/main/java/org/apache/fory/format/encoder/GeneratedArrayEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.format.encoder; 21 | 22 | import org.apache.fory.builder.Generated; 23 | import org.apache.fory.format.row.binary.BinaryArray; 24 | 25 | /** A list container row format codec for java bean. */ 26 | public interface GeneratedArrayEncoder extends Generated { 27 | 28 | BinaryArray toArray(Object obj); 29 | 30 | Object fromArray(BinaryArray array); 31 | } 32 | -------------------------------------------------------------------------------- /dart/packages/fory/lib/src/codegen/generate/builders.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import 'package:build/build.dart'; 21 | import 'package:fory/src/codegen/const/fory_const.dart'; 22 | import 'package:source_gen/source_gen.dart'; 23 | 24 | import 'obj_spec_generator.dart'; 25 | 26 | Builder foryObjSpecBuilder(BuilderOptions options) { 27 | return SharedPartBuilder( 28 | [ObjSpecGenerator()], // Provide a generator 29 | ForyConst.intermediateMark, // Name of the output file 30 | ); 31 | } -------------------------------------------------------------------------------- /java/fory-core/src/main/java/org/apache/fory/annotation/Expose.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.apache.fory.annotation; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | /** Only fields with this annotation are permitted for de/serialization. */ 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Target(ElementType.FIELD) 30 | public @interface Expose {} 31 | -------------------------------------------------------------------------------- /java/fory-test-core/src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | --------------------------------------------------------------------------------