|
1 | | -( function( $, dt ) { |
| 1 | +( function ( $, dt ) { |
2 | 2 | 'use strict'; |
3 | 3 |
|
4 | | -/** |
5 | | - * Base constructor for objects representing a data type. |
6 | | - * @class dataTypes.DataType |
7 | | - * @abstract |
8 | | - * @since 0.1 |
9 | | - * @license GPL-2.0+ |
10 | | - * @author Daniel Werner |
11 | | - * @author H. Snater < mediawiki@snater.com > |
12 | | - * |
13 | | - * @constructor |
14 | | - * @param {string} dataTypeId |
15 | | - * @param {string} dataValueType |
16 | | - * |
17 | | - * @throws {Error} if data type id is not provided as a string. |
18 | | - * @throws {Error} if data value type is not provided as a string. |
19 | | - */ |
20 | | -var SELF = dt.DataType = function DtDataType( dataTypeId, dataValueType ) { |
21 | | - if ( !dataTypeId || typeof dataTypeId !== 'string' ) { |
22 | | - throw new Error( 'A data type\'s ID has to be a string' ); |
23 | | - } |
| 4 | + /** |
| 5 | + * Base constructor for objects representing a data type. |
| 6 | + * @class dataTypes.DataType |
| 7 | + * @abstract |
| 8 | + * @since 0.1 |
| 9 | + * @license GPL-2.0+ |
| 10 | + * @author Daniel Werner |
| 11 | + * @author H. Snater < mediawiki@snater.com > |
| 12 | + * |
| 13 | + * @constructor |
| 14 | + * @param {string} dataTypeId |
| 15 | + * @param {string} dataValueType |
| 16 | + * |
| 17 | + * @throws {Error} if data type id is not provided as a string. |
| 18 | + * @throws {Error} if data value type is not provided as a string. |
| 19 | + */ |
| 20 | + var SELF = dt.DataType = function DtDataType( dataTypeId, dataValueType ) { |
| 21 | + if ( !dataTypeId || typeof dataTypeId !== 'string' ) { |
| 22 | + throw new Error( 'A data type\'s ID has to be a string' ); |
| 23 | + } |
24 | 24 |
|
25 | | - if ( typeof dataValueType !== 'string' ) { |
26 | | - throw new Error( 'A data value type has to be given in form of a string' ); |
27 | | - } |
| 25 | + if ( typeof dataValueType !== 'string' ) { |
| 26 | + throw new Error( 'A data value type has to be given in form of a string' ); |
| 27 | + } |
28 | 28 |
|
29 | | - this._id = dataTypeId; |
30 | | - this._dataValueType = dataValueType; |
31 | | -}; |
| 29 | + this._id = dataTypeId; |
| 30 | + this._dataValueType = dataValueType; |
| 31 | + }; |
32 | 32 |
|
33 | | -$.extend( SELF.prototype, { |
34 | | - /** |
35 | | - * DataType identifier. |
36 | | - * @property {string} |
37 | | - * @private |
38 | | - */ |
39 | | - _id: null, |
| 33 | + $.extend( SELF.prototype, { |
| 34 | + /** |
| 35 | + * DataType identifier. |
| 36 | + * @property {string} |
| 37 | + * @private |
| 38 | + */ |
| 39 | + _id: null, |
40 | 40 |
|
41 | | - /** |
42 | | - * DataValue identifier. |
43 | | - * @property {string} |
44 | | - * @private |
45 | | - */ |
46 | | - _dataValueType: null, |
| 41 | + /** |
| 42 | + * DataValue identifier. |
| 43 | + * @property {string} |
| 44 | + * @private |
| 45 | + */ |
| 46 | + _dataValueType: null, |
47 | 47 |
|
48 | | - /** |
49 | | - * Returns the data type's identifier. |
50 | | - * |
51 | | - * @return {string} |
52 | | - */ |
53 | | - getId: function() { |
54 | | - return this._id; |
55 | | - }, |
| 48 | + /** |
| 49 | + * Returns the data type's identifier. |
| 50 | + * |
| 51 | + * @return {string} |
| 52 | + */ |
| 53 | + getId: function () { |
| 54 | + return this._id; |
| 55 | + }, |
| 56 | + |
| 57 | + /** |
| 58 | + * Returns the DataValue used by this data type. |
| 59 | + * |
| 60 | + * @return {string} |
| 61 | + */ |
| 62 | + getDataValueType: function () { |
| 63 | + return this._dataValueType; |
| 64 | + } |
| 65 | + } ); |
56 | 66 |
|
57 | 67 | /** |
58 | | - * Returns the DataValue used by this data type. |
| 68 | + * Creates a new DataType object from a given JSON structure. |
| 69 | + * @static |
59 | 70 | * |
60 | | - * @return {string} |
| 71 | + * @param {string} dataTypeId |
| 72 | + * @param {Object} json |
| 73 | + * @return {dataTypes.DataType} |
61 | 74 | */ |
62 | | - getDataValueType: function() { |
63 | | - return this._dataValueType; |
64 | | - } |
65 | | -} ); |
66 | | - |
67 | | -/** |
68 | | - * Creates a new DataType object from a given JSON structure. |
69 | | - * @static |
70 | | - * |
71 | | - * @param {string} dataTypeId |
72 | | - * @param {Object} json |
73 | | - * @return {dataTypes.DataType} |
74 | | - */ |
75 | | -SELF.newFromJSON = function( dataTypeId, json ) { |
76 | | - return new SELF( dataTypeId, json.dataValueType ); |
77 | | -}; |
| 75 | + SELF.newFromJSON = function ( dataTypeId, json ) { |
| 76 | + return new SELF( dataTypeId, json.dataValueType ); |
| 77 | + }; |
78 | 78 |
|
79 | 79 | }( jQuery, dataTypes ) ); |
0 commit comments