protoc 2.6.1.1 → 2.6.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/protoc/Makefile.in +10 -13
- data/ext/protoc/extconf.rb +0 -1
- data/ext/protoc/protobuf/CHANGES.txt +593 -0
- data/ext/protoc/protobuf/CONTRIBUTORS.txt +93 -0
- data/ext/protoc/protobuf/INSTALL.txt +237 -0
- data/ext/protoc/protobuf/LICENSE +33 -0
- data/ext/protoc/protobuf/Makefile.am +267 -0
- data/ext/protoc/protobuf/README.md +167 -0
- data/ext/protoc/protobuf/autogen.sh +41 -0
- data/ext/protoc/protobuf/benchmarks/ProtoBench.java +203 -0
- data/ext/protoc/protobuf/benchmarks/google_message1.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_message2.dat +0 -0
- data/ext/protoc/protobuf/benchmarks/google_size.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/google_speed.proto +136 -0
- data/ext/protoc/protobuf/benchmarks/readme.txt +50 -0
- data/ext/protoc/protobuf/configure.ac +159 -0
- data/ext/protoc/protobuf/editors/README.txt +5 -0
- data/ext/protoc/protobuf/editors/proto.vim +105 -0
- data/ext/protoc/protobuf/editors/protobuf-mode.el +220 -0
- data/ext/protoc/protobuf/examples/AddPerson.java +95 -0
- data/ext/protoc/protobuf/examples/ListPeople.java +50 -0
- data/ext/protoc/protobuf/examples/Makefile +58 -0
- data/ext/protoc/protobuf/examples/README.txt +29 -0
- data/ext/protoc/protobuf/examples/add_person.cc +95 -0
- data/ext/protoc/protobuf/examples/add_person.py +58 -0
- data/ext/protoc/protobuf/examples/addressbook.proto +30 -0
- data/ext/protoc/protobuf/examples/list_people.cc +68 -0
- data/ext/protoc/protobuf/examples/list_people.py +38 -0
- data/ext/protoc/protobuf/generate_descriptor_proto.sh +33 -0
- data/ext/protoc/protobuf/java/README.txt +96 -0
- data/ext/protoc/protobuf/java/pom.xml +217 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java +466 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java +355 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java +253 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java +51 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +64 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ByteString.java +1022 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java +1311 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java +1297 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java +2238 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java +622 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Extension.java +96 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java +392 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java +185 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java +907 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessage.java +2213 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java +949 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Internal.java +391 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java +122 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyField.java +154 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyFieldLite.java +176 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java +367 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java +163 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java +362 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Message.java +244 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java +320 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +60 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java +143 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/MessageReflection.java +931 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Parser.java +261 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java +58 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ProtocolStringList.java +48 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java +696 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java +957 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcCallback.java +47 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java +71 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcController.java +118 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java +134 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Service.java +117 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/ServiceException.java +52 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java +241 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java +618 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java +1984 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java +99 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java +995 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java +205 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/Utf8.java +349 -0
- data/ext/protoc/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java +163 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/AbstractMessageTest.java +527 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +68 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ByteStringTest.java +759 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CheckUtf8Test.java +141 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java +769 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java +401 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java +80 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DescriptorsTest.java +735 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/DynamicMessageTest.java +326 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java +1515 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java +180 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java +421 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java +134 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyFieldTest.java +121 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java +319 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java +174 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java +143 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java +85 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java +148 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +396 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/MessageTest.java +353 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/NestedBuildersTest.java +185 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ParserTest.java +381 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java +190 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java +97 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/RopeByteStringTest.java +115 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/ServiceTest.java +320 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java +155 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java +420 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java +96 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TestUtil.java +4124 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/TextFormatTest.java +994 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java +653 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java +227 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/WireFormatTest.java +606 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto +61 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto +55 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/multiple_files_test.proto +77 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_builders_test.proto +53 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension.proto +46 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/nested_extension_lite.proto +48 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension.proto +49 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test.proto +38 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto +42 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto +157 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8.proto +50 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto +51 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_custom_options.proto +43 -0
- data/ext/protoc/protobuf/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto +60 -0
- data/ext/protoc/protobuf/m4/ac_system_extensions.m4 +37 -0
- data/ext/protoc/protobuf/m4/acx_check_suncc.m4 +75 -0
- data/ext/protoc/protobuf/m4/acx_pthread.m4 +397 -0
- data/ext/protoc/protobuf/m4/stl_hash.m4 +72 -0
- data/ext/protoc/protobuf/more_tests/Makefile +41 -0
- data/ext/protoc/protobuf/post_process_dist.sh +60 -0
- data/ext/protoc/protobuf/protobuf-lite.pc.in +13 -0
- data/ext/protoc/protobuf/protobuf.pc.in +14 -0
- data/ext/protoc/protobuf/python/README.txt +105 -0
- data/ext/protoc/protobuf/python/ez_setup.py +284 -0
- data/ext/protoc/protobuf/python/google/__init__.py +1 -0
- data/ext/protoc/protobuf/python/google/protobuf/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor.py +849 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_database.py +137 -0
- data/ext/protoc/protobuf/python/google/protobuf/descriptor_pool.py +643 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.cc +139 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/api_implementation_default_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/containers.py +269 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/cpp_message.py +663 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/decoder.py +831 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_database_test.py +63 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test.py +564 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test1.proto +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_pool_test2.proto +70 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/descriptor_test.py +669 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/encoder.py +788 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/enum_type_wrapper.py +89 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test1.proto +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/factory_test2.proto +92 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/generator_test.py +343 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_factory_test.py +131 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_listener.py +78 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_python_test.py +54 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/message_test.py +681 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/missing_enum_values.proto +50 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions.proto +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_extensions_dynamic.proto +49 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/more_messages.proto +51 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/python_message.py +1251 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/reflection_test.py +2934 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/service_reflection_test.py +136 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/symbol_database_test.py +120 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_bad_identifiers.proto +52 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/test_util.py +662 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_encoding_test.py +68 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/text_format_test.py +743 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/type_checkers.py +328 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/unknown_fields_test.py +231 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format.py +268 -0
- data/ext/protoc/protobuf/python/google/protobuf/internal/wire_format_test.py +253 -0
- data/ext/protoc/protobuf/python/google/protobuf/message.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/message_factory.py +155 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/README +6 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/__init__.py +0 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/cpp_message.py +61 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.cc +357 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor.h +96 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/descriptor_cpp2_test.py +58 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.cc +338 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/extension_dict.h +123 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.cc +2561 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message.h +305 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/message_factory_cpp2_test.py +56 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/proto2_api_test.proto +38 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python.proto +66 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/python_protobuf.h +57 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/reflection_cpp2_generated_test.py +94 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.cc +763 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_composite_container.h +172 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.cc +825 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/repeated_scalar_container.h +112 -0
- data/ext/protoc/protobuf/python/google/protobuf/pyext/scoped_pyobject_ptr.h +95 -0
- data/ext/protoc/protobuf/python/google/protobuf/reflection.py +205 -0
- data/ext/protoc/protobuf/python/google/protobuf/service.py +226 -0
- data/ext/protoc/protobuf/python/google/protobuf/service_reflection.py +284 -0
- data/ext/protoc/protobuf/python/google/protobuf/symbol_database.py +185 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_encoding.py +110 -0
- data/ext/protoc/protobuf/python/google/protobuf/text_format.py +873 -0
- data/ext/protoc/protobuf/python/mox.py +1401 -0
- data/ext/protoc/protobuf/python/setup.py +201 -0
- data/ext/protoc/protobuf/python/stubout.py +140 -0
- data/ext/protoc/protobuf/src/Makefile.am +418 -0
- data/ext/protoc/protobuf/src/google/protobuf/SEBS +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.cc +84 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/code_generator.h +145 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.cc +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface.h +378 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc +1654 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.cc +288 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.cc +431 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_enum_field.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.cc +210 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_extension.h +86 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.cc +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_field.h +185 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.cc +665 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_file.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.cc +125 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.cc +494 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_helpers.h +206 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +2645 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message.h +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.cc +375 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_options.h +58 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc +451 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_primitive_field.h +123 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.cc +334 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_service.h +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.cc +642 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_string_field.h +127 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto +132 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.cc +2074 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/cpp/cpp_unittest.h +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.cc +480 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer.h +317 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/importer_unittest.cc +617 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_context.h +95 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.cc +233 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc +67 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.cc +333 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum.h +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.cc +778 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_enum_field.h +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.cc +207 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_extension.h +109 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.cc +213 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_field.h +162 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.cc +534 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_file.h +115 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.cc +158 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.cc +77 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_generator_factory.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.cc +737 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_helpers.h +322 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.cc +826 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_lazy_message_field.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.cc +1666 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message.h +140 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.cc +1343 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_message_field.h +173 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.cc +266 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_name_resolver.h +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_plugin_unittest.cc +124 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.cc +877 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_primitive_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_service.h +135 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.cc +201 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_shared_code_generator.h +90 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.cc +1056 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/java/java_string_field.h +160 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/main.cc +61 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.cc +240 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/mock_code_generator.h +117 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.cc +1750 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser.h +522 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/parser_unittest.cc +2612 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.cc +163 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.h +72 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.cc +1148 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.pb.h +897 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/plugin.proto +147 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.cc +1262 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_generator.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/python/python_plugin_unittest.cc +118 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.cc +463 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/subprocess.h +108 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/test_plugin.cc +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_output_unittest.sh +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.cc +218 -0
- data/ext/protoc/protobuf/src/google/protobuf/compiler/zip_writer.h +93 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.cc +5420 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.h +1691 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.cc +9135 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.pb.h +6761 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor.proto +687 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.cc +543 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database.h +369 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_database_unittest.cc +748 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_pb2_test.py +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/descriptor_unittest.cc +5501 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.cc +764 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message.h +148 -0
- data/ext/protoc/protobuf/src/google/protobuf/dynamic_message_unittest.cc +230 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.cc +1663 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set.h +1234 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_heavy.cc +734 -0
- data/ext/protoc/protobuf/src/google/protobuf/extension_set_unittest.cc +1095 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_enum_reflection.h +91 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.cc +1683 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection.h +504 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_reflection_unittest.cc +795 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.cc +65 -0
- data/ext/protoc/protobuf/src/google/protobuf/generated_message_util.h +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.cc +914 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream.h +1220 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_inl.h +69 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/coded_stream_unittest.cc +1378 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.cc +326 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream.h +209 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/gzip_stream_unittest.sh +44 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/package_info.h +54 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.cc +198 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer.h +136 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/printer_unittest.cc +285 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.cc +113 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/strtod.h +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.cc +1127 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer.h +402 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/tokenizer_unittest.cc +999 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.cc +57 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream.h +248 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl.h +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +405 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h +354 -0
- data/ext/protoc/protobuf/src/google/protobuf/io/zero_copy_stream_unittest.cc +965 -0
- data/ext/protoc/protobuf/src/google/protobuf/lite_unittest.cc +350 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.cc +358 -0
- data/ext/protoc/protobuf/src/google/protobuf/message.h +866 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.cc +335 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_lite.h +247 -0
- data/ext/protoc/protobuf/src/google/protobuf/message_unittest.cc +427 -0
- data/ext/protoc/protobuf/src/google/protobuf/package_info.h +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.cc +269 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops.h +81 -0
- data/ext/protoc/protobuf/src/google/protobuf/reflection_ops_unittest.cc +475 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.cc +87 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field.h +1603 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_reflection_unittest.cc +195 -0
- data/ext/protoc/protobuf/src/google/protobuf/repeated_field_unittest.cc +1442 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.cc +46 -0
- data/ext/protoc/protobuf/src/google/protobuf/service.h +291 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops.h +227 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +325 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_gcc.h +151 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_arm_qnx.h +146 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h +122 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_generic_gcc.h +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h +225 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_mips_gcc.h +313 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_pnacl.h +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h +188 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_tsan.h +219 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc +137 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h +293 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc +112 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h +150 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.cc +395 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common.h +1226 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/common_unittest.cc +357 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/hash.h +232 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/map_util.h +771 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.cc +99 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once.h +166 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/once_unittest.cc +253 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/platform_macros.h +103 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/shared_ptr.h +470 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stl_util.h +121 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.cc +175 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf.h +76 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/stringprintf_unittest.cc +152 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid.cc +536 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/structurally_valid_unittest.cc +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.cc +1279 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil.h +562 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/strutil_unittest.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.cc +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/substitute.h +170 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util.h +138 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/template_util_unittest.cc +130 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/stubs/type_traits_unittest.cc +628 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.cc +3345 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util.h +215 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.cc +1585 -0
- data/ext/protoc/protobuf/src/google/protobuf/test_util_lite.h +101 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/bad_utf8_string +1 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_message_oneof_implemented +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/golden_packed_fields_message +0 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt +129 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt +134 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.cc +194 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/file.h +97 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.cc +255 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/googletest.h +102 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgunzip.cc +73 -0
- data/ext/protoc/protobuf/src/google/protobuf/testing/zcgzip.cc +79 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.cc +1746 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format.h +473 -0
- data/ext/protoc/protobuf/src/google/protobuf/text_format_unittest.cc +1479 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest.proto +861 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_custom_options.proto +393 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_embed_optimize_for.proto +50 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_empty.proto +37 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_enormous_descriptor.proto +1046 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import.proto +64 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_lite.proto +51 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public.proto +40 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_import_public_lite.proto +42 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite.proto +384 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_lite_imports_nonlite.proto +43 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_mset.proto +83 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_no_generic_services.proto +53 -0
- data/ext/protoc/protobuf/src/google/protobuf/unittest_optimize_for.proto +66 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.cc +265 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set.h +318 -0
- data/ext/protoc/protobuf/src/google/protobuf/unknown_field_set_unittest.cc +599 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.cc +1101 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format.h +336 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.cc +471 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite.h +661 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_lite_inl.h +860 -0
- data/ext/protoc/protobuf/src/google/protobuf/wire_format_unittest.cc +1120 -0
- data/ext/protoc/protobuf/src/solaris/libstdc++.la +51 -0
- data/ext/protoc/protobuf/vsprojects/config.h +29 -0
- data/ext/protoc/protobuf/vsprojects/convert2008to2005.sh +20 -0
- data/ext/protoc/protobuf/vsprojects/extract_includes.bat +50 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf-lite.vcproj +302 -0
- data/ext/protoc/protobuf/vsprojects/libprotobuf.vcproj +470 -0
- data/ext/protoc/protobuf/vsprojects/libprotoc.vcproj +466 -0
- data/ext/protoc/protobuf/vsprojects/lite-test.vcproj +305 -0
- data/ext/protoc/protobuf/vsprojects/protobuf.sln +92 -0
- data/ext/protoc/protobuf/vsprojects/protoc.vcproj +192 -0
- data/ext/protoc/protobuf/vsprojects/readme.txt +114 -0
- data/ext/protoc/protobuf/vsprojects/test_plugin.vcproj +209 -0
- data/ext/protoc/protobuf/vsprojects/tests.vcproj +681 -0
- data/lib/protoc/version.rb +1 -1
- metadata +480 -3
@@ -0,0 +1,261 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package com.google.protobuf;
|
32
|
+
|
33
|
+
import java.io.InputStream;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Abstract interface for parsing Protocol Messages.
|
37
|
+
*
|
38
|
+
* The implementation should be stateless and thread-safe.
|
39
|
+
*
|
40
|
+
* @author liujisi@google.com (Pherl Liu)
|
41
|
+
*/
|
42
|
+
public interface Parser<MessageType> {
|
43
|
+
/**
|
44
|
+
* Parses a message of {@code MessageType} from the input.
|
45
|
+
*
|
46
|
+
* <p>Note: The caller should call
|
47
|
+
* {@link CodedInputStream#checkLastTagWas(int)} after calling this to
|
48
|
+
* verify that the last tag seen was the appropriate end-group tag,
|
49
|
+
* or zero for EOF.
|
50
|
+
*/
|
51
|
+
public MessageType parseFrom(CodedInputStream input)
|
52
|
+
throws InvalidProtocolBufferException;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Like {@link #parseFrom(CodedInputStream)}, but also parses extensions.
|
56
|
+
* The extensions that you want to be able to parse must be registered in
|
57
|
+
* {@code extensionRegistry}. Extensions not in the registry will be treated
|
58
|
+
* as unknown fields.
|
59
|
+
*/
|
60
|
+
public MessageType parseFrom(CodedInputStream input,
|
61
|
+
ExtensionRegistryLite extensionRegistry)
|
62
|
+
throws InvalidProtocolBufferException;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Like {@link #parseFrom(CodedInputStream)}, but does not throw an
|
66
|
+
* exception if the message is missing required fields. Instead, a partial
|
67
|
+
* message is returned.
|
68
|
+
*/
|
69
|
+
public MessageType parsePartialFrom(CodedInputStream input)
|
70
|
+
throws InvalidProtocolBufferException;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Like {@link #parseFrom(CodedInputStream input, ExtensionRegistryLite)},
|
74
|
+
* but does not throw an exception if the message is missing required fields.
|
75
|
+
* Instead, a partial message is returned.
|
76
|
+
*/
|
77
|
+
public MessageType parsePartialFrom(CodedInputStream input,
|
78
|
+
ExtensionRegistryLite extensionRegistry)
|
79
|
+
throws InvalidProtocolBufferException;
|
80
|
+
|
81
|
+
// ---------------------------------------------------------------
|
82
|
+
// Convenience methods.
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Parses {@code data} as a message of {@code MessageType}.
|
86
|
+
* This is just a small wrapper around {@link #parseFrom(CodedInputStream)}.
|
87
|
+
*/
|
88
|
+
public MessageType parseFrom(ByteString data)
|
89
|
+
throws InvalidProtocolBufferException;
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Parses {@code data} as a message of {@code MessageType}.
|
93
|
+
* This is just a small wrapper around
|
94
|
+
* {@link #parseFrom(CodedInputStream, ExtensionRegistryLite)}.
|
95
|
+
*/
|
96
|
+
public MessageType parseFrom(ByteString data,
|
97
|
+
ExtensionRegistryLite extensionRegistry)
|
98
|
+
throws InvalidProtocolBufferException;
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Like {@link #parseFrom(ByteString)}, but does not throw an
|
102
|
+
* exception if the message is missing required fields. Instead, a partial
|
103
|
+
* message is returned.
|
104
|
+
*/
|
105
|
+
public MessageType parsePartialFrom(ByteString data)
|
106
|
+
throws InvalidProtocolBufferException;
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Like {@link #parseFrom(ByteString, ExtensionRegistryLite)},
|
110
|
+
* but does not throw an exception if the message is missing required fields.
|
111
|
+
* Instead, a partial message is returned.
|
112
|
+
*/
|
113
|
+
public MessageType parsePartialFrom(ByteString data,
|
114
|
+
ExtensionRegistryLite extensionRegistry)
|
115
|
+
throws InvalidProtocolBufferException;
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Parses {@code data} as a message of {@code MessageType}.
|
119
|
+
* This is just a small wrapper around {@link #parseFrom(CodedInputStream)}.
|
120
|
+
*/
|
121
|
+
public MessageType parseFrom(byte[] data, int off, int len)
|
122
|
+
throws InvalidProtocolBufferException;
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Parses {@code data} as a message of {@code MessageType}.
|
126
|
+
* This is just a small wrapper around
|
127
|
+
* {@link #parseFrom(CodedInputStream, ExtensionRegistryLite)}.
|
128
|
+
*/
|
129
|
+
public MessageType parseFrom(byte[] data, int off, int len,
|
130
|
+
ExtensionRegistryLite extensionRegistry)
|
131
|
+
throws InvalidProtocolBufferException;
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Parses {@code data} as a message of {@code MessageType}.
|
135
|
+
* This is just a small wrapper around {@link #parseFrom(CodedInputStream)}.
|
136
|
+
*/
|
137
|
+
public MessageType parseFrom(byte[] data)
|
138
|
+
throws InvalidProtocolBufferException;
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Parses {@code data} as a message of {@code MessageType}.
|
142
|
+
* This is just a small wrapper around
|
143
|
+
* {@link #parseFrom(CodedInputStream, ExtensionRegistryLite)}.
|
144
|
+
*/
|
145
|
+
public MessageType parseFrom(byte[] data,
|
146
|
+
ExtensionRegistryLite extensionRegistry)
|
147
|
+
throws InvalidProtocolBufferException;
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Like {@link #parseFrom(byte[], int, int)}, but does not throw an
|
151
|
+
* exception if the message is missing required fields. Instead, a partial
|
152
|
+
* message is returned.
|
153
|
+
*/
|
154
|
+
public MessageType parsePartialFrom(byte[] data, int off, int len)
|
155
|
+
throws InvalidProtocolBufferException;
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Like {@link #parseFrom(ByteString, ExtensionRegistryLite)},
|
159
|
+
* but does not throw an exception if the message is missing required fields.
|
160
|
+
* Instead, a partial message is returned.
|
161
|
+
*/
|
162
|
+
public MessageType parsePartialFrom(byte[] data, int off, int len,
|
163
|
+
ExtensionRegistryLite extensionRegistry)
|
164
|
+
throws InvalidProtocolBufferException;
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Like {@link #parseFrom(byte[])}, but does not throw an
|
168
|
+
* exception if the message is missing required fields. Instead, a partial
|
169
|
+
* message is returned.
|
170
|
+
*/
|
171
|
+
public MessageType parsePartialFrom(byte[] data)
|
172
|
+
throws InvalidProtocolBufferException;
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Like {@link #parseFrom(byte[], ExtensionRegistryLite)},
|
176
|
+
* but does not throw an exception if the message is missing required fields.
|
177
|
+
* Instead, a partial message is returned.
|
178
|
+
*/
|
179
|
+
public MessageType parsePartialFrom(byte[] data,
|
180
|
+
ExtensionRegistryLite extensionRegistry)
|
181
|
+
throws InvalidProtocolBufferException;
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Parse a message of {@code MessageType} from {@code input}.
|
185
|
+
* This is just a small wrapper around {@link #parseFrom(CodedInputStream)}.
|
186
|
+
* Note that this method always reads the <i>entire</i> input (unless it
|
187
|
+
* throws an exception). If you want it to stop earlier, you will need to
|
188
|
+
* wrap your input in some wrapper stream that limits reading. Or, use
|
189
|
+
* {@link MessageLite#writeDelimitedTo(java.io.OutputStream)} to write your
|
190
|
+
* message and {@link #parseDelimitedFrom(InputStream)} to read it.
|
191
|
+
* <p>
|
192
|
+
* Despite usually reading the entire input, this does not close the stream.
|
193
|
+
*/
|
194
|
+
public MessageType parseFrom(InputStream input)
|
195
|
+
throws InvalidProtocolBufferException;
|
196
|
+
|
197
|
+
/**
|
198
|
+
* Parses a message of {@code MessageType} from {@code input}.
|
199
|
+
* This is just a small wrapper around
|
200
|
+
* {@link #parseFrom(CodedInputStream, ExtensionRegistryLite)}.
|
201
|
+
*/
|
202
|
+
public MessageType parseFrom(InputStream input,
|
203
|
+
ExtensionRegistryLite extensionRegistry)
|
204
|
+
throws InvalidProtocolBufferException;
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Like {@link #parseFrom(InputStream)}, but does not throw an
|
208
|
+
* exception if the message is missing required fields. Instead, a partial
|
209
|
+
* message is returned.
|
210
|
+
*/
|
211
|
+
public MessageType parsePartialFrom(InputStream input)
|
212
|
+
throws InvalidProtocolBufferException;
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Like {@link #parseFrom(InputStream, ExtensionRegistryLite)},
|
216
|
+
* but does not throw an exception if the message is missing required fields.
|
217
|
+
* Instead, a partial message is returned.
|
218
|
+
*/
|
219
|
+
public MessageType parsePartialFrom(InputStream input,
|
220
|
+
ExtensionRegistryLite extensionRegistry)
|
221
|
+
throws InvalidProtocolBufferException;
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Like {@link #parseFrom(InputStream)}, but does not read util EOF.
|
225
|
+
* Instead, the size of message (encoded as a varint) is read first,
|
226
|
+
* then the message data. Use
|
227
|
+
* {@link MessageLite#writeDelimitedTo(java.io.OutputStream)} to write
|
228
|
+
* messages in this format.
|
229
|
+
*
|
230
|
+
* @return True if successful, or false if the stream is at EOF when the
|
231
|
+
* method starts. Any other error (including reaching EOF during
|
232
|
+
* parsing) will cause an exception to be thrown.
|
233
|
+
*/
|
234
|
+
public MessageType parseDelimitedFrom(InputStream input)
|
235
|
+
throws InvalidProtocolBufferException;
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Like {@link #parseDelimitedFrom(InputStream)} but supporting extensions.
|
239
|
+
*/
|
240
|
+
public MessageType parseDelimitedFrom(InputStream input,
|
241
|
+
ExtensionRegistryLite extensionRegistry)
|
242
|
+
throws InvalidProtocolBufferException;
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Like {@link #parseDelimitedFrom(InputStream)}, but does not throw an
|
246
|
+
* exception if the message is missing required fields. Instead, a partial
|
247
|
+
* message is returned.
|
248
|
+
*/
|
249
|
+
public MessageType parsePartialDelimitedFrom(InputStream input)
|
250
|
+
throws InvalidProtocolBufferException;
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Like {@link #parseDelimitedFrom(InputStream, ExtensionRegistryLite)},
|
254
|
+
* but does not throw an exception if the message is missing required fields.
|
255
|
+
* Instead, a partial message is returned.
|
256
|
+
*/
|
257
|
+
public MessageType parsePartialDelimitedFrom(
|
258
|
+
InputStream input,
|
259
|
+
ExtensionRegistryLite extensionRegistry)
|
260
|
+
throws InvalidProtocolBufferException;
|
261
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package com.google.protobuf;
|
32
|
+
|
33
|
+
import com.google.protobuf.Descriptors.EnumDescriptor;
|
34
|
+
import com.google.protobuf.Descriptors.EnumValueDescriptor;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Interface of useful methods added to all enums generated by the protocol
|
38
|
+
* compiler.
|
39
|
+
*/
|
40
|
+
public interface ProtocolMessageEnum extends Internal.EnumLite {
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Return the value's numeric value as defined in the .proto file.
|
44
|
+
*/
|
45
|
+
int getNumber();
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Return the value's descriptor, which contains information such as
|
49
|
+
* value name, number, and type.
|
50
|
+
*/
|
51
|
+
EnumValueDescriptor getValueDescriptor();
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Return the enum type's descriptor, which contains information
|
55
|
+
* about each defined value, etc.
|
56
|
+
*/
|
57
|
+
EnumDescriptor getDescriptorForType();
|
58
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package com.google.protobuf;
|
32
|
+
|
33
|
+
import java.util.List;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* An interface extending {@code List<String>} used for repeated string fields
|
37
|
+
* to provide optional access to the data as a list of ByteStrings. The
|
38
|
+
* underlying implementation stores values as either ByteStrings or Strings
|
39
|
+
* (see {@link LazyStringArrayList}) depending on how the value was initialized
|
40
|
+
* or last read, and it is often more efficient to deal with lists of
|
41
|
+
* ByteStrings when handling protos that have been deserialized from bytes.
|
42
|
+
*/
|
43
|
+
public interface ProtocolStringList extends List<String> {
|
44
|
+
|
45
|
+
/** Returns a view of the data as a list of ByteStrings. */
|
46
|
+
List<ByteString> asByteStringList();
|
47
|
+
|
48
|
+
}
|
@@ -0,0 +1,696 @@
|
|
1
|
+
// Protocol Buffers - Google's data interchange format
|
2
|
+
// Copyright 2008 Google Inc. All rights reserved.
|
3
|
+
// https://developers.google.com/protocol-buffers/
|
4
|
+
//
|
5
|
+
// Redistribution and use in source and binary forms, with or without
|
6
|
+
// modification, are permitted provided that the following conditions are
|
7
|
+
// met:
|
8
|
+
//
|
9
|
+
// * Redistributions of source code must retain the above copyright
|
10
|
+
// notice, this list of conditions and the following disclaimer.
|
11
|
+
// * Redistributions in binary form must reproduce the above
|
12
|
+
// copyright notice, this list of conditions and the following disclaimer
|
13
|
+
// in the documentation and/or other materials provided with the
|
14
|
+
// distribution.
|
15
|
+
// * Neither the name of Google Inc. nor the names of its
|
16
|
+
// contributors may be used to endorse or promote products derived from
|
17
|
+
// this software without specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
package com.google.protobuf;
|
32
|
+
|
33
|
+
import java.util.AbstractList;
|
34
|
+
import java.util.ArrayList;
|
35
|
+
import java.util.Collection;
|
36
|
+
import java.util.Collections;
|
37
|
+
import java.util.List;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* {@code RepeatedFieldBuilder} implements a structure that a protocol
|
41
|
+
* message uses to hold a repeated field of other protocol messages. It supports
|
42
|
+
* the classical use case of adding immutable {@link Message}'s to the
|
43
|
+
* repeated field and is highly optimized around this (no extra memory
|
44
|
+
* allocations and sharing of immutable arrays).
|
45
|
+
* <br>
|
46
|
+
* It also supports the additional use case of adding a {@link Message.Builder}
|
47
|
+
* to the repeated field and deferring conversion of that {@code Builder}
|
48
|
+
* to an immutable {@code Message}. In this way, it's possible to maintain
|
49
|
+
* a tree of {@code Builder}'s that acts as a fully read/write data
|
50
|
+
* structure.
|
51
|
+
* <br>
|
52
|
+
* Logically, one can think of a tree of builders as converting the entire tree
|
53
|
+
* to messages when build is called on the root or when any method is called
|
54
|
+
* that desires a Message instead of a Builder. In terms of the implementation,
|
55
|
+
* the {@code SingleFieldBuilder} and {@code RepeatedFieldBuilder}
|
56
|
+
* classes cache messages that were created so that messages only need to be
|
57
|
+
* created when some change occured in its builder or a builder for one of its
|
58
|
+
* descendants.
|
59
|
+
*
|
60
|
+
* @param <MType> the type of message for the field
|
61
|
+
* @param <BType> the type of builder for the field
|
62
|
+
* @param <IType> the common interface for the message and the builder
|
63
|
+
*
|
64
|
+
* @author jonp@google.com (Jon Perlow)
|
65
|
+
*/
|
66
|
+
public class RepeatedFieldBuilder
|
67
|
+
<MType extends GeneratedMessage,
|
68
|
+
BType extends GeneratedMessage.Builder,
|
69
|
+
IType extends MessageOrBuilder>
|
70
|
+
implements GeneratedMessage.BuilderParent {
|
71
|
+
|
72
|
+
// Parent to send changes to.
|
73
|
+
private GeneratedMessage.BuilderParent parent;
|
74
|
+
|
75
|
+
// List of messages. Never null. It may be immutable, in which case
|
76
|
+
// isMessagesListImmutable will be true. See note below.
|
77
|
+
private List<MType> messages;
|
78
|
+
|
79
|
+
// Whether messages is an mutable array that can be modified.
|
80
|
+
private boolean isMessagesListMutable;
|
81
|
+
|
82
|
+
// List of builders. May be null, in which case, no nested builders were
|
83
|
+
// created. If not null, entries represent the builder for that index.
|
84
|
+
private List<SingleFieldBuilder<MType, BType, IType>> builders;
|
85
|
+
|
86
|
+
// Here are the invariants for messages and builders:
|
87
|
+
// 1. messages is never null and its count corresponds to the number of items
|
88
|
+
// in the repeated field.
|
89
|
+
// 2. If builders is non-null, messages and builders MUST always
|
90
|
+
// contain the same number of items.
|
91
|
+
// 3. Entries in either array can be null, but for any index, there MUST be
|
92
|
+
// either a Message in messages or a builder in builders.
|
93
|
+
// 4. If the builder at an index is non-null, the builder is
|
94
|
+
// authoritative. This is the case where a Builder was set on the index.
|
95
|
+
// Any message in the messages array MUST be ignored.
|
96
|
+
// t. If the builder at an index is null, the message in the messages
|
97
|
+
// list is authoritative. This is the case where a Message (not a Builder)
|
98
|
+
// was set directly for an index.
|
99
|
+
|
100
|
+
// Indicates that we've built a message and so we are now obligated
|
101
|
+
// to dispatch dirty invalidations. See GeneratedMessage.BuilderListener.
|
102
|
+
private boolean isClean;
|
103
|
+
|
104
|
+
// A view of this builder that exposes a List interface of messages. This is
|
105
|
+
// initialized on demand. This is fully backed by this object and all changes
|
106
|
+
// are reflected in it. Access to any item converts it to a message if it
|
107
|
+
// was a builder.
|
108
|
+
private MessageExternalList<MType, BType, IType> externalMessageList;
|
109
|
+
|
110
|
+
// A view of this builder that exposes a List interface of builders. This is
|
111
|
+
// initialized on demand. This is fully backed by this object and all changes
|
112
|
+
// are reflected in it. Access to any item converts it to a builder if it
|
113
|
+
// was a message.
|
114
|
+
private BuilderExternalList<MType, BType, IType> externalBuilderList;
|
115
|
+
|
116
|
+
// A view of this builder that exposes a List interface of the interface
|
117
|
+
// implemented by messages and builders. This is initialized on demand. This
|
118
|
+
// is fully backed by this object and all changes are reflected in it.
|
119
|
+
// Access to any item returns either a builder or message depending on
|
120
|
+
// what is most efficient.
|
121
|
+
private MessageOrBuilderExternalList<MType, BType, IType>
|
122
|
+
externalMessageOrBuilderList;
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Constructs a new builder with an empty list of messages.
|
126
|
+
*
|
127
|
+
* @param messages the current list of messages
|
128
|
+
* @param isMessagesListMutable Whether the messages list is mutable
|
129
|
+
* @param parent a listener to notify of changes
|
130
|
+
* @param isClean whether the builder is initially marked clean
|
131
|
+
*/
|
132
|
+
public RepeatedFieldBuilder(
|
133
|
+
List<MType> messages,
|
134
|
+
boolean isMessagesListMutable,
|
135
|
+
GeneratedMessage.BuilderParent parent,
|
136
|
+
boolean isClean) {
|
137
|
+
this.messages = messages;
|
138
|
+
this.isMessagesListMutable = isMessagesListMutable;
|
139
|
+
this.parent = parent;
|
140
|
+
this.isClean = isClean;
|
141
|
+
}
|
142
|
+
|
143
|
+
public void dispose() {
|
144
|
+
// Null out parent so we stop sending it invalidations.
|
145
|
+
parent = null;
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Ensures that the list of messages is mutable so it can be updated. If it's
|
150
|
+
* immutable, a copy is made.
|
151
|
+
*/
|
152
|
+
private void ensureMutableMessageList() {
|
153
|
+
if (!isMessagesListMutable) {
|
154
|
+
messages = new ArrayList<MType>(messages);
|
155
|
+
isMessagesListMutable = true;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Ensures that the list of builders is not null. If it's null, the list is
|
161
|
+
* created and initialized to be the same size as the messages list with
|
162
|
+
* null entries.
|
163
|
+
*/
|
164
|
+
private void ensureBuilders() {
|
165
|
+
if (this.builders == null) {
|
166
|
+
this.builders =
|
167
|
+
new ArrayList<SingleFieldBuilder<MType, BType, IType>>(
|
168
|
+
messages.size());
|
169
|
+
for (int i = 0; i < messages.size(); i++) {
|
170
|
+
builders.add(null);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Gets the count of items in the list.
|
177
|
+
*
|
178
|
+
* @return the count of items in the list.
|
179
|
+
*/
|
180
|
+
public int getCount() {
|
181
|
+
return messages.size();
|
182
|
+
}
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Gets whether the list is empty.
|
186
|
+
*
|
187
|
+
* @return whether the list is empty
|
188
|
+
*/
|
189
|
+
public boolean isEmpty() {
|
190
|
+
return messages.isEmpty();
|
191
|
+
}
|
192
|
+
|
193
|
+
/**
|
194
|
+
* Get the message at the specified index. If the message is currently stored
|
195
|
+
* as a {@code Builder}, it is converted to a {@code Message} by
|
196
|
+
* calling {@link Message.Builder#buildPartial} on it.
|
197
|
+
*
|
198
|
+
* @param index the index of the message to get
|
199
|
+
* @return the message for the specified index
|
200
|
+
*/
|
201
|
+
public MType getMessage(int index) {
|
202
|
+
return getMessage(index, false);
|
203
|
+
}
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Get the message at the specified index. If the message is currently stored
|
207
|
+
* as a {@code Builder}, it is converted to a {@code Message} by
|
208
|
+
* calling {@link Message.Builder#buildPartial} on it.
|
209
|
+
*
|
210
|
+
* @param index the index of the message to get
|
211
|
+
* @param forBuild this is being called for build so we want to make sure
|
212
|
+
* we SingleFieldBuilder.build to send dirty invalidations
|
213
|
+
* @return the message for the specified index
|
214
|
+
*/
|
215
|
+
private MType getMessage(int index, boolean forBuild) {
|
216
|
+
if (this.builders == null) {
|
217
|
+
// We don't have any builders -- return the current Message.
|
218
|
+
// This is the case where no builder was created, so we MUST have a
|
219
|
+
// Message.
|
220
|
+
return messages.get(index);
|
221
|
+
}
|
222
|
+
|
223
|
+
SingleFieldBuilder<MType, BType, IType> builder = builders.get(index);
|
224
|
+
if (builder == null) {
|
225
|
+
// We don't have a builder -- return the current message.
|
226
|
+
// This is the case where no builder was created for the entry at index,
|
227
|
+
// so we MUST have a message.
|
228
|
+
return messages.get(index);
|
229
|
+
|
230
|
+
} else {
|
231
|
+
return forBuild ? builder.build() : builder.getMessage();
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Gets a builder for the specified index. If no builder has been created for
|
237
|
+
* that index, a builder is created on demand by calling
|
238
|
+
* {@link Message#toBuilder}.
|
239
|
+
*
|
240
|
+
* @param index the index of the message to get
|
241
|
+
* @return The builder for that index
|
242
|
+
*/
|
243
|
+
public BType getBuilder(int index) {
|
244
|
+
ensureBuilders();
|
245
|
+
SingleFieldBuilder<MType, BType, IType> builder = builders.get(index);
|
246
|
+
if (builder == null) {
|
247
|
+
MType message = messages.get(index);
|
248
|
+
builder = new SingleFieldBuilder<MType, BType, IType>(
|
249
|
+
message, this, isClean);
|
250
|
+
builders.set(index, builder);
|
251
|
+
}
|
252
|
+
return builder.getBuilder();
|
253
|
+
}
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Gets the base class interface for the specified index. This may either be
|
257
|
+
* a builder or a message. It will return whatever is more efficient.
|
258
|
+
*
|
259
|
+
* @param index the index of the message to get
|
260
|
+
* @return the message or builder for the index as the base class interface
|
261
|
+
*/
|
262
|
+
@SuppressWarnings("unchecked")
|
263
|
+
public IType getMessageOrBuilder(int index) {
|
264
|
+
if (this.builders == null) {
|
265
|
+
// We don't have any builders -- return the current Message.
|
266
|
+
// This is the case where no builder was created, so we MUST have a
|
267
|
+
// Message.
|
268
|
+
return (IType) messages.get(index);
|
269
|
+
}
|
270
|
+
|
271
|
+
SingleFieldBuilder<MType, BType, IType> builder = builders.get(index);
|
272
|
+
if (builder == null) {
|
273
|
+
// We don't have a builder -- return the current message.
|
274
|
+
// This is the case where no builder was created for the entry at index,
|
275
|
+
// so we MUST have a message.
|
276
|
+
return (IType) messages.get(index);
|
277
|
+
|
278
|
+
} else {
|
279
|
+
return builder.getMessageOrBuilder();
|
280
|
+
}
|
281
|
+
}
|
282
|
+
|
283
|
+
/**
|
284
|
+
* Sets a message at the specified index replacing the existing item at
|
285
|
+
* that index.
|
286
|
+
*
|
287
|
+
* @param index the index to set.
|
288
|
+
* @param message the message to set
|
289
|
+
* @return the builder
|
290
|
+
*/
|
291
|
+
public RepeatedFieldBuilder<MType, BType, IType> setMessage(
|
292
|
+
int index, MType message) {
|
293
|
+
if (message == null) {
|
294
|
+
throw new NullPointerException();
|
295
|
+
}
|
296
|
+
ensureMutableMessageList();
|
297
|
+
messages.set(index, message);
|
298
|
+
if (builders != null) {
|
299
|
+
SingleFieldBuilder<MType, BType, IType> entry =
|
300
|
+
builders.set(index, null);
|
301
|
+
if (entry != null) {
|
302
|
+
entry.dispose();
|
303
|
+
}
|
304
|
+
}
|
305
|
+
onChanged();
|
306
|
+
incrementModCounts();
|
307
|
+
return this;
|
308
|
+
}
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Appends the specified element to the end of this list.
|
312
|
+
*
|
313
|
+
* @param message the message to add
|
314
|
+
* @return the builder
|
315
|
+
*/
|
316
|
+
public RepeatedFieldBuilder<MType, BType, IType> addMessage(
|
317
|
+
MType message) {
|
318
|
+
if (message == null) {
|
319
|
+
throw new NullPointerException();
|
320
|
+
}
|
321
|
+
ensureMutableMessageList();
|
322
|
+
messages.add(message);
|
323
|
+
if (builders != null) {
|
324
|
+
builders.add(null);
|
325
|
+
}
|
326
|
+
onChanged();
|
327
|
+
incrementModCounts();
|
328
|
+
return this;
|
329
|
+
}
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Inserts the specified message at the specified position in this list.
|
333
|
+
* Shifts the element currently at that position (if any) and any subsequent
|
334
|
+
* elements to the right (adds one to their indices).
|
335
|
+
*
|
336
|
+
* @param index the index at which to insert the message
|
337
|
+
* @param message the message to add
|
338
|
+
* @return the builder
|
339
|
+
*/
|
340
|
+
public RepeatedFieldBuilder<MType, BType, IType> addMessage(
|
341
|
+
int index, MType message) {
|
342
|
+
if (message == null) {
|
343
|
+
throw new NullPointerException();
|
344
|
+
}
|
345
|
+
ensureMutableMessageList();
|
346
|
+
messages.add(index, message);
|
347
|
+
if (builders != null) {
|
348
|
+
builders.add(index, null);
|
349
|
+
}
|
350
|
+
onChanged();
|
351
|
+
incrementModCounts();
|
352
|
+
return this;
|
353
|
+
}
|
354
|
+
|
355
|
+
/**
|
356
|
+
* Appends all of the messages in the specified collection to the end of
|
357
|
+
* this list, in the order that they are returned by the specified
|
358
|
+
* collection's iterator.
|
359
|
+
*
|
360
|
+
* @param values the messages to add
|
361
|
+
* @return the builder
|
362
|
+
*/
|
363
|
+
public RepeatedFieldBuilder<MType, BType, IType> addAllMessages(
|
364
|
+
Iterable<? extends MType> values) {
|
365
|
+
for (final MType value : values) {
|
366
|
+
if (value == null) {
|
367
|
+
throw new NullPointerException();
|
368
|
+
}
|
369
|
+
}
|
370
|
+
if (values instanceof Collection) {
|
371
|
+
@SuppressWarnings("unchecked") final
|
372
|
+
Collection<MType> collection = (Collection<MType>) values;
|
373
|
+
if (collection.size() == 0) {
|
374
|
+
return this;
|
375
|
+
}
|
376
|
+
ensureMutableMessageList();
|
377
|
+
for (MType value : values) {
|
378
|
+
addMessage(value);
|
379
|
+
}
|
380
|
+
} else {
|
381
|
+
ensureMutableMessageList();
|
382
|
+
for (MType value : values) {
|
383
|
+
addMessage(value);
|
384
|
+
}
|
385
|
+
}
|
386
|
+
onChanged();
|
387
|
+
incrementModCounts();
|
388
|
+
return this;
|
389
|
+
}
|
390
|
+
|
391
|
+
/**
|
392
|
+
* Appends a new builder to the end of this list and returns the builder.
|
393
|
+
*
|
394
|
+
* @param message the message to add which is the basis of the builder
|
395
|
+
* @return the new builder
|
396
|
+
*/
|
397
|
+
public BType addBuilder(MType message) {
|
398
|
+
ensureMutableMessageList();
|
399
|
+
ensureBuilders();
|
400
|
+
SingleFieldBuilder<MType, BType, IType> builder =
|
401
|
+
new SingleFieldBuilder<MType, BType, IType>(
|
402
|
+
message, this, isClean);
|
403
|
+
messages.add(null);
|
404
|
+
builders.add(builder);
|
405
|
+
onChanged();
|
406
|
+
incrementModCounts();
|
407
|
+
return builder.getBuilder();
|
408
|
+
}
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Inserts a new builder at the specified position in this list.
|
412
|
+
* Shifts the element currently at that position (if any) and any subsequent
|
413
|
+
* elements to the right (adds one to their indices).
|
414
|
+
*
|
415
|
+
* @param index the index at which to insert the builder
|
416
|
+
* @param message the message to add which is the basis of the builder
|
417
|
+
* @return the builder
|
418
|
+
*/
|
419
|
+
public BType addBuilder(int index, MType message) {
|
420
|
+
ensureMutableMessageList();
|
421
|
+
ensureBuilders();
|
422
|
+
SingleFieldBuilder<MType, BType, IType> builder =
|
423
|
+
new SingleFieldBuilder<MType, BType, IType>(
|
424
|
+
message, this, isClean);
|
425
|
+
messages.add(index, null);
|
426
|
+
builders.add(index, builder);
|
427
|
+
onChanged();
|
428
|
+
incrementModCounts();
|
429
|
+
return builder.getBuilder();
|
430
|
+
}
|
431
|
+
|
432
|
+
/**
|
433
|
+
* Removes the element at the specified position in this list. Shifts any
|
434
|
+
* subsequent elements to the left (subtracts one from their indices).
|
435
|
+
* Returns the element that was removed from the list.
|
436
|
+
*
|
437
|
+
* @param index the index at which to remove the message
|
438
|
+
*/
|
439
|
+
public void remove(int index) {
|
440
|
+
ensureMutableMessageList();
|
441
|
+
messages.remove(index);
|
442
|
+
if (builders != null) {
|
443
|
+
SingleFieldBuilder<MType, BType, IType> entry =
|
444
|
+
builders.remove(index);
|
445
|
+
if (entry != null) {
|
446
|
+
entry.dispose();
|
447
|
+
}
|
448
|
+
}
|
449
|
+
onChanged();
|
450
|
+
incrementModCounts();
|
451
|
+
}
|
452
|
+
|
453
|
+
/**
|
454
|
+
* Removes all of the elements from this list.
|
455
|
+
* The list will be empty after this call returns.
|
456
|
+
*/
|
457
|
+
public void clear() {
|
458
|
+
messages = Collections.emptyList();
|
459
|
+
isMessagesListMutable = false;
|
460
|
+
if (builders != null) {
|
461
|
+
for (SingleFieldBuilder<MType, BType, IType> entry :
|
462
|
+
builders) {
|
463
|
+
if (entry != null) {
|
464
|
+
entry.dispose();
|
465
|
+
}
|
466
|
+
}
|
467
|
+
builders = null;
|
468
|
+
}
|
469
|
+
onChanged();
|
470
|
+
incrementModCounts();
|
471
|
+
}
|
472
|
+
|
473
|
+
/**
|
474
|
+
* Builds the list of messages from the builder and returns them.
|
475
|
+
*
|
476
|
+
* @return an immutable list of messages
|
477
|
+
*/
|
478
|
+
public List<MType> build() {
|
479
|
+
// Now that build has been called, we are required to dispatch
|
480
|
+
// invalidations.
|
481
|
+
isClean = true;
|
482
|
+
|
483
|
+
if (!isMessagesListMutable && builders == null) {
|
484
|
+
// We still have an immutable list and we never created a builder.
|
485
|
+
return messages;
|
486
|
+
}
|
487
|
+
|
488
|
+
boolean allMessagesInSync = true;
|
489
|
+
if (!isMessagesListMutable) {
|
490
|
+
// We still have an immutable list. Let's see if any of them are out
|
491
|
+
// of sync with their builders.
|
492
|
+
for (int i = 0; i < messages.size(); i++) {
|
493
|
+
Message message = messages.get(i);
|
494
|
+
SingleFieldBuilder<MType, BType, IType> builder = builders.get(i);
|
495
|
+
if (builder != null) {
|
496
|
+
if (builder.build() != message) {
|
497
|
+
allMessagesInSync = false;
|
498
|
+
break;
|
499
|
+
}
|
500
|
+
}
|
501
|
+
}
|
502
|
+
if (allMessagesInSync) {
|
503
|
+
// Immutable list is still in sync.
|
504
|
+
return messages;
|
505
|
+
}
|
506
|
+
}
|
507
|
+
|
508
|
+
// Need to make sure messages is up to date
|
509
|
+
ensureMutableMessageList();
|
510
|
+
for (int i = 0; i < messages.size(); i++) {
|
511
|
+
messages.set(i, getMessage(i, true));
|
512
|
+
}
|
513
|
+
|
514
|
+
// We're going to return our list as immutable so we mark that we can
|
515
|
+
// no longer update it.
|
516
|
+
messages = Collections.unmodifiableList(messages);
|
517
|
+
isMessagesListMutable = false;
|
518
|
+
return messages;
|
519
|
+
}
|
520
|
+
|
521
|
+
/**
|
522
|
+
* Gets a view of the builder as a list of messages. The returned list is live
|
523
|
+
* and will reflect any changes to the underlying builder.
|
524
|
+
*
|
525
|
+
* @return the messages in the list
|
526
|
+
*/
|
527
|
+
public List<MType> getMessageList() {
|
528
|
+
if (externalMessageList == null) {
|
529
|
+
externalMessageList =
|
530
|
+
new MessageExternalList<MType, BType, IType>(this);
|
531
|
+
}
|
532
|
+
return externalMessageList;
|
533
|
+
}
|
534
|
+
|
535
|
+
/**
|
536
|
+
* Gets a view of the builder as a list of builders. This returned list is
|
537
|
+
* live and will reflect any changes to the underlying builder.
|
538
|
+
*
|
539
|
+
* @return the builders in the list
|
540
|
+
*/
|
541
|
+
public List<BType> getBuilderList() {
|
542
|
+
if (externalBuilderList == null) {
|
543
|
+
externalBuilderList =
|
544
|
+
new BuilderExternalList<MType, BType, IType>(this);
|
545
|
+
}
|
546
|
+
return externalBuilderList;
|
547
|
+
}
|
548
|
+
|
549
|
+
/**
|
550
|
+
* Gets a view of the builder as a list of MessageOrBuilders. This returned
|
551
|
+
* list is live and will reflect any changes to the underlying builder.
|
552
|
+
*
|
553
|
+
* @return the builders in the list
|
554
|
+
*/
|
555
|
+
public List<IType> getMessageOrBuilderList() {
|
556
|
+
if (externalMessageOrBuilderList == null) {
|
557
|
+
externalMessageOrBuilderList =
|
558
|
+
new MessageOrBuilderExternalList<MType, BType, IType>(this);
|
559
|
+
}
|
560
|
+
return externalMessageOrBuilderList;
|
561
|
+
}
|
562
|
+
|
563
|
+
/**
|
564
|
+
* Called when a the builder or one of its nested children has changed
|
565
|
+
* and any parent should be notified of its invalidation.
|
566
|
+
*/
|
567
|
+
private void onChanged() {
|
568
|
+
if (isClean && parent != null) {
|
569
|
+
parent.markDirty();
|
570
|
+
|
571
|
+
// Don't keep dispatching invalidations until build is called again.
|
572
|
+
isClean = false;
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
//@Override (Java 1.6 override semantics, but we must support 1.5)
|
577
|
+
public void markDirty() {
|
578
|
+
onChanged();
|
579
|
+
}
|
580
|
+
|
581
|
+
/**
|
582
|
+
* Increments the mod counts so that an ConcurrentModificationException can
|
583
|
+
* be thrown if calling code tries to modify the builder while its iterating
|
584
|
+
* the list.
|
585
|
+
*/
|
586
|
+
private void incrementModCounts() {
|
587
|
+
if (externalMessageList != null) {
|
588
|
+
externalMessageList.incrementModCount();
|
589
|
+
}
|
590
|
+
if (externalBuilderList != null) {
|
591
|
+
externalBuilderList.incrementModCount();
|
592
|
+
}
|
593
|
+
if (externalMessageOrBuilderList != null) {
|
594
|
+
externalMessageOrBuilderList.incrementModCount();
|
595
|
+
}
|
596
|
+
}
|
597
|
+
|
598
|
+
/**
|
599
|
+
* Provides a live view of the builder as a list of messages.
|
600
|
+
*
|
601
|
+
* @param <MType> the type of message for the field
|
602
|
+
* @param <BType> the type of builder for the field
|
603
|
+
* @param <IType> the common interface for the message and the builder
|
604
|
+
*/
|
605
|
+
private static class MessageExternalList<
|
606
|
+
MType extends GeneratedMessage,
|
607
|
+
BType extends GeneratedMessage.Builder,
|
608
|
+
IType extends MessageOrBuilder>
|
609
|
+
extends AbstractList<MType> implements List<MType> {
|
610
|
+
|
611
|
+
RepeatedFieldBuilder<MType, BType, IType> builder;
|
612
|
+
|
613
|
+
MessageExternalList(
|
614
|
+
RepeatedFieldBuilder<MType, BType, IType> builder) {
|
615
|
+
this.builder = builder;
|
616
|
+
}
|
617
|
+
|
618
|
+
public int size() {
|
619
|
+
return this.builder.getCount();
|
620
|
+
}
|
621
|
+
|
622
|
+
public MType get(int index) {
|
623
|
+
return builder.getMessage(index);
|
624
|
+
}
|
625
|
+
|
626
|
+
void incrementModCount() {
|
627
|
+
modCount++;
|
628
|
+
}
|
629
|
+
}
|
630
|
+
|
631
|
+
/**
|
632
|
+
* Provides a live view of the builder as a list of builders.
|
633
|
+
*
|
634
|
+
* @param <MType> the type of message for the field
|
635
|
+
* @param <BType> the type of builder for the field
|
636
|
+
* @param <IType> the common interface for the message and the builder
|
637
|
+
*/
|
638
|
+
private static class BuilderExternalList<
|
639
|
+
MType extends GeneratedMessage,
|
640
|
+
BType extends GeneratedMessage.Builder,
|
641
|
+
IType extends MessageOrBuilder>
|
642
|
+
extends AbstractList<BType> implements List<BType> {
|
643
|
+
|
644
|
+
RepeatedFieldBuilder<MType, BType, IType> builder;
|
645
|
+
|
646
|
+
BuilderExternalList(
|
647
|
+
RepeatedFieldBuilder<MType, BType, IType> builder) {
|
648
|
+
this.builder = builder;
|
649
|
+
}
|
650
|
+
|
651
|
+
public int size() {
|
652
|
+
return this.builder.getCount();
|
653
|
+
}
|
654
|
+
|
655
|
+
public BType get(int index) {
|
656
|
+
return builder.getBuilder(index);
|
657
|
+
}
|
658
|
+
|
659
|
+
void incrementModCount() {
|
660
|
+
modCount++;
|
661
|
+
}
|
662
|
+
}
|
663
|
+
|
664
|
+
/**
|
665
|
+
* Provides a live view of the builder as a list of builders.
|
666
|
+
*
|
667
|
+
* @param <MType> the type of message for the field
|
668
|
+
* @param <BType> the type of builder for the field
|
669
|
+
* @param <IType> the common interface for the message and the builder
|
670
|
+
*/
|
671
|
+
private static class MessageOrBuilderExternalList<
|
672
|
+
MType extends GeneratedMessage,
|
673
|
+
BType extends GeneratedMessage.Builder,
|
674
|
+
IType extends MessageOrBuilder>
|
675
|
+
extends AbstractList<IType> implements List<IType> {
|
676
|
+
|
677
|
+
RepeatedFieldBuilder<MType, BType, IType> builder;
|
678
|
+
|
679
|
+
MessageOrBuilderExternalList(
|
680
|
+
RepeatedFieldBuilder<MType, BType, IType> builder) {
|
681
|
+
this.builder = builder;
|
682
|
+
}
|
683
|
+
|
684
|
+
public int size() {
|
685
|
+
return this.builder.getCount();
|
686
|
+
}
|
687
|
+
|
688
|
+
public IType get(int index) {
|
689
|
+
return builder.getMessageOrBuilder(index);
|
690
|
+
}
|
691
|
+
|
692
|
+
void incrementModCount() {
|
693
|
+
modCount++;
|
694
|
+
}
|
695
|
+
}
|
696
|
+
}
|