Line data Source code
1 : //
2 : // Generated code. Do not modify.
3 : // source: google/protobuf/any.proto
4 : //
5 : // @dart = 2.12
6 :
7 : // ignore_for_file: annotate_overrides, camel_case_types, comment_references
8 : // ignore_for_file: constant_identifier_names, library_prefixes
9 : // ignore_for_file: non_constant_identifier_names, prefer_final_fields
10 : // ignore_for_file: unnecessary_import, unnecessary_this, unused_import
11 :
12 : import 'dart:core' as $core;
13 :
14 : import 'package:protobuf/protobuf.dart' as $pb;
15 : import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
16 :
17 : /// `Any` contains an arbitrary serialized protocol buffer message along with a
18 : /// URL that describes the type of the serialized message.
19 : ///
20 : /// Protobuf library provides support to pack/unpack Any values in the form
21 : /// of utility functions or additional generated methods of the Any type.
22 : ///
23 : /// Example 1: Pack and unpack a message in C++.
24 : ///
25 : /// Foo foo = ...;
26 : /// Any any;
27 : /// any.PackFrom(foo);
28 : /// ...
29 : /// if (any.UnpackTo(&foo)) {
30 : /// ...
31 : /// }
32 : ///
33 : /// Example 2: Pack and unpack a message in Java.
34 : ///
35 : /// Foo foo = ...;
36 : /// Any any = Any.pack(foo);
37 : /// ...
38 : /// if (any.is(Foo.class)) {
39 : /// foo = any.unpack(Foo.class);
40 : /// }
41 : /// // or ...
42 : /// if (any.isSameTypeAs(Foo.getDefaultInstance())) {
43 : /// foo = any.unpack(Foo.getDefaultInstance());
44 : /// }
45 : ///
46 : /// Example 3: Pack and unpack a message in Python.
47 : ///
48 : /// foo = Foo(...)
49 : /// any = Any()
50 : /// any.Pack(foo)
51 : /// ...
52 : /// if any.Is(Foo.DESCRIPTOR):
53 : /// any.Unpack(foo)
54 : /// ...
55 : ///
56 : /// Example 4: Pack and unpack a message in Go
57 : ///
58 : /// foo := &pb.Foo{...}
59 : /// any, err := anypb.New(foo)
60 : /// if err != nil {
61 : /// ...
62 : /// }
63 : /// ...
64 : /// foo := &pb.Foo{}
65 : /// if err := any.UnmarshalTo(foo); err != nil {
66 : /// ...
67 : /// }
68 : ///
69 : /// The pack methods provided by protobuf library will by default use
70 : /// 'type.googleapis.com/full.type.name' as the type URL and the unpack
71 : /// methods only use the fully qualified type name after the last '/'
72 : /// in the type URL, for example "foo.bar.com/x/y.z" will yield type
73 : /// name "y.z".
74 : ///
75 : /// JSON
76 : /// ====
77 : /// The JSON representation of an `Any` value uses the regular
78 : /// representation of the deserialized, embedded message, with an
79 : /// additional field `@type` which contains the type URL. Example:
80 : ///
81 : /// package google.profile;
82 : /// message Person {
83 : /// string first_name = 1;
84 : /// string last_name = 2;
85 : /// }
86 : ///
87 : /// {
88 : /// "@type": "type.googleapis.com/google.profile.Person",
89 : /// "firstName": <string>,
90 : /// "lastName": <string>
91 : /// }
92 : ///
93 : /// If the embedded message type is well-known and has a custom JSON
94 : /// representation, that representation will be embedded adding a field
95 : /// `value` which holds the custom JSON in addition to the `@type`
96 : /// field. Example (for message [google.protobuf.Duration][]):
97 : ///
98 : /// {
99 : /// "@type": "type.googleapis.com/google.protobuf.Duration",
100 : /// "value": "1.212s"
101 : /// }
102 : class Any extends $pb.GeneratedMessage with $mixin.AnyMixin {
103 0 : factory Any({
104 : $core.String? typeUrl,
105 : $core.List<$core.int>? value,
106 : }) {
107 0 : final result = create();
108 : if (typeUrl != null) {
109 0 : result.typeUrl = typeUrl;
110 : }
111 : if (value != null) {
112 0 : result.value = value;
113 : }
114 : return result;
115 : }
116 4 : Any._() : super();
117 0 : factory Any.fromBuffer($core.List<$core.int> i,
118 : [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
119 0 : create()..mergeFromBuffer(i, r);
120 0 : factory Any.fromJson($core.String i,
121 : [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
122 0 : create()..mergeFromJson(i, r);
123 :
124 6 : static final $pb.BuilderInfo _i = $pb.BuilderInfo(
125 : _omitMessageNames ? '' : 'Any',
126 : package:
127 : const $pb.PackageName(_omitMessageNames ? '' : 'google.protobuf'),
128 : createEmptyInstance: create,
129 : toProto3Json: $mixin.AnyMixin.toProto3JsonHelper,
130 : fromProto3Json: $mixin.AnyMixin.fromProto3JsonHelper)
131 2 : ..aOS(1, _omitFieldNames ? '' : 'typeUrl')
132 2 : ..a<$core.List<$core.int>>(
133 : 2, _omitFieldNames ? '' : 'value', $pb.PbFieldType.OY)
134 2 : ..hasRequiredFields = false;
135 :
136 0 : @$core.Deprecated('Using this can add significant overhead to your binary. '
137 : 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
138 : 'Will be removed in next major version')
139 0 : Any clone() => Any()..mergeFromMessage(this);
140 0 : @$core.Deprecated('Using this can add significant overhead to your binary. '
141 : 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
142 : 'Will be removed in next major version')
143 : Any copyWith(void Function(Any) updates) =>
144 0 : super.copyWith((message) => updates(message as Any)) as Any;
145 :
146 4 : $pb.BuilderInfo get info_ => _i;
147 :
148 2 : @$core.pragma('dart2js:noInline')
149 2 : static Any create() => Any._();
150 0 : Any createEmptyInstance() => create();
151 0 : static $pb.PbList<Any> createRepeated() => $pb.PbList<Any>();
152 0 : @$core.pragma('dart2js:noInline')
153 : static Any getDefault() =>
154 0 : _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Any>(create);
155 : static Any? _defaultInstance;
156 :
157 : /// A URL/resource name that uniquely identifies the type of the serialized
158 : /// protocol buffer message. This string must contain at least
159 : /// one "/" character. The last segment of the URL's path must represent
160 : /// the fully qualified name of the type (as in
161 : /// `path/google.protobuf.Duration`). The name should be in a canonical form
162 : /// (e.g., leading "." is not accepted).
163 : ///
164 : /// In practice, teams usually precompile into the binary all types that they
165 : /// expect it to use in the context of Any. However, for URLs which use the
166 : /// scheme `http`, `https`, or no scheme, one can optionally set up a type
167 : /// server that maps type URLs to message definitions as follows:
168 : ///
169 : /// * If no scheme is provided, `https` is assumed.
170 : /// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
171 : /// value in binary format, or produce an error.
172 : /// * Applications are allowed to cache lookup results based on the
173 : /// URL, or have them precompiled into a binary to avoid any
174 : /// lookup. Therefore, binary compatibility needs to be preserved
175 : /// on changes to types. (Use versioned type names to manage
176 : /// breaking changes.)
177 : ///
178 : /// Note: this functionality is not currently available in the official
179 : /// protobuf release, and it is not used for type URLs beginning with
180 : /// type.googleapis.com. As of May 2023, there are no widely used type server
181 : /// implementations and no plans to implement one.
182 : ///
183 : /// Schemes other than `http`, `https` (or the empty scheme) might be
184 : /// used with implementation specific semantics.
185 2 : @$pb.TagNumber(1)
186 2 : $core.String get typeUrl => $_getSZ(0);
187 1 : @$pb.TagNumber(1)
188 : set typeUrl($core.String v) {
189 1 : $_setString(0, v);
190 : }
191 :
192 0 : @$pb.TagNumber(1)
193 0 : $core.bool hasTypeUrl() => $_has(0);
194 0 : @$pb.TagNumber(1)
195 0 : void clearTypeUrl() => clearField(1);
196 :
197 : /// Must be a valid serialized protocol buffer of the above specified type.
198 2 : @$pb.TagNumber(2)
199 2 : $core.List<$core.int> get value => $_getN(1);
200 1 : @$pb.TagNumber(2)
201 : set value($core.List<$core.int> v) {
202 1 : $_setBytes(1, v);
203 : }
204 :
205 0 : @$pb.TagNumber(2)
206 0 : $core.bool hasValue() => $_has(1);
207 0 : @$pb.TagNumber(2)
208 0 : void clearValue() => clearField(2);
209 :
210 : /// Creates a new [Any] encoding [message].
211 : ///
212 : /// The [typeUrl] will be [typeUrlPrefix]/`fullName` where `fullName` is
213 : /// the fully qualified name of the type of [message].
214 1 : static Any pack($pb.GeneratedMessage message,
215 : {$core.String typeUrlPrefix = 'type.googleapis.com'}) {
216 1 : final result = create();
217 1 : $mixin.AnyMixin.packIntoAny(result, message, typeUrlPrefix: typeUrlPrefix);
218 : return result;
219 : }
220 : }
221 :
222 : const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
223 : const _omitMessageNames =
224 : $core.bool.fromEnvironment('protobuf.omit_message_names');
|