yellow-brick-road 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rst +9 -1
- data/Rakefile +0 -3
- data/lib/generators/templates/yellow_brick_road.rb.erb +12 -0
- data/lib/tasks/ybr.rake +12 -0
- data/lib/yellow-brick-road.rb +5 -0
- data/lib/yellow-brick-road/config.rb +45 -6
- data/lib/yellow-brick-road/directive_processor.rb +89 -10
- data/lib/yellow-brick-road/engine.rb +10 -0
- data/lib/yellow-brick-road/protobuf_js.rb +32 -0
- data/lib/yellow-brick-road/soy_processor.rb +13 -4
- data/lib/yellow-brick-road/utils.rb +7 -1
- data/lib/yellow-brick-road/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/application.js +1 -0
- data/test/dummy/app/assets/javascripts/closure-deps.js +2 -1
- data/test/dummy/app/assets/javascripts/protos/person.pb.js +207 -0
- data/test/dummy/app/protos/person.proto +5 -0
- data/test/dummy/log/development.log +1544 -0
- data/test/dummy/tmp/cache/assets/C5B/240/sprockets%2Fc561864da49634b1e8464990f63f4123 +314 -0
- data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +6 -5
- data/test/dummy/tmp/cache/assets/CBD/850/sprockets%2F9191c7b83dca8e9342628ac59e452229 +297 -0
- data/test/dummy/tmp/cache/assets/CCC/BB0/sprockets%2F649c7cc1e706997576646e6dd790d7a0 +0 -0
- data/test/dummy/tmp/cache/assets/CE0/AB0/sprockets%2Fb8f01070d8f72dd30306684ef61858ac +204 -0
- data/test/dummy/tmp/cache/assets/CF7/BC0/sprockets%2Fe47129798756fd8f35bd4350bff5e461 +213 -0
- data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
- data/test/dummy/tmp/cache/assets/D50/F20/sprockets%2Fd858e852254b667a8efffa4f12d96d11 +0 -0
- data/test/dummy/tmp/cache/assets/D6B/0C0/sprockets%2F8c3bdd9c000f7f5a26e91f294a71c3c4 +0 -0
- data/test/dummy/tmp/cache/assets/D6F/6D0/sprockets%2Ff9f65ec20235e6595b5eb2ab91f15bb4 +1441 -0
- data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +7 -5
- data/test/dummy/tmp/cache/assets/D97/E60/sprockets%2F18762119fe3a03903efaac2bfceec628 +763 -0
- data/test/dummy/tmp/cache/assets/DA1/670/sprockets%2Fccb4ba5dcd2f7696c636666ca5ab6057 +60 -0
- data/test/dummy/tmp/cache/assets/DED/040/sprockets%2Fd3aa2ab8d25cde3b6fb324dbb8c42933 +746 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- metadata +38 -11
- data/lib/tasks/yellow-brick-road_tasks.rake +0 -4
@@ -0,0 +1,314 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1326427868.3313868:@value{I"
|
2
|
+
class:EFI"BundledAsset;
|
3
|
+
FI"id;
|
4
|
+
F"%2527bce90d7aa6fb1f623e8d3814389cI"logical_path;
|
5
|
+
FI"+closure/goog/proto2/fielddescriptor.js;
|
6
|
+
TI"
|
7
|
+
F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/proto2/fielddescriptor.jsI"content_type;
|
8
|
+
FI"application/javascript;
|
9
|
+
FI"
|
10
|
+
mtime;
|
11
|
+
FI"2012-01-03T00:52:24+00:00;
|
12
|
+
FI" body;
|
13
|
+
FI"D// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
14
|
+
//
|
15
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
+
// you may not use this file except in compliance with the License.
|
17
|
+
// You may obtain a copy of the License at
|
18
|
+
//
|
19
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
//
|
21
|
+
// Unless required by applicable law or agreed to in writing, software
|
22
|
+
// distributed under the License is distributed on an "AS-IS" BASIS,
|
23
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
+
// See the License for the specific language governing permissions and
|
25
|
+
// limitations under the License.
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @fileoverview Protocol Buffer Field Descriptor class.
|
29
|
+
*/
|
30
|
+
|
31
|
+
|
32
|
+
goog.provide('goog.proto2.FieldDescriptor');
|
33
|
+
|
34
|
+
goog.require('goog.proto2.Util');
|
35
|
+
goog.require('goog.string');
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
/**
|
40
|
+
* A class which describes a field in a Protocol Buffer 2 Message.
|
41
|
+
*
|
42
|
+
* @param {Function} messageType Constructor for the message
|
43
|
+
* class to which the field described by this class belongs.
|
44
|
+
* @param {number|string} tag The field's tag index.
|
45
|
+
* @param {Object} metadata The metadata about this field that will be used
|
46
|
+
* to construct this descriptor.
|
47
|
+
*
|
48
|
+
* @constructor
|
49
|
+
*/
|
50
|
+
goog.proto2.FieldDescriptor = function(messageType, tag, metadata) {
|
51
|
+
/**
|
52
|
+
* The message type that contains the field that this
|
53
|
+
* descriptor describes.
|
54
|
+
* @type {Function}
|
55
|
+
* @private
|
56
|
+
*/
|
57
|
+
this.parent_ = messageType;
|
58
|
+
|
59
|
+
// Ensure that the tag is numeric.
|
60
|
+
goog.proto2.Util.assert(goog.string.isNumeric(tag));
|
61
|
+
|
62
|
+
/**
|
63
|
+
* The field's tag number.
|
64
|
+
* @type {number}
|
65
|
+
* @private
|
66
|
+
*/
|
67
|
+
this.tag_ = /** @type {number} */ (tag);
|
68
|
+
|
69
|
+
/**
|
70
|
+
* The field's name.
|
71
|
+
* @type {string}
|
72
|
+
* @private
|
73
|
+
*/
|
74
|
+
this.name_ = metadata.name;
|
75
|
+
|
76
|
+
/** @type {goog.proto2.FieldDescriptor.FieldType} */
|
77
|
+
metadata.fieldType;
|
78
|
+
|
79
|
+
/** @type {*} */
|
80
|
+
metadata.repeated;
|
81
|
+
|
82
|
+
/** @type {*} */
|
83
|
+
metadata.required;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* If true, this field is a repeating field.
|
87
|
+
* @type {boolean}
|
88
|
+
* @private
|
89
|
+
*/
|
90
|
+
this.isRepeated_ = !!metadata.repeated;
|
91
|
+
|
92
|
+
/**
|
93
|
+
* If true, this field is required.
|
94
|
+
* @type {boolean}
|
95
|
+
* @private
|
96
|
+
*/
|
97
|
+
this.isRequired_ = !!metadata.required;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* The field type of this field.
|
101
|
+
* @type {goog.proto2.FieldDescriptor.FieldType}
|
102
|
+
* @private
|
103
|
+
*/
|
104
|
+
this.fieldType_ = metadata.fieldType;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* If this field is a primitive: The native (ECMAScript) type of this field.
|
108
|
+
* If an enumeration: The enumeration object.
|
109
|
+
* If a message or group field: The Message function.
|
110
|
+
* @type {Function}
|
111
|
+
* @private
|
112
|
+
*/
|
113
|
+
this.nativeType_ = metadata.type;
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Is it permissible on deserialization to convert between numbers and
|
117
|
+
* well-formed strings? Is true for 64-bit integral field types, false for
|
118
|
+
* all other field types.
|
119
|
+
* @type {boolean}
|
120
|
+
* @private
|
121
|
+
*/
|
122
|
+
this.deserializationConversionPermitted_ = false;
|
123
|
+
|
124
|
+
switch (this.fieldType_) {
|
125
|
+
case goog.proto2.FieldDescriptor.FieldType.INT64:
|
126
|
+
case goog.proto2.FieldDescriptor.FieldType.UINT64:
|
127
|
+
case goog.proto2.FieldDescriptor.FieldType.FIXED64:
|
128
|
+
case goog.proto2.FieldDescriptor.FieldType.SFIXED64:
|
129
|
+
case goog.proto2.FieldDescriptor.FieldType.SINT64:
|
130
|
+
this.deserializationConversionPermitted_ = true;
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* The default value of this field, if different from the default, default
|
136
|
+
* value.
|
137
|
+
* @type {*}
|
138
|
+
* @private
|
139
|
+
*/
|
140
|
+
this.defaultValue_ = metadata.defaultValue;
|
141
|
+
};
|
142
|
+
|
143
|
+
|
144
|
+
/**
|
145
|
+
* An enumeration defining the possible field types.
|
146
|
+
* Should be a mirror of that defined in descriptor.h.
|
147
|
+
*
|
148
|
+
* @enum {number}
|
149
|
+
*/
|
150
|
+
goog.proto2.FieldDescriptor.FieldType = {
|
151
|
+
DOUBLE: 1,
|
152
|
+
FLOAT: 2,
|
153
|
+
INT64: 3,
|
154
|
+
UINT64: 4,
|
155
|
+
INT32: 5,
|
156
|
+
FIXED64: 6,
|
157
|
+
FIXED32: 7,
|
158
|
+
BOOL: 8,
|
159
|
+
STRING: 9,
|
160
|
+
GROUP: 10,
|
161
|
+
MESSAGE: 11,
|
162
|
+
BYTES: 12,
|
163
|
+
UINT32: 13,
|
164
|
+
ENUM: 14,
|
165
|
+
SFIXED32: 15,
|
166
|
+
SFIXED64: 16,
|
167
|
+
SINT32: 17,
|
168
|
+
SINT64: 18
|
169
|
+
};
|
170
|
+
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Returns the tag of the field that this descriptor represents.
|
174
|
+
*
|
175
|
+
* @return {number} The tag number.
|
176
|
+
*/
|
177
|
+
goog.proto2.FieldDescriptor.prototype.getTag = function() {
|
178
|
+
return this.tag_;
|
179
|
+
};
|
180
|
+
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Returns the descriptor describing the message that defined this field.
|
184
|
+
* @return {goog.proto2.Descriptor} The descriptor.
|
185
|
+
*/
|
186
|
+
goog.proto2.FieldDescriptor.prototype.getContainingType = function() {
|
187
|
+
return this.parent_.descriptor_;
|
188
|
+
};
|
189
|
+
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Returns the name of the field that this descriptor represents.
|
193
|
+
* @return {string} The name.
|
194
|
+
*/
|
195
|
+
goog.proto2.FieldDescriptor.prototype.getName = function() {
|
196
|
+
return this.name_;
|
197
|
+
};
|
198
|
+
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Returns the default value of this field.
|
202
|
+
* @return {*} The default value.
|
203
|
+
*/
|
204
|
+
goog.proto2.FieldDescriptor.prototype.getDefaultValue = function() {
|
205
|
+
if (this.defaultValue_ === undefined) {
|
206
|
+
// Set the default value based on a new instance of the native type.
|
207
|
+
// This will be (0, false, "") for (number, boolean, string) and will
|
208
|
+
// be a new instance of a group/message if the field is a message type.
|
209
|
+
var nativeType = this.nativeType_;
|
210
|
+
if (nativeType === Boolean) {
|
211
|
+
this.defaultValue_ = false;
|
212
|
+
} else if (nativeType === Number) {
|
213
|
+
this.defaultValue_ = 0;
|
214
|
+
} else if (nativeType === String) {
|
215
|
+
this.defaultValue_ = '';
|
216
|
+
} else {
|
217
|
+
this.defaultValue_ = new nativeType;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
return this.defaultValue_;
|
222
|
+
};
|
223
|
+
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Returns the field type of the field described by this descriptor.
|
227
|
+
* @return {goog.proto2.FieldDescriptor.FieldType} The field type.
|
228
|
+
*/
|
229
|
+
goog.proto2.FieldDescriptor.prototype.getFieldType = function() {
|
230
|
+
return this.fieldType_;
|
231
|
+
};
|
232
|
+
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Returns the native (i.e. ECMAScript) type of the field described by this
|
236
|
+
* descriptor.
|
237
|
+
*
|
238
|
+
* @return {Object} The native type.
|
239
|
+
*/
|
240
|
+
goog.proto2.FieldDescriptor.prototype.getNativeType = function() {
|
241
|
+
return this.nativeType_;
|
242
|
+
};
|
243
|
+
|
244
|
+
|
245
|
+
/**
|
246
|
+
* Returns true if simple conversions between numbers and strings are permitted
|
247
|
+
* during deserialization for this field.
|
248
|
+
*
|
249
|
+
* @return {boolean} Whether conversion is permitted.
|
250
|
+
*/
|
251
|
+
goog.proto2.FieldDescriptor.prototype.deserializationConversionPermitted =
|
252
|
+
function() {
|
253
|
+
return this.deserializationConversionPermitted_;
|
254
|
+
};
|
255
|
+
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Returns the descriptor of the message type of this field. Only valid
|
259
|
+
* for fields of type GROUP and MESSAGE.
|
260
|
+
*
|
261
|
+
* @return {goog.proto2.Descriptor} The message descriptor.
|
262
|
+
*/
|
263
|
+
goog.proto2.FieldDescriptor.prototype.getFieldMessageType = function() {
|
264
|
+
goog.proto2.Util.assert(this.isCompositeType(), 'Expected message or group');
|
265
|
+
|
266
|
+
return this.nativeType_.descriptor_;
|
267
|
+
};
|
268
|
+
|
269
|
+
|
270
|
+
/**
|
271
|
+
* @return {boolean} True if the field stores composite data or repeated
|
272
|
+
* composite data (message or group).
|
273
|
+
*/
|
274
|
+
goog.proto2.FieldDescriptor.prototype.isCompositeType = function() {
|
275
|
+
return this.fieldType_ == goog.proto2.FieldDescriptor.FieldType.MESSAGE ||
|
276
|
+
this.fieldType_ == goog.proto2.FieldDescriptor.FieldType.GROUP;
|
277
|
+
};
|
278
|
+
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Returns whether the field described by this descriptor is repeating.
|
282
|
+
* @return {boolean} Whether the field is repeated.
|
283
|
+
*/
|
284
|
+
goog.proto2.FieldDescriptor.prototype.isRepeated = function() {
|
285
|
+
return this.isRepeated_;
|
286
|
+
};
|
287
|
+
|
288
|
+
|
289
|
+
/**
|
290
|
+
* Returns whether the field described by this descriptor is required.
|
291
|
+
* @return {boolean} Whether the field is required.
|
292
|
+
*/
|
293
|
+
goog.proto2.FieldDescriptor.prototype.isRequired = function() {
|
294
|
+
return this.isRequired_;
|
295
|
+
};
|
296
|
+
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Returns whether the field described by this descriptor is optional.
|
300
|
+
* @return {boolean} Whether the field is optional.
|
301
|
+
*/
|
302
|
+
goog.proto2.FieldDescriptor.prototype.isOptional = function() {
|
303
|
+
return !this.isRepeated_ && !this.isRequired_;
|
304
|
+
};
|
305
|
+
;
|
306
|
+
FI"asset_paths;
|
307
|
+
F["�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/proto2/fielddescriptor.jsI"dependency_paths;
|
308
|
+
F[{I" path;
|
309
|
+
F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/proto2/fielddescriptor.jsI"
|
310
|
+
mtime;
|
311
|
+
FIu: Time
|
312
|
+
T:offsetiI"hexdigest;
|
313
|
+
F"%2601e121ecacf8a83e8bf9286851559aI"
|
314
|
+
F"%46dde6621c301f4928e3b34efee9e3b5
|
@@ -1,9 +1,10 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf
|
2
|
-
F"%
|
3
|
-
FI"�// This file was autogenerated by /Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/bin/build/depswriter.py.
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1326429782.0308638:@value{ I"length:EFi�I"digest;
|
2
|
+
F"%45ec0923ef3c38de98ee7865ffdf7a52I"source;
|
3
|
+
FI"�// This file was autogenerated by /Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/bin/build/depswriter.py.
|
4
4
|
// Please do not edit.
|
5
5
|
goog.addDependency('../../my-closure/start.js', ['myproject.start'], ['goog.dom', 'myproject.templates']);
|
6
|
-
goog.addDependency('/
|
6
|
+
goog.addDependency('../../protos/person.pb.js', ['Person'], ['goog.proto2.Message']);
|
7
|
+
goog.addDependency('/../../../soyutils_usegoog.js', ['soy', 'soy.StringBuilder', 'soy.esc', 'soydata', 'soydata.SanitizedHtml', 'soydata.SanitizedHtmlAttribute', 'soydata.SanitizedJsStrChars', 'soydata.SanitizedUri'], ['goog.asserts', 'goog.dom.DomHelper', 'goog.format', 'goog.i18n.BidiFormatter', 'goog.i18n.bidi', 'goog.soy', 'goog.string', 'goog.string.StringBuffer']);
|
7
8
|
;
|
8
9
|
FI"
|
9
|
-
F"%
|
10
|
+
F"%5e24b51939c298e092bfde52df58dccc
|
@@ -0,0 +1,297 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1326427868.334367:@value{ I"length:EFiDI"digest;
|
2
|
+
F"%6edebc8252f0c12f615e7077ff3d8a74I"source;
|
3
|
+
FI"D// Copyright 2008 The Closure Library Authors. All Rights Reserved.
|
4
|
+
//
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
// you may not use this file except in compliance with the License.
|
7
|
+
// You may obtain a copy of the License at
|
8
|
+
//
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
//
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
12
|
+
// distributed under the License is distributed on an "AS-IS" BASIS,
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
// See the License for the specific language governing permissions and
|
15
|
+
// limitations under the License.
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @fileoverview Protocol Buffer Field Descriptor class.
|
19
|
+
*/
|
20
|
+
|
21
|
+
|
22
|
+
goog.provide('goog.proto2.FieldDescriptor');
|
23
|
+
|
24
|
+
goog.require('goog.proto2.Util');
|
25
|
+
goog.require('goog.string');
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
/**
|
30
|
+
* A class which describes a field in a Protocol Buffer 2 Message.
|
31
|
+
*
|
32
|
+
* @param {Function} messageType Constructor for the message
|
33
|
+
* class to which the field described by this class belongs.
|
34
|
+
* @param {number|string} tag The field's tag index.
|
35
|
+
* @param {Object} metadata The metadata about this field that will be used
|
36
|
+
* to construct this descriptor.
|
37
|
+
*
|
38
|
+
* @constructor
|
39
|
+
*/
|
40
|
+
goog.proto2.FieldDescriptor = function(messageType, tag, metadata) {
|
41
|
+
/**
|
42
|
+
* The message type that contains the field that this
|
43
|
+
* descriptor describes.
|
44
|
+
* @type {Function}
|
45
|
+
* @private
|
46
|
+
*/
|
47
|
+
this.parent_ = messageType;
|
48
|
+
|
49
|
+
// Ensure that the tag is numeric.
|
50
|
+
goog.proto2.Util.assert(goog.string.isNumeric(tag));
|
51
|
+
|
52
|
+
/**
|
53
|
+
* The field's tag number.
|
54
|
+
* @type {number}
|
55
|
+
* @private
|
56
|
+
*/
|
57
|
+
this.tag_ = /** @type {number} */ (tag);
|
58
|
+
|
59
|
+
/**
|
60
|
+
* The field's name.
|
61
|
+
* @type {string}
|
62
|
+
* @private
|
63
|
+
*/
|
64
|
+
this.name_ = metadata.name;
|
65
|
+
|
66
|
+
/** @type {goog.proto2.FieldDescriptor.FieldType} */
|
67
|
+
metadata.fieldType;
|
68
|
+
|
69
|
+
/** @type {*} */
|
70
|
+
metadata.repeated;
|
71
|
+
|
72
|
+
/** @type {*} */
|
73
|
+
metadata.required;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* If true, this field is a repeating field.
|
77
|
+
* @type {boolean}
|
78
|
+
* @private
|
79
|
+
*/
|
80
|
+
this.isRepeated_ = !!metadata.repeated;
|
81
|
+
|
82
|
+
/**
|
83
|
+
* If true, this field is required.
|
84
|
+
* @type {boolean}
|
85
|
+
* @private
|
86
|
+
*/
|
87
|
+
this.isRequired_ = !!metadata.required;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* The field type of this field.
|
91
|
+
* @type {goog.proto2.FieldDescriptor.FieldType}
|
92
|
+
* @private
|
93
|
+
*/
|
94
|
+
this.fieldType_ = metadata.fieldType;
|
95
|
+
|
96
|
+
/**
|
97
|
+
* If this field is a primitive: The native (ECMAScript) type of this field.
|
98
|
+
* If an enumeration: The enumeration object.
|
99
|
+
* If a message or group field: The Message function.
|
100
|
+
* @type {Function}
|
101
|
+
* @private
|
102
|
+
*/
|
103
|
+
this.nativeType_ = metadata.type;
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Is it permissible on deserialization to convert between numbers and
|
107
|
+
* well-formed strings? Is true for 64-bit integral field types, false for
|
108
|
+
* all other field types.
|
109
|
+
* @type {boolean}
|
110
|
+
* @private
|
111
|
+
*/
|
112
|
+
this.deserializationConversionPermitted_ = false;
|
113
|
+
|
114
|
+
switch (this.fieldType_) {
|
115
|
+
case goog.proto2.FieldDescriptor.FieldType.INT64:
|
116
|
+
case goog.proto2.FieldDescriptor.FieldType.UINT64:
|
117
|
+
case goog.proto2.FieldDescriptor.FieldType.FIXED64:
|
118
|
+
case goog.proto2.FieldDescriptor.FieldType.SFIXED64:
|
119
|
+
case goog.proto2.FieldDescriptor.FieldType.SINT64:
|
120
|
+
this.deserializationConversionPermitted_ = true;
|
121
|
+
break;
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* The default value of this field, if different from the default, default
|
126
|
+
* value.
|
127
|
+
* @type {*}
|
128
|
+
* @private
|
129
|
+
*/
|
130
|
+
this.defaultValue_ = metadata.defaultValue;
|
131
|
+
};
|
132
|
+
|
133
|
+
|
134
|
+
/**
|
135
|
+
* An enumeration defining the possible field types.
|
136
|
+
* Should be a mirror of that defined in descriptor.h.
|
137
|
+
*
|
138
|
+
* @enum {number}
|
139
|
+
*/
|
140
|
+
goog.proto2.FieldDescriptor.FieldType = {
|
141
|
+
DOUBLE: 1,
|
142
|
+
FLOAT: 2,
|
143
|
+
INT64: 3,
|
144
|
+
UINT64: 4,
|
145
|
+
INT32: 5,
|
146
|
+
FIXED64: 6,
|
147
|
+
FIXED32: 7,
|
148
|
+
BOOL: 8,
|
149
|
+
STRING: 9,
|
150
|
+
GROUP: 10,
|
151
|
+
MESSAGE: 11,
|
152
|
+
BYTES: 12,
|
153
|
+
UINT32: 13,
|
154
|
+
ENUM: 14,
|
155
|
+
SFIXED32: 15,
|
156
|
+
SFIXED64: 16,
|
157
|
+
SINT32: 17,
|
158
|
+
SINT64: 18
|
159
|
+
};
|
160
|
+
|
161
|
+
|
162
|
+
/**
|
163
|
+
* Returns the tag of the field that this descriptor represents.
|
164
|
+
*
|
165
|
+
* @return {number} The tag number.
|
166
|
+
*/
|
167
|
+
goog.proto2.FieldDescriptor.prototype.getTag = function() {
|
168
|
+
return this.tag_;
|
169
|
+
};
|
170
|
+
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Returns the descriptor describing the message that defined this field.
|
174
|
+
* @return {goog.proto2.Descriptor} The descriptor.
|
175
|
+
*/
|
176
|
+
goog.proto2.FieldDescriptor.prototype.getContainingType = function() {
|
177
|
+
return this.parent_.descriptor_;
|
178
|
+
};
|
179
|
+
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Returns the name of the field that this descriptor represents.
|
183
|
+
* @return {string} The name.
|
184
|
+
*/
|
185
|
+
goog.proto2.FieldDescriptor.prototype.getName = function() {
|
186
|
+
return this.name_;
|
187
|
+
};
|
188
|
+
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Returns the default value of this field.
|
192
|
+
* @return {*} The default value.
|
193
|
+
*/
|
194
|
+
goog.proto2.FieldDescriptor.prototype.getDefaultValue = function() {
|
195
|
+
if (this.defaultValue_ === undefined) {
|
196
|
+
// Set the default value based on a new instance of the native type.
|
197
|
+
// This will be (0, false, "") for (number, boolean, string) and will
|
198
|
+
// be a new instance of a group/message if the field is a message type.
|
199
|
+
var nativeType = this.nativeType_;
|
200
|
+
if (nativeType === Boolean) {
|
201
|
+
this.defaultValue_ = false;
|
202
|
+
} else if (nativeType === Number) {
|
203
|
+
this.defaultValue_ = 0;
|
204
|
+
} else if (nativeType === String) {
|
205
|
+
this.defaultValue_ = '';
|
206
|
+
} else {
|
207
|
+
this.defaultValue_ = new nativeType;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
return this.defaultValue_;
|
212
|
+
};
|
213
|
+
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Returns the field type of the field described by this descriptor.
|
217
|
+
* @return {goog.proto2.FieldDescriptor.FieldType} The field type.
|
218
|
+
*/
|
219
|
+
goog.proto2.FieldDescriptor.prototype.getFieldType = function() {
|
220
|
+
return this.fieldType_;
|
221
|
+
};
|
222
|
+
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Returns the native (i.e. ECMAScript) type of the field described by this
|
226
|
+
* descriptor.
|
227
|
+
*
|
228
|
+
* @return {Object} The native type.
|
229
|
+
*/
|
230
|
+
goog.proto2.FieldDescriptor.prototype.getNativeType = function() {
|
231
|
+
return this.nativeType_;
|
232
|
+
};
|
233
|
+
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Returns true if simple conversions between numbers and strings are permitted
|
237
|
+
* during deserialization for this field.
|
238
|
+
*
|
239
|
+
* @return {boolean} Whether conversion is permitted.
|
240
|
+
*/
|
241
|
+
goog.proto2.FieldDescriptor.prototype.deserializationConversionPermitted =
|
242
|
+
function() {
|
243
|
+
return this.deserializationConversionPermitted_;
|
244
|
+
};
|
245
|
+
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Returns the descriptor of the message type of this field. Only valid
|
249
|
+
* for fields of type GROUP and MESSAGE.
|
250
|
+
*
|
251
|
+
* @return {goog.proto2.Descriptor} The message descriptor.
|
252
|
+
*/
|
253
|
+
goog.proto2.FieldDescriptor.prototype.getFieldMessageType = function() {
|
254
|
+
goog.proto2.Util.assert(this.isCompositeType(), 'Expected message or group');
|
255
|
+
|
256
|
+
return this.nativeType_.descriptor_;
|
257
|
+
};
|
258
|
+
|
259
|
+
|
260
|
+
/**
|
261
|
+
* @return {boolean} True if the field stores composite data or repeated
|
262
|
+
* composite data (message or group).
|
263
|
+
*/
|
264
|
+
goog.proto2.FieldDescriptor.prototype.isCompositeType = function() {
|
265
|
+
return this.fieldType_ == goog.proto2.FieldDescriptor.FieldType.MESSAGE ||
|
266
|
+
this.fieldType_ == goog.proto2.FieldDescriptor.FieldType.GROUP;
|
267
|
+
};
|
268
|
+
|
269
|
+
|
270
|
+
/**
|
271
|
+
* Returns whether the field described by this descriptor is repeating.
|
272
|
+
* @return {boolean} Whether the field is repeated.
|
273
|
+
*/
|
274
|
+
goog.proto2.FieldDescriptor.prototype.isRepeated = function() {
|
275
|
+
return this.isRepeated_;
|
276
|
+
};
|
277
|
+
|
278
|
+
|
279
|
+
/**
|
280
|
+
* Returns whether the field described by this descriptor is required.
|
281
|
+
* @return {boolean} Whether the field is required.
|
282
|
+
*/
|
283
|
+
goog.proto2.FieldDescriptor.prototype.isRequired = function() {
|
284
|
+
return this.isRequired_;
|
285
|
+
};
|
286
|
+
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Returns whether the field described by this descriptor is optional.
|
290
|
+
* @return {boolean} Whether the field is optional.
|
291
|
+
*/
|
292
|
+
goog.proto2.FieldDescriptor.prototype.isOptional = function() {
|
293
|
+
return !this.isRepeated_ && !this.isRequired_;
|
294
|
+
};
|
295
|
+
;
|
296
|
+
FI"
|
297
|
+
F"%2527bce90d7aa6fb1f623e8d3814389c
|