@qubit-ltd/common-decorator 3.8.9
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.
- package/LICENSE +201 -0
- package/README.md +1156 -0
- package/README.zh_CN.md +929 -0
- package/dist/common-decorator.cjs +6818 -0
- package/dist/common-decorator.cjs.map +1 -0
- package/dist/common-decorator.min.cjs +1 -0
- package/dist/common-decorator.min.cjs.map +1 -0
- package/dist/common-decorator.min.mjs +1 -0
- package/dist/common-decorator.min.mjs.map +1 -0
- package/dist/common-decorator.mjs +6792 -0
- package/dist/common-decorator.mjs.map +1 -0
- package/doc/api/DefaultAssignmentOptions.html +678 -0
- package/doc/api/DefaultOptions.html +954 -0
- package/doc/api/DefaultToJsonOptions.html +633 -0
- package/doc/api/Enum.html +1848 -0
- package/doc/api/Model.html +3607 -0
- package/doc/api/Page.html +1105 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Light-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Light-webfont.svg +1839 -0
- package/doc/api/fonts/OpenSans-Light-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.svg +1843 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.svg +1839 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/doc/api/global.html +6049 -0
- package/doc/api/index.html +1325 -0
- package/doc/api/scripts/linenumber.js +34 -0
- package/doc/api/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/doc/api/scripts/prettify/lang-css.js +2 -0
- package/doc/api/scripts/prettify/prettify.js +28 -0
- package/doc/api/styles/jsdoc-default.css +699 -0
- package/doc/api/styles/prettify-jsdoc.css +120 -0
- package/doc/api/styles/prettify-tomorrow.css +141 -0
- package/doc/common-decorator.min.visualization.html +4949 -0
- package/doc/common-decorator.visualization.html +4949 -0
- package/package.json +107 -0
|
@@ -0,0 +1,3607 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>Model - Documentation</title>
|
|
7
|
+
|
|
8
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
9
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
10
|
+
<!--[if lt IE 9]>
|
|
11
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
|
12
|
+
<![endif]-->
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
|
|
19
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
20
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
21
|
+
<div class="navicon"></div>
|
|
22
|
+
</label>
|
|
23
|
+
|
|
24
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
25
|
+
|
|
26
|
+
<nav>
|
|
27
|
+
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="DefaultAssignmentOptions.html">DefaultAssignmentOptions</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="DefaultOptions.html">DefaultOptions</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DefaultOptions.html#.get">get</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DefaultOptions.html#.merge">merge</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DefaultOptions.html#.reset">reset</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="DefaultOptions.html#.set">set</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="DefaultToJsonOptions.html">DefaultToJsonOptions</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Page.html">Page</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Page.html#assign">assign</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Page.html#.getFrom">getFrom</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Page.html#.newEmpty">newEmpty</a></span></li><li class="nav-heading">Namespaces</li><li class="nav-heading"><span class="nav-item-type type-namespace">N</span><span class="nav-item-name"><a href="Enum.html">Enum</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.has">Class.has</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.hasCode">Class.hasCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.hasName">Class.hasName</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.hasValue">Class.hasValue</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.of">Class.of</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.ofCode">Class.ofCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.ofName">Class.ofName</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.ofValue">Class.ofValue</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Enum.html#.Class.values">Class.values</a></span></li><li class="nav-heading"><span class="nav-item-type type-namespace">N</span><span class="nav-item-name"><a href="Model.html">Model</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#assign">assign</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#clear">clear</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#clone">clone</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#equals">equals</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#generateId">generateId</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#isEmpty">isEmpty</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#normalize">normalize</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#normalizeField">normalizeField</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#toJSON">toJSON</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#toJsonString">toJsonString</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#validate">validate</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#validateField">validateField</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#.Class.create">Class.create</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#.Class.createArray">Class.createArray</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#.Class.createPage">Class.createPage</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#.Class.isNullishOrEmpty">Class.isNullishOrEmpty</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Model.html#.Class.parseJsonString">Class.parseJsonString</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#ElementType">ElementType</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Enumerable">Enumerable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Label">Label</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#NameField">NameField</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#NonEmpty">NonEmpty</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#NonEnumerable">NonEnumerable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Normalizable">Normalizable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Nullable">Nullable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Payload">Payload</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Readonly">Readonly</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Timeout">Timeout</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Type">Type</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Validatable">Validatable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#assign">assign</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#create">create</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#createArray">createArray</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#createPage">createPage</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#defaultNormalizer">defaultNormalizer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#defaultValidator">defaultValidator</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#enumNormalizer">enumNormalizer</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isEnumClass">isEnumClass</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isEnumerator">isEnumerator</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#isValidPageSource">isValidPageSource</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#normalize">normalize</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#stringifyId">stringifyId</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#toJSON">toJSON</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#toJsonString">toJsonString</a></span></li>
|
|
28
|
+
</nav>
|
|
29
|
+
|
|
30
|
+
<div id="main">
|
|
31
|
+
|
|
32
|
+
<h1 class="page-title">Model</h1>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<section>
|
|
41
|
+
|
|
42
|
+
<header>
|
|
43
|
+
|
|
44
|
+
<h2>
|
|
45
|
+
Model
|
|
46
|
+
</h2>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</header>
|
|
50
|
+
|
|
51
|
+
<article>
|
|
52
|
+
<div class="container-overview">
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<div class="description"><p>This decorator is used to add common methods to a domain model class.</p>
|
|
56
|
+
<p>It must decorate a class.</p>
|
|
57
|
+
<p>It adds the following methods to the decorated class:</p>
|
|
58
|
+
<ul>
|
|
59
|
+
<li>Instance method <code>assign(obj, options)</code>: Copies the properties of the object
|
|
60
|
+
<code>obj</code> to this object, only copying properties defined in the class of this
|
|
61
|
+
object. If a property in the <code>obj</code> object is <code>undefined</code> or <code>null</code>, it sets
|
|
62
|
+
the property of this object to the default value. The function returns this
|
|
63
|
+
object itself. Note that <code>obj</code> can have a different prototype than this object.
|
|
64
|
+
The <code>options</code> parameter is the additional options for the assignment.
|
|
65
|
+
Available options will be explained below. If the <code>options</code> parameter is
|
|
66
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
67
|
+
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.</li>
|
|
68
|
+
<li>Instance method <code>clear()</code>: Sets all the properties of this object to their
|
|
69
|
+
default values.</li>
|
|
70
|
+
<li>Instance method <code>clone()</code>: Returns a deep clone of this object.</li>
|
|
71
|
+
<li>Instance method <code>isEmpty()</code>: Checks if this object is empty, meaning that all
|
|
72
|
+
of its properties have default values.</li>
|
|
73
|
+
<li>Instance method <code>equals(obj)</code>: Determines if this object is deeply equal
|
|
74
|
+
to <code>obj</code>.</li>
|
|
75
|
+
<li>Instance method <code>normalize(fields)</code>: Normalizes specified fields of this
|
|
76
|
+
object. The <code>fields</code> parameter specifies the names of fields to be normalized.
|
|
77
|
+
If <code>fields</code> is <code>undefined</code>, <code>null</code>, or the string <code>"*"</code>, it normalizes all
|
|
78
|
+
the fields that can be normalized for this object. If <code>fields</code> is an array of
|
|
79
|
+
strings, it normalizes all the fields specified in the array. Note that a
|
|
80
|
+
field is normalizable if and only if it is decorated with the
|
|
81
|
+
<code>@<a href="global.html#Normalizable">Normalizable</a></code> decorator.</li>
|
|
82
|
+
<li>Instance method <code>normalizeField(field)</code>: Normalizes the specified field of
|
|
83
|
+
this object. The <code>field</code> parameter specifies the name of the field to be
|
|
84
|
+
normalized. If the specified exists and is normalizable, the function
|
|
85
|
+
normalizes it and returns <code>true</code>; otherwise, the function does nothing and
|
|
86
|
+
returns <code>false</code>.</li>
|
|
87
|
+
<li>Instance method <code>validate(fields, options)</code>: Validates the specified fields of
|
|
88
|
+
this object. The <code>fields</code> parameter is the names of the fields to be validated.
|
|
89
|
+
If <code>fields</code> is <code>undefined</code>, <code>null</code>, or the string <code>"*"</code>, it validates all the
|
|
90
|
+
fields that can be validated for this object. If <code>fields</code> is an array of
|
|
91
|
+
strings, it validates all the fields specified in the array. Note that a field
|
|
92
|
+
must be specified as validatable using the <code>@<a href="global.html#Validatable">Validatable</a></code> decorator.
|
|
93
|
+
The <code>options</code> parameter is an object comprising additional parameters, and its
|
|
94
|
+
property values are passed as the second argument to the validation function.
|
|
95
|
+
Refer to the documentation of <code>@<a href="global.html#Validatable">Validatable</a></code> for more details.</li>
|
|
96
|
+
<li>Instance method <code>generateId()</code>: If the decorated class defines a property
|
|
97
|
+
named <code>id</code>, this decorator automatically adds a <code>generateId()</code> instance method.
|
|
98
|
+
Each call to this method generates a globally unique ID (represented as an
|
|
99
|
+
integer) for the class of this object, sets it to this object and returns
|
|
100
|
+
the generated ID. Note that if a parent class <code>A</code> defines the <code>id</code> field,
|
|
101
|
+
and a subclass <code>B</code> inherits the <code>id</code> field but does not define its own
|
|
102
|
+
<code>id</code> field, the <code>generateId()</code> method is only added to class <code>A</code>, not to
|
|
103
|
+
class <code>B</code>.</li>
|
|
104
|
+
<li>Static class method <code>create(obj, options)</code>: Creates a new instance object
|
|
105
|
+
based on the <code>obj</code> object. It copies the property values from the corresponding
|
|
106
|
+
properties of <code>obj</code>, maintaining the same prototype and class definition. This
|
|
107
|
+
method is used to transform a plain JSON object into the specified domain
|
|
108
|
+
object. The <code>options</code> parameter is the additional options for the creation,
|
|
109
|
+
which is the same as the <code>options</code> parameter of the <code>create()</code> method.</li>
|
|
110
|
+
<li>Static class method <code>createArray(array, options)</code>: Creates a new instance
|
|
111
|
+
array based on an object array <code>array</code>, where each element's property values
|
|
112
|
+
are copied from the corresponding elements in <code>array</code>, maintaining the same
|
|
113
|
+
prototype and class definition. This method is used to transform an array of
|
|
114
|
+
plain JSON objects into an array of specified domain objects. The <code>options</code>
|
|
115
|
+
parameter is the additional options for the creation, which is the same
|
|
116
|
+
as the <code>options</code> parameter of the <code>create()</code> method.</li>
|
|
117
|
+
<li>Static class method <code>createPage(page, options)</code>: Creates a new page object
|
|
118
|
+
based on a <code>page</code> pagination object. Typically, <code>page</code> is a list of domain
|
|
119
|
+
objects obtained from a server using the GET method, and the object should
|
|
120
|
+
conform to the <code><a href="Page.html">Page</a></code> class definition. This static class method
|
|
121
|
+
returns a new <code><a href="Page.html">Page</a></code> object, with the <code>content</code> property being the
|
|
122
|
+
result of <code>createArray(page.content, options)</code>, and the other properties
|
|
123
|
+
matching those of the <code>page</code> object. If the input is not a valid
|
|
124
|
+
<code><a href="Page.html">Page</a></code> object, it returns <code>null</code>. The <code>options</code> parameter is the
|
|
125
|
+
additional options for the creation, which is the same as the <code>options</code>
|
|
126
|
+
parameter of the <code>create()</code> method.</li>
|
|
127
|
+
<li>Static class method <code>isNullishOrEmpty(obj)</code>: Determines if the given instance
|
|
128
|
+
is <code>undefined</code>, <code>null</code>, or an empty object constructed with default values.</li>
|
|
129
|
+
</ul>
|
|
130
|
+
<p><strong>NOTE:</strong> If the decorated class already implements any of the above methods,
|
|
131
|
+
this decorator will not override the methods already implemented by the
|
|
132
|
+
decorated class.</p>
|
|
133
|
+
<h5>Usage example:</h5>
|
|
134
|
+
<pre class="prettyprint source lang-js"><code>@Model
|
|
135
|
+
class Credential {
|
|
136
|
+
|
|
137
|
+
@Normalizable
|
|
138
|
+
@Validator(validateCredentialTypeField)
|
|
139
|
+
@Type(CredentialType)
|
|
140
|
+
@Label('证件类型')
|
|
141
|
+
type = CredentialType.IDENTITY_CARD;
|
|
142
|
+
|
|
143
|
+
@Normalizable(trimUppercaseString)
|
|
144
|
+
@Validator(validateCredentialNumberField)
|
|
145
|
+
@Label('证件号码')
|
|
146
|
+
number = '';
|
|
147
|
+
|
|
148
|
+
constructor(type = CredentialType.DEFAULT.value, number = '') {
|
|
149
|
+
this.type = type;
|
|
150
|
+
this.number = number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
isIdentityCard() {
|
|
154
|
+
return (this.type === 'IDENTITY_CARD');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@Model
|
|
159
|
+
class Person {
|
|
160
|
+
|
|
161
|
+
@Normalizable(trimString)
|
|
162
|
+
@Label('ID')
|
|
163
|
+
id = null;
|
|
164
|
+
|
|
165
|
+
@Normalizable(trimUppercaseString)
|
|
166
|
+
@Validatable(validatePersonNameField)
|
|
167
|
+
@Label('姓名')
|
|
168
|
+
name = '';
|
|
169
|
+
|
|
170
|
+
@Normalizable
|
|
171
|
+
@DefaultValidator
|
|
172
|
+
@Type(Credential)
|
|
173
|
+
@Label('证件')
|
|
174
|
+
credential = null;
|
|
175
|
+
|
|
176
|
+
@Normalizable
|
|
177
|
+
@Validatable(validatePersonGenderField)
|
|
178
|
+
@Type(Gender)
|
|
179
|
+
@Label('性别')
|
|
180
|
+
gender = '';
|
|
181
|
+
|
|
182
|
+
@Normalizable(trimString)
|
|
183
|
+
@Validatable(validatePersonBirthdayField)
|
|
184
|
+
@Label('出生日期')
|
|
185
|
+
birthday = '';
|
|
186
|
+
|
|
187
|
+
@Normalizable(trimUppercaseString)
|
|
188
|
+
@Validatable(validateMobileField)
|
|
189
|
+
@Label('手机号码')
|
|
190
|
+
mobile = '';
|
|
191
|
+
|
|
192
|
+
@Normalizable(trimString)
|
|
193
|
+
@Validatable(validateEmailField)
|
|
194
|
+
@Label('电子邮件地址')
|
|
195
|
+
@Nullable
|
|
196
|
+
email = '';
|
|
197
|
+
|
|
198
|
+
equals(other) {
|
|
199
|
+
if (!(other instanceof PersonWithEquals)) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
if ((this.credential === null) || (other.credential === null)) {
|
|
203
|
+
// If one of the two people does not have an ID information, it is
|
|
204
|
+
// impossible to compare whether they are the same person thus they
|
|
205
|
+
// will be considered different.
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
// Two persons are logically equals if and only if they have the same
|
|
209
|
+
// credential.
|
|
210
|
+
return (this.credential.type === other.credential.type)
|
|
211
|
+
&& (this.credential.number === other.credential.number);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
</code></pre>
|
|
215
|
+
<p>After applying the <code>@Model</code> decorator, the following methods will be
|
|
216
|
+
automatically added:</p>
|
|
217
|
+
<ul>
|
|
218
|
+
<li><code>Credential.prototype.assign(obj, options = undefined)</code></li>
|
|
219
|
+
<li><code>Credential.prototype.clear()</code></li>
|
|
220
|
+
<li><code>Credential.prototype.clone()</code></li>
|
|
221
|
+
<li><code>Credential.prototype.isEmpty()</code></li>
|
|
222
|
+
<li><code>Credential.prototype.equals(obj)</code></li>
|
|
223
|
+
<li><code>Credential.prototype.normalize(fields)</code></li>
|
|
224
|
+
<li><code>Credential.prototype.validate(fields, options)</code></li>
|
|
225
|
+
<li><code>Credential.prototype.toJSON(key, options = undefined)</code></li>
|
|
226
|
+
<li><code>Credential.prototype.toJsonString(options = undefined)</code></li>
|
|
227
|
+
<li><code>Credential.create(obj, options = undefined)</code></li>
|
|
228
|
+
<li><code>Credential.createArray(array, options = undefined)</code></li>
|
|
229
|
+
<li><code>Credential.createPage(page, options = undefined)</code></li>
|
|
230
|
+
<li><code>Credential.isNullishOrEmpty(obj)</code></li>
|
|
231
|
+
<li><code>Credential.parseJsonString(json, options = undefined)</code></li>
|
|
232
|
+
<li><code>Person.prototype.assign(obj, normalized)</code></li>
|
|
233
|
+
<li><code>Person.prototype.clear()</code></li>
|
|
234
|
+
<li><code>Person.prototype.clone()</code></li>
|
|
235
|
+
<li><code>Person.prototype.isEmpty()</code></li>
|
|
236
|
+
<li><code>Person.prototype.normalize(fields)</code></li>
|
|
237
|
+
<li><code>Person.prototype.validate(fields, options)</code></li>
|
|
238
|
+
<li><code>Person.prototype.generateId()</code></li>
|
|
239
|
+
<li><code>Person.prototype.toJSON(key, options = undefined)</code></li>
|
|
240
|
+
<li><code>Person.prototype.toJsonString(options = undefined)</code></li>
|
|
241
|
+
<li><code>Person.create(obj, options = undefined)</code></li>
|
|
242
|
+
<li><code>Person.createArray(array, options = undefined)</code></li>
|
|
243
|
+
<li><code>Person.createPage(page, options = undefined)</code></li>
|
|
244
|
+
<li><code>Person.isNullishOrEmpty(obj)</code></li>
|
|
245
|
+
<li><code>Person.parseJsonString(json, options = undefined)</code></li>
|
|
246
|
+
</ul>
|
|
247
|
+
<p><strong>NOTE:</strong></p>
|
|
248
|
+
<ul>
|
|
249
|
+
<li>Because the <code>Credential</code> class does not have an <code>id</code> attribute, the <code>@Model</code>
|
|
250
|
+
decorator does not add a <code>generateId()</code> instance method to it.</li>
|
|
251
|
+
<li>Because <code>Person</code> already implements the <code>Person.prototype.equals()</code> method,
|
|
252
|
+
the <code>@Model</code> decorator will <strong>not</strong> override its own implementation of
|
|
253
|
+
the <code>Person.prototype.equals()</code> method.</li>
|
|
254
|
+
</ul></div>
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<dl class="details">
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
<dt class="tag-author">Author:</dt>
|
|
280
|
+
<dd class="tag-author">
|
|
281
|
+
<ul>
|
|
282
|
+
<li>Haixing Hu</li>
|
|
283
|
+
</ul>
|
|
284
|
+
</dd>
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
<dt class="tag-see">See:</dt>
|
|
299
|
+
<dd class="tag-see">
|
|
300
|
+
<ul>
|
|
301
|
+
<li><a href="global.html#Type">Type</a></li>
|
|
302
|
+
|
|
303
|
+
<li><a href="global.html#ElementType">ElementType</a></li>
|
|
304
|
+
|
|
305
|
+
<li><a href="global.html#Nullable">Nullable</a></li>
|
|
306
|
+
|
|
307
|
+
<li><a href="global.html#Label">Label</a></li>
|
|
308
|
+
|
|
309
|
+
<li><a href="global.html#NameField">NameField</a></li>
|
|
310
|
+
|
|
311
|
+
<li><a href="global.html#Normalizable">Normalizable</a></li>
|
|
312
|
+
|
|
313
|
+
<li><a href="global.html#Validatable">Validatable</a></li>
|
|
314
|
+
|
|
315
|
+
<li>ValidationResult</li>
|
|
316
|
+
|
|
317
|
+
<li>DefaultOptions.get('assign')</li>
|
|
318
|
+
|
|
319
|
+
<li>DefaultOptions.get('toJSON')</li>
|
|
320
|
+
</ul>
|
|
321
|
+
</dd>
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
</dl>
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
</div>
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
<h3 class="subsection-title">Methods</h3>
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
<div class="section-method">
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
<h4 class="name" id="assign"><span class="type-signature"></span>assign<span class="signature">(obj, options)</span><span class="type-signature"> → {object}</span></h4>
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
<div class="description">
|
|
362
|
+
<p>Copies the properties from a specified data object to this object, only
|
|
363
|
+
copying properties defined in the class of this object.</p>
|
|
364
|
+
<p>If a property in the data object is <code>undefined</code> or <code>null</code>, the function
|
|
365
|
+
sets the property of this object to the default value.</p>
|
|
366
|
+
<p>Note that the data object may have a different prototype than this object.</p>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
<dl class="details">
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
<dt class="tag-see">See:</dt>
|
|
405
|
+
<dd class="tag-see">
|
|
406
|
+
<ul>
|
|
407
|
+
<li>DefaultOptions.get('assign')</li>
|
|
408
|
+
</ul>
|
|
409
|
+
</dd>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
</dl>
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
<h5>Parameters:</h5>
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
<table class="params">
|
|
427
|
+
<thead>
|
|
428
|
+
<tr>
|
|
429
|
+
|
|
430
|
+
<th>Name</th>
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
<th>Type</th>
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<th class="last">Description</th>
|
|
440
|
+
</tr>
|
|
441
|
+
</thead>
|
|
442
|
+
|
|
443
|
+
<tbody>
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
<tr>
|
|
447
|
+
|
|
448
|
+
<td class="name"><code>obj</code></td>
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
<td class="type">
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
<span class="param-type"><code>object</code></span>
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
</td>
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
<td class="description last">
|
|
465
|
+
<p>the data object, which may have a different prototype than this object.</p>
|
|
466
|
+
|
|
467
|
+
</td>
|
|
468
|
+
</tr>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
<tr>
|
|
473
|
+
|
|
474
|
+
<td class="name"><code>options</code></td>
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
<td class="type">
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
<span class="param-type"><code>null</code></span>
|
|
481
|
+
|
|
|
482
|
+
|
|
483
|
+
<span class="param-type"><code>undefined</code></span>
|
|
484
|
+
|
|
|
485
|
+
|
|
486
|
+
<span class="param-type"><code>object</code></span>
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
</td>
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
<td class="description last">
|
|
497
|
+
<p>the additional options for the assignment. If this argument is
|
|
498
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
499
|
+
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.
|
|
500
|
+
Available options are:</p>
|
|
501
|
+
<ul>
|
|
502
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
503
|
+
after the assignment. The default value is <code>true</code>.</li>
|
|
504
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
505
|
+
style of the target object. The default value is <code>false</code>.</li>
|
|
506
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
507
|
+
i.e., the first argument of the <code>assign()</code> method. The default value
|
|
508
|
+
of this argument is <code>'LOWER_UNDERSCORE'</code>.</li>
|
|
509
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
510
|
+
i.e., the object calling the <code>assign()</code> method. The default value
|
|
511
|
+
of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
512
|
+
<li><code>types: object</code>, the additional information about types of
|
|
513
|
+
fields of classes. The keys of this object are the path of the fields
|
|
514
|
+
or sub-fields of the target object, the values are the type of the
|
|
515
|
+
fields, represented as the constructor function of the type.
|
|
516
|
+
The default value is <code>{}</code>.</li>
|
|
517
|
+
<li><code>elementTypes: object</code>, the additional information about types of
|
|
518
|
+
elements of fields of classes. The keys of this object are the path of
|
|
519
|
+
the fields or sub-fields of the target object, the values are the type
|
|
520
|
+
of the elements, represented as the constructor function of the type.
|
|
521
|
+
The default value is <code>{}</code>.</li>
|
|
522
|
+
</ul>
|
|
523
|
+
|
|
524
|
+
</td>
|
|
525
|
+
</tr>
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
</tbody>
|
|
529
|
+
</table>
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
<div class="section-returns">
|
|
547
|
+
<h5>Returns:</h5>
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
<dl class="param-type">
|
|
552
|
+
<dt>
|
|
553
|
+
Type:
|
|
554
|
+
</dt>
|
|
555
|
+
<dd>
|
|
556
|
+
|
|
557
|
+
<span class="param-type"><code>object</code></span>
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
</dd>
|
|
561
|
+
</dl>
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
<div class="param-desc">
|
|
565
|
+
<p>the reference to this object.</p>
|
|
566
|
+
</div>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
</div>
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
</div>
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
<div class="section-method">
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"> → {object}</span></h4>
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
<div class="description">
|
|
591
|
+
<p>Sets all the properties of this object to their default values.</p>
|
|
592
|
+
</div>
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
<dl class="details">
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
</dl>
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
<div class="section-returns">
|
|
656
|
+
<h5>Returns:</h5>
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
<dl class="param-type">
|
|
661
|
+
<dt>
|
|
662
|
+
Type:
|
|
663
|
+
</dt>
|
|
664
|
+
<dd>
|
|
665
|
+
|
|
666
|
+
<span class="param-type"><code>object</code></span>
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
</dd>
|
|
670
|
+
</dl>
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
<div class="param-desc">
|
|
674
|
+
<p>the reference to this object.</p>
|
|
675
|
+
</div>
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
</div>
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
</div>
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
<div class="section-method">
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
<h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">()</span><span class="type-signature"> → {object}</span></h4>
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
<div class="description">
|
|
700
|
+
<p>Clones this object.</p>
|
|
701
|
+
</div>
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
<dl class="details">
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
</dl>
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
<div class="section-returns">
|
|
765
|
+
<h5>Returns:</h5>
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
<dl class="param-type">
|
|
770
|
+
<dt>
|
|
771
|
+
Type:
|
|
772
|
+
</dt>
|
|
773
|
+
<dd>
|
|
774
|
+
|
|
775
|
+
<span class="param-type"><code>object</code></span>
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
</dd>
|
|
779
|
+
</dl>
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
<div class="param-desc">
|
|
783
|
+
<p>the cloned copy of this object.</p>
|
|
784
|
+
</div>
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
</div>
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
</div>
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
<div class="section-method">
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
<h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">(obj)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
<div class="description">
|
|
809
|
+
<p>Determines whether this object is deeply equal to the other object.</p>
|
|
810
|
+
</div>
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
<dl class="details">
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
</dl>
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
<h5>Parameters:</h5>
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
<table class="params">
|
|
863
|
+
<thead>
|
|
864
|
+
<tr>
|
|
865
|
+
|
|
866
|
+
<th>Name</th>
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
<th>Type</th>
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
<th class="last">Description</th>
|
|
876
|
+
</tr>
|
|
877
|
+
</thead>
|
|
878
|
+
|
|
879
|
+
<tbody>
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
<tr>
|
|
883
|
+
|
|
884
|
+
<td class="name"><code>obj</code></td>
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
<td class="type">
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
<span class="param-type"><code>object</code></span>
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
</td>
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
<td class="description last">
|
|
901
|
+
<p>the other object.</p>
|
|
902
|
+
|
|
903
|
+
</td>
|
|
904
|
+
</tr>
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
</tbody>
|
|
908
|
+
</table>
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
<div class="section-returns">
|
|
926
|
+
<h5>Returns:</h5>
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
<dl class="param-type">
|
|
931
|
+
<dt>
|
|
932
|
+
Type:
|
|
933
|
+
</dt>
|
|
934
|
+
<dd>
|
|
935
|
+
|
|
936
|
+
<span class="param-type"><code>boolean</code></span>
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
</dd>
|
|
940
|
+
</dl>
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
<div class="param-desc">
|
|
944
|
+
<p><code>true</code> if this object is deeply equal to the other object; <code>false</code>
|
|
945
|
+
otherwise.</p>
|
|
946
|
+
</div>
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
</div>
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
</div>
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
<div class="section-method">
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
<h4 class="name" id="generateId"><span class="type-signature"></span>generateId<span class="signature">()</span><span class="type-signature"> → {number}</span></h4>
|
|
964
|
+
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
<div class="description">
|
|
971
|
+
<p>Generates the next unique identifier for instances of this class and set
|
|
972
|
+
it to this object.</p>
|
|
973
|
+
<p>Each call to this method generates a globally unique ID (represented as
|
|
974
|
+
an integer) for the class of this object, sets it to this object and
|
|
975
|
+
returns the generated ID.</p>
|
|
976
|
+
<p>Note hat if a parent class <code>A</code> defines the <code>id</code> field, and a subclass <code>B</code>
|
|
977
|
+
inherits the <code>id</code> field but does not define its own <code>id</code> field, the
|
|
978
|
+
<code>generateId()</code> method is only added to class <code>A</code>, not to class <code>B</code>.</p>
|
|
979
|
+
</div>
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
<dl class="details">
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
|
|
1018
|
+
</dl>
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
<div class="section-returns">
|
|
1043
|
+
<h5>Returns:</h5>
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
<dl class="param-type">
|
|
1048
|
+
<dt>
|
|
1049
|
+
Type:
|
|
1050
|
+
</dt>
|
|
1051
|
+
<dd>
|
|
1052
|
+
|
|
1053
|
+
<span class="param-type"><code>number</code></span>
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
</dd>
|
|
1057
|
+
</dl>
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
<div class="param-desc">
|
|
1061
|
+
<p>the generated unique ID.</p>
|
|
1062
|
+
</div>
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
</div>
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
</div>
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
<div class="section-method">
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
<h4 class="name" id="isEmpty"><span class="type-signature"></span>isEmpty<span class="signature">()</span><span class="type-signature"> → {boolean}</span></h4>
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
<div class="description">
|
|
1087
|
+
<p>Checks whether this object is empty, i.e., whether all of its properties
|
|
1088
|
+
have default values.</p>
|
|
1089
|
+
</div>
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
<dl class="details">
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
</dl>
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
<div class="section-returns">
|
|
1153
|
+
<h5>Returns:</h5>
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
<dl class="param-type">
|
|
1158
|
+
<dt>
|
|
1159
|
+
Type:
|
|
1160
|
+
</dt>
|
|
1161
|
+
<dd>
|
|
1162
|
+
|
|
1163
|
+
<span class="param-type"><code>boolean</code></span>
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
</dd>
|
|
1167
|
+
</dl>
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
<div class="param-desc">
|
|
1171
|
+
<p><code>true</code> if this object is empty; <code>false</code> otherwise.</p>
|
|
1172
|
+
</div>
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
</div>
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
</div>
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
<div class="section-method">
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
<h4 class="name" id="normalize"><span class="type-signature"></span>normalize<span class="signature">(fields, options)</span><span class="type-signature"> → {object}</span></h4>
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
<div class="description">
|
|
1197
|
+
<p>Normalizes all normalizable fields or specified normalizable fields of
|
|
1198
|
+
this object.</p>
|
|
1199
|
+
<p>A field is normalizable if and only if it is decorated with the
|
|
1200
|
+
<code>@<a href="global.html#Normalizable">Normalizable</a></code> decorator.</p>
|
|
1201
|
+
</div>
|
|
1202
|
+
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
<dl class="details">
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
</dl>
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
<h5>Parameters:</h5>
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
<table class="params">
|
|
1254
|
+
<thead>
|
|
1255
|
+
<tr>
|
|
1256
|
+
|
|
1257
|
+
<th>Name</th>
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
<th>Type</th>
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
<th class="last">Description</th>
|
|
1267
|
+
</tr>
|
|
1268
|
+
</thead>
|
|
1269
|
+
|
|
1270
|
+
<tbody>
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
<tr>
|
|
1274
|
+
|
|
1275
|
+
<td class="name"><code>fields</code></td>
|
|
1276
|
+
|
|
1277
|
+
|
|
1278
|
+
<td class="type">
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
<span class="param-type"><code>undefined</code></span>
|
|
1282
|
+
|
|
|
1283
|
+
|
|
1284
|
+
<span class="param-type"><code>string</code></span>
|
|
1285
|
+
|
|
|
1286
|
+
|
|
1287
|
+
<span class="param-type"><code>array</code></span>
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
</td>
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
<td class="description last">
|
|
1298
|
+
<p>the names of fields to be normalized. If this argument is not specified,
|
|
1299
|
+
or <code>undefined</code>, or <code>null</code>, or a string <code>'*'</code>, this function normalizes
|
|
1300
|
+
all normalizable fields of this object; If this argument is an array of
|
|
1301
|
+
strings, this function normalizes all normalizable fields specified
|
|
1302
|
+
in the array. If this argument is a string other than <code>'*'</code>, this
|
|
1303
|
+
function normalizes the field with the name equals to this argument;
|
|
1304
|
+
if the specified field does not exist nor non-normalizable, this
|
|
1305
|
+
function does nothing.</p>
|
|
1306
|
+
|
|
1307
|
+
</td>
|
|
1308
|
+
</tr>
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
<tr>
|
|
1313
|
+
|
|
1314
|
+
<td class="name"><code>options</code></td>
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
<td class="type">
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
<span class="param-type"><code>object</code></span>
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
</td>
|
|
1325
|
+
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
<td class="description last">
|
|
1331
|
+
<p>The optional options for the normalization. Default value is an empty
|
|
1332
|
+
object. Currently, the following options are supported:</p>
|
|
1333
|
+
<ul>
|
|
1334
|
+
<li><code>path: string</code>, the path of the root object of this object.
|
|
1335
|
+
The default value of this option is <code>'.'</code>.</li>
|
|
1336
|
+
<li><code>types: object</code>, the additional information about types of fields
|
|
1337
|
+
of classes. The keys of this object are the path of the fields or
|
|
1338
|
+
sub-fields of this object, the values are the type of the fields,
|
|
1339
|
+
represented as the constructor function of the type. The path of
|
|
1340
|
+
the root of this object is an empty, therefore the path of the direct
|
|
1341
|
+
field of this object is of the form <code>'.field'</code>, and the
|
|
1342
|
+
path of the sub-field of a field is of the form <code>'.field.subField'</code>.
|
|
1343
|
+
The default value of this option is <code>{}</code>.</li>
|
|
1344
|
+
<li><code>elementTypes: object</code>, the additional information about types of
|
|
1345
|
+
elements of fields of classes. The keys of this object are the path of
|
|
1346
|
+
the fields or sub-fields of the target object, the values are the type
|
|
1347
|
+
of the elements, represented as the constructor function of the type.
|
|
1348
|
+
The default value of this option is <code>{}</code>.</li>
|
|
1349
|
+
</ul>
|
|
1350
|
+
|
|
1351
|
+
</td>
|
|
1352
|
+
</tr>
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
</tbody>
|
|
1356
|
+
</table>
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
<div class="section-returns">
|
|
1374
|
+
<h5>Returns:</h5>
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
|
|
1378
|
+
<dl class="param-type">
|
|
1379
|
+
<dt>
|
|
1380
|
+
Type:
|
|
1381
|
+
</dt>
|
|
1382
|
+
<dd>
|
|
1383
|
+
|
|
1384
|
+
<span class="param-type"><code>object</code></span>
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
</dd>
|
|
1388
|
+
</dl>
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
<div class="param-desc">
|
|
1392
|
+
<p>the reference to this object.</p>
|
|
1393
|
+
</div>
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
</div>
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
</div>
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
<div class="section-method">
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
<h4 class="name" id="normalizeField"><span class="type-signature"></span>normalizeField<span class="signature">(field, options)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
<div class="description">
|
|
1418
|
+
<p>Normalizes the specified normalizable fields of this object.</p>
|
|
1419
|
+
<p>A field is normalizable if and only if it is decorated with the
|
|
1420
|
+
<code>@<a href="global.html#Normalizable">Normalizable</a></code> decorator.</p>
|
|
1421
|
+
</div>
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
<dl class="details">
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
</dl>
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
|
|
1467
|
+
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
<h5>Parameters:</h5>
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
<table class="params">
|
|
1474
|
+
<thead>
|
|
1475
|
+
<tr>
|
|
1476
|
+
|
|
1477
|
+
<th>Name</th>
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
<th>Type</th>
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
<th class="last">Description</th>
|
|
1487
|
+
</tr>
|
|
1488
|
+
</thead>
|
|
1489
|
+
|
|
1490
|
+
<tbody>
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
<tr>
|
|
1494
|
+
|
|
1495
|
+
<td class="name"><code>field</code></td>
|
|
1496
|
+
|
|
1497
|
+
|
|
1498
|
+
<td class="type">
|
|
1499
|
+
|
|
1500
|
+
|
|
1501
|
+
<span class="param-type"><code>string</code></span>
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
</td>
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
<td class="description last">
|
|
1512
|
+
<p>the names of fields to be normalized. If the specified field does not
|
|
1513
|
+
exist nor non-normalizable, this function does nothing and returns
|
|
1514
|
+
<code>false</code>.</p>
|
|
1515
|
+
|
|
1516
|
+
</td>
|
|
1517
|
+
</tr>
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
<tr>
|
|
1522
|
+
|
|
1523
|
+
<td class="name"><code>options</code></td>
|
|
1524
|
+
|
|
1525
|
+
|
|
1526
|
+
<td class="type">
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
<span class="param-type"><code>object</code></span>
|
|
1530
|
+
|
|
1531
|
+
|
|
1532
|
+
|
|
1533
|
+
</td>
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
<td class="description last">
|
|
1540
|
+
<p>The optional options for the normalization. Default value is an empty
|
|
1541
|
+
object. Currently, the following options are supported:</p>
|
|
1542
|
+
<ul>
|
|
1543
|
+
<li><code>path: string</code>, the path of the root object of this object.
|
|
1544
|
+
The default value of this option is <code>'.'</code>.</li>
|
|
1545
|
+
<li><code>types: object</code>, the additional information about types of fields
|
|
1546
|
+
of classes. The keys of this object are the path of the fields or
|
|
1547
|
+
sub-fields of this object, the values are the type of the fields,
|
|
1548
|
+
represented as the constructor function of the type. The path of
|
|
1549
|
+
the root of this object is an empty, therefore the path of the direct
|
|
1550
|
+
field of this object is of the form <code>'.field'</code>, and the
|
|
1551
|
+
path of the sub-field of a field is of the form <code>'.field.subField'</code>.
|
|
1552
|
+
The default value of this option is <code>{}</code>.</li>
|
|
1553
|
+
<li><code>elementTypes: object</code>, the additional information about types of
|
|
1554
|
+
elements of fields of classes. The keys of this object are the path of
|
|
1555
|
+
the fields or sub-fields of the target object, the values are the type
|
|
1556
|
+
of the elements, represented as the constructor function of the type.
|
|
1557
|
+
The default value of this option is <code>{}</code>.</li>
|
|
1558
|
+
</ul>
|
|
1559
|
+
|
|
1560
|
+
</td>
|
|
1561
|
+
</tr>
|
|
1562
|
+
|
|
1563
|
+
|
|
1564
|
+
</tbody>
|
|
1565
|
+
</table>
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
|
|
1569
|
+
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
<div class="section-returns">
|
|
1583
|
+
<h5>Returns:</h5>
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
<dl class="param-type">
|
|
1588
|
+
<dt>
|
|
1589
|
+
Type:
|
|
1590
|
+
</dt>
|
|
1591
|
+
<dd>
|
|
1592
|
+
|
|
1593
|
+
<span class="param-type"><code>boolean</code></span>
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
</dd>
|
|
1597
|
+
</dl>
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
<div class="param-desc">
|
|
1601
|
+
<p><code>true</code> if the specified field exists and is normalizable; <code>false</code>
|
|
1602
|
+
otherwise.</p>
|
|
1603
|
+
</div>
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
</div>
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
</div>
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
<div class="section-method">
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
|
|
1620
|
+
<h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">(key, options)</span><span class="type-signature"> → {object}</span></h4>
|
|
1621
|
+
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
<div class="description">
|
|
1628
|
+
<p>Gets the object to be serialized by <code>JSON.stringify()</code>.</p>
|
|
1629
|
+
<p>If the value has a <code>toJSON()</code> method, it's responsible to define what
|
|
1630
|
+
data will be serialized. Instead of the object being serialized, the value
|
|
1631
|
+
returned by the <code>toJSON()</code> method when called will be serialized.</p>
|
|
1632
|
+
<p><strong>NOTE:</strong> this function returns an object to be serialized by
|
|
1633
|
+
<code>JSON.stringify()</code>, instead of a JSON string. Use <code>JSON.stringify()</code>
|
|
1634
|
+
or <code>this.toJsonString()</code> methods to serialize this object into a JSON
|
|
1635
|
+
string.</p>
|
|
1636
|
+
</div>
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
<dl class="details">
|
|
1643
|
+
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
|
|
1651
|
+
|
|
1652
|
+
|
|
1653
|
+
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
|
|
1664
|
+
|
|
1665
|
+
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
|
|
1673
|
+
<dt class="tag-see">See:</dt>
|
|
1674
|
+
<dd class="tag-see">
|
|
1675
|
+
<ul>
|
|
1676
|
+
<li>toJsonString()</li>
|
|
1677
|
+
|
|
1678
|
+
<li>DefaultOptions.get('toJSON')</li>
|
|
1679
|
+
</ul>
|
|
1680
|
+
</dd>
|
|
1681
|
+
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
</dl>
|
|
1685
|
+
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
|
|
1694
|
+
<h5>Parameters:</h5>
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
<table class="params">
|
|
1698
|
+
<thead>
|
|
1699
|
+
<tr>
|
|
1700
|
+
|
|
1701
|
+
<th>Name</th>
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
<th>Type</th>
|
|
1705
|
+
|
|
1706
|
+
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
<th class="last">Description</th>
|
|
1711
|
+
</tr>
|
|
1712
|
+
</thead>
|
|
1713
|
+
|
|
1714
|
+
<tbody>
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
<tr>
|
|
1718
|
+
|
|
1719
|
+
<td class="name"><code>key</code></td>
|
|
1720
|
+
|
|
1721
|
+
|
|
1722
|
+
<td class="type">
|
|
1723
|
+
|
|
1724
|
+
|
|
1725
|
+
<span class="param-type"><code>string</code></span>
|
|
1726
|
+
|
|
1727
|
+
|
|
1728
|
+
|
|
1729
|
+
</td>
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
<td class="description last">
|
|
1736
|
+
<p><code>JSON.stringify()</code> calls <code>toJSON()</code> with one parameter, the <code>key</code>,
|
|
1737
|
+
which takes the following values:</p>
|
|
1738
|
+
<ul>
|
|
1739
|
+
<li>if this object is a property value, this argument is the property
|
|
1740
|
+
name;</li>
|
|
1741
|
+
<li>if this object is in an array, this argument is the index in the
|
|
1742
|
+
array, as a string;</li>
|
|
1743
|
+
<li>if <code>JSON.stringify()</code> was directly called on this object, this
|
|
1744
|
+
argument is an empty string.</li>
|
|
1745
|
+
</ul>
|
|
1746
|
+
|
|
1747
|
+
</td>
|
|
1748
|
+
</tr>
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
<tr>
|
|
1753
|
+
|
|
1754
|
+
<td class="name"><code>options</code></td>
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
<td class="type">
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
<span class="param-type"><code>null</code></span>
|
|
1761
|
+
|
|
|
1762
|
+
|
|
1763
|
+
<span class="param-type"><code>undefined</code></span>
|
|
1764
|
+
|
|
|
1765
|
+
|
|
1766
|
+
<span class="param-type"><code>object</code></span>
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
</td>
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
|
|
1775
|
+
|
|
1776
|
+
<td class="description last">
|
|
1777
|
+
<p>the additional options for the serialization. If this argument is
|
|
1778
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
1779
|
+
options can be retrieved by calling <code>DefaultOptions.get('toJSON')</code>.
|
|
1780
|
+
Available options are:</p>
|
|
1781
|
+
<ul>
|
|
1782
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
1783
|
+
before serializing. The default value is <code>true</code>.</li>
|
|
1784
|
+
<li><code>removeEmptyFields: boolean</code>, indicates whether to ignore the empty
|
|
1785
|
+
fields of the object. If it is <code>true</code>, the empty fields of the object
|
|
1786
|
+
will be removed before serialization. The default value is <code>false</code>.</li>
|
|
1787
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
1788
|
+
of properties of the object represented by the result JSON string.
|
|
1789
|
+
The default value is <code>false</code>.</li>
|
|
1790
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
1791
|
+
i.e., the object calling the <code>toJSON()</code> method. The default value
|
|
1792
|
+
of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
1793
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
1794
|
+
i.e., the object represented by the result JSON string of the
|
|
1795
|
+
<code>toJSON()</code> method. The default value of this argument is
|
|
1796
|
+
<code>'LOWER_UNDERSCORE'</code>.</li>
|
|
1797
|
+
<li><code>space: string | number</code>, a string or number that's used to insert
|
|
1798
|
+
white space (including indentation, line break characters, etc.) into
|
|
1799
|
+
the output JSON string for readability purposes. If this is a number,
|
|
1800
|
+
it indicates the number of space characters to be used as indentation,
|
|
1801
|
+
clamped to 10 (that is, any number greater than 10 is treated as if
|
|
1802
|
+
it were 10). Values less than 1 indicate that no space should be used.
|
|
1803
|
+
If this is a string, the string (or the first 10 characters of the
|
|
1804
|
+
string, if it's longer than that) is inserted before every nested
|
|
1805
|
+
object or array. If this is anything other than a string or number
|
|
1806
|
+
(can be either a primitive or a wrapper object) — for example, is
|
|
1807
|
+
<code>null</code> or not provided — no white space is used. The default value
|
|
1808
|
+
of this option is <code>null</code>.</li>
|
|
1809
|
+
</ul>
|
|
1810
|
+
|
|
1811
|
+
</td>
|
|
1812
|
+
</tr>
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
</tbody>
|
|
1816
|
+
</table>
|
|
1817
|
+
|
|
1818
|
+
|
|
1819
|
+
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
|
|
1824
|
+
|
|
1825
|
+
|
|
1826
|
+
|
|
1827
|
+
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
|
|
1831
|
+
|
|
1832
|
+
|
|
1833
|
+
<div class="section-returns">
|
|
1834
|
+
<h5>Returns:</h5>
|
|
1835
|
+
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
<dl class="param-type">
|
|
1839
|
+
<dt>
|
|
1840
|
+
Type:
|
|
1841
|
+
</dt>
|
|
1842
|
+
<dd>
|
|
1843
|
+
|
|
1844
|
+
<span class="param-type"><code>object</code></span>
|
|
1845
|
+
|
|
1846
|
+
|
|
1847
|
+
</dd>
|
|
1848
|
+
</dl>
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
<div class="param-desc">
|
|
1852
|
+
<p>the object to be serialized by <code>JSON.stringify()</code>, which may be a
|
|
1853
|
+
modify copy of this object.</p>
|
|
1854
|
+
</div>
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
</div>
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
</div>
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
<div class="section-method">
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
<h4 class="name" id="toJsonString"><span class="type-signature"></span>toJsonString<span class="signature">(options)</span><span class="type-signature"> → {string}</span></h4>
|
|
1872
|
+
|
|
1873
|
+
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
<div class="description">
|
|
1879
|
+
<p>Serializes this object into a JSON string.</p>
|
|
1880
|
+
<p><strong>NOTE:</strong> This method supports native <code>bigint</code> value. For example, the
|
|
1881
|
+
<code>bigint</code> value <code>9223372036854775807n</code> will be stringify as
|
|
1882
|
+
<code>9223372036854775807</code>.</p>
|
|
1883
|
+
</div>
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
|
|
1889
|
+
<dl class="details">
|
|
1890
|
+
|
|
1891
|
+
|
|
1892
|
+
|
|
1893
|
+
|
|
1894
|
+
|
|
1895
|
+
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
|
|
1902
|
+
|
|
1903
|
+
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
|
|
1907
|
+
|
|
1908
|
+
|
|
1909
|
+
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
<dt class="tag-see">See:</dt>
|
|
1921
|
+
<dd class="tag-see">
|
|
1922
|
+
<ul>
|
|
1923
|
+
<li>toJSON()</li>
|
|
1924
|
+
|
|
1925
|
+
<li>DefaultOptions.get('toJSON')</li>
|
|
1926
|
+
</ul>
|
|
1927
|
+
</dd>
|
|
1928
|
+
|
|
1929
|
+
|
|
1930
|
+
|
|
1931
|
+
</dl>
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
|
|
1941
|
+
<h5>Parameters:</h5>
|
|
1942
|
+
|
|
1943
|
+
|
|
1944
|
+
<table class="params">
|
|
1945
|
+
<thead>
|
|
1946
|
+
<tr>
|
|
1947
|
+
|
|
1948
|
+
<th>Name</th>
|
|
1949
|
+
|
|
1950
|
+
|
|
1951
|
+
<th>Type</th>
|
|
1952
|
+
|
|
1953
|
+
|
|
1954
|
+
|
|
1955
|
+
|
|
1956
|
+
|
|
1957
|
+
<th class="last">Description</th>
|
|
1958
|
+
</tr>
|
|
1959
|
+
</thead>
|
|
1960
|
+
|
|
1961
|
+
<tbody>
|
|
1962
|
+
|
|
1963
|
+
|
|
1964
|
+
<tr>
|
|
1965
|
+
|
|
1966
|
+
<td class="name"><code>options</code></td>
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
<td class="type">
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
<span class="param-type"><code>null</code></span>
|
|
1973
|
+
|
|
|
1974
|
+
|
|
1975
|
+
<span class="param-type"><code>undefined</code></span>
|
|
1976
|
+
|
|
|
1977
|
+
|
|
1978
|
+
<span class="param-type"><code>object</code></span>
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
</td>
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
|
|
1986
|
+
|
|
1987
|
+
|
|
1988
|
+
<td class="description last">
|
|
1989
|
+
<p>the additional options for the serialization. If this argument is
|
|
1990
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
1991
|
+
options can be retrieved by calling <code>DefaultOptions.get('toJSON')</code>.
|
|
1992
|
+
Available options are:</p>
|
|
1993
|
+
<ul>
|
|
1994
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
1995
|
+
before serializing. The default value is <code>true</code>.</li>
|
|
1996
|
+
<li><code>removeEmptyFields: boolean</code>, indicates whether to ignore the empty
|
|
1997
|
+
fields of the object. If it is <code>true</code>, the empty fields of the object
|
|
1998
|
+
will be removed before serialization. The default value is <code>false</code>.</li>
|
|
1999
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
2000
|
+
of properties of the object represented by the result JSON string.
|
|
2001
|
+
The default value is <code>false</code>.</li>
|
|
2002
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
2003
|
+
i.e., the object calling the <code>toJSON()</code> method. The default value
|
|
2004
|
+
of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
2005
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
2006
|
+
i.e., the object represented by the result JSON string of the
|
|
2007
|
+
<code>toJSON()</code> method. The default value of this argument is
|
|
2008
|
+
<code>'LOWER_UNDERSCORE'</code>.</li>
|
|
2009
|
+
<li><code>space: string | number</code>, a string or number that's used to insert
|
|
2010
|
+
white space (including indentation, line break characters, etc.) into
|
|
2011
|
+
the output JSON string for readability purposes. If this is a number,
|
|
2012
|
+
it indicates the number of space characters to be used as indentation,
|
|
2013
|
+
clamped to 10 (that is, any number greater than 10 is treated as if
|
|
2014
|
+
it were 10). Values less than 1 indicate that no space should be used.
|
|
2015
|
+
If this is a string, the string (or the first 10 characters of the
|
|
2016
|
+
string, if it's longer than that) is inserted before every nested
|
|
2017
|
+
object or array. If this is anything other than a string or number
|
|
2018
|
+
(can be either a primitive or a wrapper object) — for example, is
|
|
2019
|
+
<code>null</code> or not provided — no white space is used. The default value
|
|
2020
|
+
of this option is <code>null</code>.</li>
|
|
2021
|
+
</ul>
|
|
2022
|
+
|
|
2023
|
+
</td>
|
|
2024
|
+
</tr>
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
</tbody>
|
|
2028
|
+
</table>
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
<div class="section-returns">
|
|
2046
|
+
<h5>Returns:</h5>
|
|
2047
|
+
|
|
2048
|
+
|
|
2049
|
+
|
|
2050
|
+
<dl class="param-type">
|
|
2051
|
+
<dt>
|
|
2052
|
+
Type:
|
|
2053
|
+
</dt>
|
|
2054
|
+
<dd>
|
|
2055
|
+
|
|
2056
|
+
<span class="param-type"><code>string</code></span>
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
</dd>
|
|
2060
|
+
</dl>
|
|
2061
|
+
|
|
2062
|
+
|
|
2063
|
+
<div class="param-desc">
|
|
2064
|
+
<p>the JSON string serialized from this object, as <code>JSON.stringify()</code>
|
|
2065
|
+
does, except that this function provides additional stringification
|
|
2066
|
+
options.</p>
|
|
2067
|
+
</div>
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
</div>
|
|
2071
|
+
|
|
2072
|
+
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
|
|
2076
|
+
</div>
|
|
2077
|
+
|
|
2078
|
+
|
|
2079
|
+
<div class="section-method">
|
|
2080
|
+
|
|
2081
|
+
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
<h4 class="name" id="validate"><span class="type-signature"></span>validate<span class="signature">(fields, context)</span><span class="type-signature"> → {ValidationResult}</span></h4>
|
|
2085
|
+
|
|
2086
|
+
|
|
2087
|
+
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
|
|
2091
|
+
<div class="description">
|
|
2092
|
+
<p>Validates this object.</p>
|
|
2093
|
+
</div>
|
|
2094
|
+
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
<dl class="details">
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
|
|
2118
|
+
|
|
2119
|
+
|
|
2120
|
+
|
|
2121
|
+
|
|
2122
|
+
|
|
2123
|
+
|
|
2124
|
+
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
|
|
2128
|
+
|
|
2129
|
+
|
|
2130
|
+
|
|
2131
|
+
|
|
2132
|
+
</dl>
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
|
|
2138
|
+
|
|
2139
|
+
|
|
2140
|
+
|
|
2141
|
+
|
|
2142
|
+
<h5>Parameters:</h5>
|
|
2143
|
+
|
|
2144
|
+
|
|
2145
|
+
<table class="params">
|
|
2146
|
+
<thead>
|
|
2147
|
+
<tr>
|
|
2148
|
+
|
|
2149
|
+
<th>Name</th>
|
|
2150
|
+
|
|
2151
|
+
|
|
2152
|
+
<th>Type</th>
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
|
|
2156
|
+
|
|
2157
|
+
|
|
2158
|
+
<th class="last">Description</th>
|
|
2159
|
+
</tr>
|
|
2160
|
+
</thead>
|
|
2161
|
+
|
|
2162
|
+
<tbody>
|
|
2163
|
+
|
|
2164
|
+
|
|
2165
|
+
<tr>
|
|
2166
|
+
|
|
2167
|
+
<td class="name"><code>fields</code></td>
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
<td class="type">
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
<span class="param-type"><code>undefined</code></span>
|
|
2174
|
+
|
|
|
2175
|
+
|
|
2176
|
+
<span class="param-type"><code>string</code></span>
|
|
2177
|
+
|
|
|
2178
|
+
|
|
2179
|
+
<span class="param-type"><code>array</code></span>
|
|
2180
|
+
|
|
2181
|
+
|
|
2182
|
+
|
|
2183
|
+
</td>
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
<td class="description last">
|
|
2190
|
+
<p>the names of fields to be validated. If this argument is not specified,
|
|
2191
|
+
or <code>undefined</code>, or <code>null</code>, or a string <code>'*'</code>, this function validates
|
|
2192
|
+
all validatable fields of this object; If this argument is an array of
|
|
2193
|
+
strings, this function validates all validatable fields specified
|
|
2194
|
+
in the array. If this argument is a string other than <code>'*'</code>, this
|
|
2195
|
+
function validates the field with the name equals to this argument;
|
|
2196
|
+
if the specified field does not exist nor non-validatable, this
|
|
2197
|
+
function does nothing.</p>
|
|
2198
|
+
|
|
2199
|
+
</td>
|
|
2200
|
+
</tr>
|
|
2201
|
+
|
|
2202
|
+
|
|
2203
|
+
|
|
2204
|
+
<tr>
|
|
2205
|
+
|
|
2206
|
+
<td class="name"><code>context</code></td>
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
<td class="type">
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
<span class="param-type"><code>object</code></span>
|
|
2213
|
+
|
|
2214
|
+
|
|
2215
|
+
|
|
2216
|
+
</td>
|
|
2217
|
+
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
<td class="description last">
|
|
2223
|
+
<p>The validation context. If this argument is not specified, an empty
|
|
2224
|
+
context is used.</p>
|
|
2225
|
+
|
|
2226
|
+
</td>
|
|
2227
|
+
</tr>
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
</tbody>
|
|
2231
|
+
</table>
|
|
2232
|
+
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
|
|
2241
|
+
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
<div class="section-returns">
|
|
2249
|
+
<h5>Returns:</h5>
|
|
2250
|
+
|
|
2251
|
+
|
|
2252
|
+
|
|
2253
|
+
<dl class="param-type">
|
|
2254
|
+
<dt>
|
|
2255
|
+
Type:
|
|
2256
|
+
</dt>
|
|
2257
|
+
<dd>
|
|
2258
|
+
|
|
2259
|
+
<span class="param-type"><code>ValidationResult</code></span>
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
</dd>
|
|
2263
|
+
</dl>
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
<div class="param-desc">
|
|
2267
|
+
<p>The result of validation.</p>
|
|
2268
|
+
</div>
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
</div>
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
2276
|
+
|
|
2277
|
+
</div>
|
|
2278
|
+
|
|
2279
|
+
|
|
2280
|
+
<div class="section-method">
|
|
2281
|
+
|
|
2282
|
+
|
|
2283
|
+
|
|
2284
|
+
|
|
2285
|
+
<h4 class="name" id="validateField"><span class="type-signature"></span>validateField<span class="signature">(field, context)</span><span class="type-signature"> → {ValidationResult|null}</span></h4>
|
|
2286
|
+
|
|
2287
|
+
|
|
2288
|
+
|
|
2289
|
+
|
|
2290
|
+
|
|
2291
|
+
|
|
2292
|
+
<div class="description">
|
|
2293
|
+
<p>Validates the specified validatable fields of this object.</p>
|
|
2294
|
+
<p>A field is validatable if and only if it is decorated with the
|
|
2295
|
+
<code>@<a href="global.html#Validatable">Validatable</a></code> decorator.</p>
|
|
2296
|
+
</div>
|
|
2297
|
+
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
<dl class="details">
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
|
|
2325
|
+
|
|
2326
|
+
|
|
2327
|
+
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
|
|
2331
|
+
|
|
2332
|
+
|
|
2333
|
+
|
|
2334
|
+
|
|
2335
|
+
</dl>
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
|
|
2344
|
+
|
|
2345
|
+
<h5>Parameters:</h5>
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
<table class="params">
|
|
2349
|
+
<thead>
|
|
2350
|
+
<tr>
|
|
2351
|
+
|
|
2352
|
+
<th>Name</th>
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
<th>Type</th>
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
<th class="last">Description</th>
|
|
2362
|
+
</tr>
|
|
2363
|
+
</thead>
|
|
2364
|
+
|
|
2365
|
+
<tbody>
|
|
2366
|
+
|
|
2367
|
+
|
|
2368
|
+
<tr>
|
|
2369
|
+
|
|
2370
|
+
<td class="name"><code>field</code></td>
|
|
2371
|
+
|
|
2372
|
+
|
|
2373
|
+
<td class="type">
|
|
2374
|
+
|
|
2375
|
+
|
|
2376
|
+
<span class="param-type"><code>string</code></span>
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2380
|
+
</td>
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
|
|
2386
|
+
<td class="description last">
|
|
2387
|
+
<p>the names of fields to be validated. If the specified field does not
|
|
2388
|
+
exist nor non-validatable, this function does nothing and returns
|
|
2389
|
+
<code>null</code>.</p>
|
|
2390
|
+
|
|
2391
|
+
</td>
|
|
2392
|
+
</tr>
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
|
|
2396
|
+
<tr>
|
|
2397
|
+
|
|
2398
|
+
<td class="name"><code>context</code></td>
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
<td class="type">
|
|
2402
|
+
|
|
2403
|
+
|
|
2404
|
+
<span class="param-type"><code>object</code></span>
|
|
2405
|
+
|
|
2406
|
+
|
|
2407
|
+
|
|
2408
|
+
</td>
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
|
|
2413
|
+
|
|
2414
|
+
<td class="description last">
|
|
2415
|
+
<p>The validation context. If this argument is not specified, an empty
|
|
2416
|
+
context is used.</p>
|
|
2417
|
+
|
|
2418
|
+
</td>
|
|
2419
|
+
</tr>
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
</tbody>
|
|
2423
|
+
</table>
|
|
2424
|
+
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
|
|
2436
|
+
|
|
2437
|
+
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
<div class="section-returns">
|
|
2441
|
+
<h5>Returns:</h5>
|
|
2442
|
+
|
|
2443
|
+
|
|
2444
|
+
|
|
2445
|
+
<dl class="param-type">
|
|
2446
|
+
<dt>
|
|
2447
|
+
Type:
|
|
2448
|
+
</dt>
|
|
2449
|
+
<dd>
|
|
2450
|
+
|
|
2451
|
+
<span class="param-type"><code>ValidationResult</code></span>
|
|
2452
|
+
|
|
|
2453
|
+
|
|
2454
|
+
<span class="param-type"><code>null</code></span>
|
|
2455
|
+
|
|
2456
|
+
|
|
2457
|
+
</dd>
|
|
2458
|
+
</dl>
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
<div class="param-desc">
|
|
2462
|
+
<p>The validation result if the specified field exists; <code>null</code> otherwise.
|
|
2463
|
+
If the specified field exist but is non-validatable, returns the success
|
|
2464
|
+
validation result.</p>
|
|
2465
|
+
</div>
|
|
2466
|
+
|
|
2467
|
+
|
|
2468
|
+
</div>
|
|
2469
|
+
|
|
2470
|
+
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
</div>
|
|
2475
|
+
|
|
2476
|
+
|
|
2477
|
+
<div class="section-method">
|
|
2478
|
+
|
|
2479
|
+
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
<h4 class="name" id=".Class.create"><span class="type-signature">(static) </span>Class.create<span class="signature">(obj, options)</span><span class="type-signature"> → {Class|null}</span></h4>
|
|
2483
|
+
|
|
2484
|
+
|
|
2485
|
+
|
|
2486
|
+
|
|
2487
|
+
|
|
2488
|
+
|
|
2489
|
+
<div class="description">
|
|
2490
|
+
<p>Creates a new instance of this class based on the specified data object.</p>
|
|
2491
|
+
<p>It copies the property values from the corresponding properties of the
|
|
2492
|
+
specified data object maintaining the same prototype and class definition.</p>
|
|
2493
|
+
<p>If a property in the data object is <code>undefined</code> or <code>null</code>, the function
|
|
2494
|
+
sets the property of the created instance to the default value.</p>
|
|
2495
|
+
<p>This method is usually used to transform a plain JSON object into the
|
|
2496
|
+
specified domain object.</p>
|
|
2497
|
+
</div>
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
<dl class="details">
|
|
2504
|
+
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
|
|
2518
|
+
|
|
2519
|
+
|
|
2520
|
+
|
|
2521
|
+
|
|
2522
|
+
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
|
|
2526
|
+
|
|
2527
|
+
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
|
|
2531
|
+
|
|
2532
|
+
|
|
2533
|
+
|
|
2534
|
+
<dt class="tag-see">See:</dt>
|
|
2535
|
+
<dd class="tag-see">
|
|
2536
|
+
<ul>
|
|
2537
|
+
<li>DefaultOptions.get('assign')</li>
|
|
2538
|
+
</ul>
|
|
2539
|
+
</dd>
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
</dl>
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
<h5>Parameters:</h5>
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
<table class="params">
|
|
2557
|
+
<thead>
|
|
2558
|
+
<tr>
|
|
2559
|
+
|
|
2560
|
+
<th>Name</th>
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
<th>Type</th>
|
|
2564
|
+
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
2569
|
+
<th class="last">Description</th>
|
|
2570
|
+
</tr>
|
|
2571
|
+
</thead>
|
|
2572
|
+
|
|
2573
|
+
<tbody>
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
<tr>
|
|
2577
|
+
|
|
2578
|
+
<td class="name"><code>obj</code></td>
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
<td class="type">
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
<span class="param-type"><code>object</code></span>
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
</td>
|
|
2589
|
+
|
|
2590
|
+
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
|
|
2594
|
+
<td class="description last">
|
|
2595
|
+
<p>the specified data object.</p>
|
|
2596
|
+
|
|
2597
|
+
</td>
|
|
2598
|
+
</tr>
|
|
2599
|
+
|
|
2600
|
+
|
|
2601
|
+
|
|
2602
|
+
<tr>
|
|
2603
|
+
|
|
2604
|
+
<td class="name"><code>options</code></td>
|
|
2605
|
+
|
|
2606
|
+
|
|
2607
|
+
<td class="type">
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
<span class="param-type"><code>null</code></span>
|
|
2611
|
+
|
|
|
2612
|
+
|
|
2613
|
+
<span class="param-type"><code>undefined</code></span>
|
|
2614
|
+
|
|
|
2615
|
+
|
|
2616
|
+
<span class="param-type"><code>object</code></span>
|
|
2617
|
+
|
|
2618
|
+
|
|
2619
|
+
|
|
2620
|
+
</td>
|
|
2621
|
+
|
|
2622
|
+
|
|
2623
|
+
|
|
2624
|
+
|
|
2625
|
+
|
|
2626
|
+
<td class="description last">
|
|
2627
|
+
<p>the additional options for the creation. If this argument is
|
|
2628
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
2629
|
+
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.
|
|
2630
|
+
Available options are:</p>
|
|
2631
|
+
<ul>
|
|
2632
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
2633
|
+
after the assignment. The default value is <code>true</code>.</li>
|
|
2634
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
2635
|
+
style of the target object. The default value is <code>false</code>.</li>
|
|
2636
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
2637
|
+
i.e., the first argument of the <code>create()</code> method. The default
|
|
2638
|
+
value of this argument is <code>'LOWER_UNDERSCORE'</code>.</li>
|
|
2639
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
2640
|
+
i.e., the object returned by the <code>create()</code> method. The default
|
|
2641
|
+
value of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
2642
|
+
<li><code>types: object</code>, the additional information about types of
|
|
2643
|
+
fields of classes. The keys of this object are the path of the fields
|
|
2644
|
+
or sub-fields of the target object, the values are the type of the
|
|
2645
|
+
fields, represented as the constructor function of the type.
|
|
2646
|
+
The default value is <code>{}</code>.</li>
|
|
2647
|
+
<li><code>elementTypes: object</code>, the additional information about types of
|
|
2648
|
+
elements of fields of classes. The keys of this object are the path of
|
|
2649
|
+
the fields or sub-fields of the target object, the values are the type
|
|
2650
|
+
of the elements, represented as the constructor function of the type.
|
|
2651
|
+
The default value is <code>{}</code>.</li>
|
|
2652
|
+
</ul>
|
|
2653
|
+
|
|
2654
|
+
</td>
|
|
2655
|
+
</tr>
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
</tbody>
|
|
2659
|
+
</table>
|
|
2660
|
+
|
|
2661
|
+
|
|
2662
|
+
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
<div class="section-returns">
|
|
2677
|
+
<h5>Returns:</h5>
|
|
2678
|
+
|
|
2679
|
+
|
|
2680
|
+
|
|
2681
|
+
<dl class="param-type">
|
|
2682
|
+
<dt>
|
|
2683
|
+
Type:
|
|
2684
|
+
</dt>
|
|
2685
|
+
<dd>
|
|
2686
|
+
|
|
2687
|
+
<span class="param-type"><code>Class</code></span>
|
|
2688
|
+
|
|
|
2689
|
+
|
|
2690
|
+
<span class="param-type"><code>null</code></span>
|
|
2691
|
+
|
|
2692
|
+
|
|
2693
|
+
</dd>
|
|
2694
|
+
</dl>
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
<div class="param-desc">
|
|
2698
|
+
<p>the new instance of this class created from the specified data object,
|
|
2699
|
+
or <code>null</code> if the specified object is <code>null</code> or <code>undefined</code>.</p>
|
|
2700
|
+
</div>
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
</div>
|
|
2704
|
+
|
|
2705
|
+
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
|
|
2709
|
+
</div>
|
|
2710
|
+
|
|
2711
|
+
|
|
2712
|
+
<div class="section-method">
|
|
2713
|
+
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
|
|
2717
|
+
<h4 class="name" id=".Class.createArray"><span class="type-signature">(static) </span>Class.createArray<span class="signature">(array, options)</span><span class="type-signature"> → {Array.<Class>|null}</span></h4>
|
|
2718
|
+
|
|
2719
|
+
|
|
2720
|
+
|
|
2721
|
+
|
|
2722
|
+
|
|
2723
|
+
|
|
2724
|
+
<div class="description">
|
|
2725
|
+
<p>Creates a new array of instances of this class based on an array of data
|
|
2726
|
+
objects.</p>
|
|
2727
|
+
<p>The property values of each element in the created instances array are
|
|
2728
|
+
copied from the corresponding elements in the data object array,
|
|
2729
|
+
maintaining the same prototype and class definition.</p>
|
|
2730
|
+
<p>This method is usually used to transform an array of plain JSON objects
|
|
2731
|
+
into an array of specified domain objects.</p>
|
|
2732
|
+
</div>
|
|
2733
|
+
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
|
|
2737
|
+
|
|
2738
|
+
<dl class="details">
|
|
2739
|
+
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
|
|
2743
|
+
|
|
2744
|
+
|
|
2745
|
+
|
|
2746
|
+
|
|
2747
|
+
|
|
2748
|
+
|
|
2749
|
+
|
|
2750
|
+
|
|
2751
|
+
|
|
2752
|
+
|
|
2753
|
+
|
|
2754
|
+
|
|
2755
|
+
|
|
2756
|
+
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
|
|
2760
|
+
|
|
2761
|
+
|
|
2762
|
+
|
|
2763
|
+
|
|
2764
|
+
|
|
2765
|
+
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
|
|
2769
|
+
<dt class="tag-see">See:</dt>
|
|
2770
|
+
<dd class="tag-see">
|
|
2771
|
+
<ul>
|
|
2772
|
+
<li>DefaultOptions.get('assign')</li>
|
|
2773
|
+
</ul>
|
|
2774
|
+
</dd>
|
|
2775
|
+
|
|
2776
|
+
|
|
2777
|
+
|
|
2778
|
+
</dl>
|
|
2779
|
+
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
|
|
2786
|
+
|
|
2787
|
+
|
|
2788
|
+
<h5>Parameters:</h5>
|
|
2789
|
+
|
|
2790
|
+
|
|
2791
|
+
<table class="params">
|
|
2792
|
+
<thead>
|
|
2793
|
+
<tr>
|
|
2794
|
+
|
|
2795
|
+
<th>Name</th>
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
<th>Type</th>
|
|
2799
|
+
|
|
2800
|
+
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
|
|
2804
|
+
<th class="last">Description</th>
|
|
2805
|
+
</tr>
|
|
2806
|
+
</thead>
|
|
2807
|
+
|
|
2808
|
+
<tbody>
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
<tr>
|
|
2812
|
+
|
|
2813
|
+
<td class="name"><code>array</code></td>
|
|
2814
|
+
|
|
2815
|
+
|
|
2816
|
+
<td class="type">
|
|
2817
|
+
|
|
2818
|
+
|
|
2819
|
+
<span class="param-type"><code>Array.<object></code></span>
|
|
2820
|
+
|
|
2821
|
+
|
|
2822
|
+
|
|
2823
|
+
</td>
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
|
|
2828
|
+
|
|
2829
|
+
<td class="description last">
|
|
2830
|
+
<p>the specified array of data objects.</p>
|
|
2831
|
+
|
|
2832
|
+
</td>
|
|
2833
|
+
</tr>
|
|
2834
|
+
|
|
2835
|
+
|
|
2836
|
+
|
|
2837
|
+
<tr>
|
|
2838
|
+
|
|
2839
|
+
<td class="name"><code>options</code></td>
|
|
2840
|
+
|
|
2841
|
+
|
|
2842
|
+
<td class="type">
|
|
2843
|
+
|
|
2844
|
+
|
|
2845
|
+
<span class="param-type"><code>null</code></span>
|
|
2846
|
+
|
|
|
2847
|
+
|
|
2848
|
+
<span class="param-type"><code>undefined</code></span>
|
|
2849
|
+
|
|
|
2850
|
+
|
|
2851
|
+
<span class="param-type"><code>object</code></span>
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
</td>
|
|
2856
|
+
|
|
2857
|
+
|
|
2858
|
+
|
|
2859
|
+
|
|
2860
|
+
|
|
2861
|
+
<td class="description last">
|
|
2862
|
+
<p>the additional options for the creation. If this argument is
|
|
2863
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
2864
|
+
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.
|
|
2865
|
+
Available options are:</p>
|
|
2866
|
+
<ul>
|
|
2867
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
2868
|
+
after the assignment. The default value is <code>true</code>.</li>
|
|
2869
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
2870
|
+
style of the target object. The default value is <code>false</code>.</li>
|
|
2871
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
2872
|
+
i.e., the elements in the first argument of the <code>createArray()</code>
|
|
2873
|
+
method. The default value of this argument is <code>'LOWER_UNDERSCORE'</code>.</li>
|
|
2874
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
2875
|
+
i.e., the elements in the array returned by the <code>createArray()</code>
|
|
2876
|
+
method. The default value of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
2877
|
+
<li><code>types: object</code>, the additional information about types of
|
|
2878
|
+
fields of classes. The keys of this object are the path of the fields
|
|
2879
|
+
or sub-fields of the target object, the values are the type of the
|
|
2880
|
+
fields, represented as the constructor function of the type.
|
|
2881
|
+
The default value is <code>{}</code>.</li>
|
|
2882
|
+
<li><code>elementTypes: object</code>, the additional information about types of
|
|
2883
|
+
elements of fields of classes. The keys of this object are the path of
|
|
2884
|
+
the fields or sub-fields of the target object, the values are the type
|
|
2885
|
+
of the elements, represented as the constructor function of the type.
|
|
2886
|
+
The default value is <code>{}</code>.</li>
|
|
2887
|
+
</ul>
|
|
2888
|
+
|
|
2889
|
+
</td>
|
|
2890
|
+
</tr>
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
</tbody>
|
|
2894
|
+
</table>
|
|
2895
|
+
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
|
|
2906
|
+
|
|
2907
|
+
|
|
2908
|
+
|
|
2909
|
+
|
|
2910
|
+
|
|
2911
|
+
<div class="section-returns">
|
|
2912
|
+
<h5>Returns:</h5>
|
|
2913
|
+
|
|
2914
|
+
|
|
2915
|
+
|
|
2916
|
+
<dl class="param-type">
|
|
2917
|
+
<dt>
|
|
2918
|
+
Type:
|
|
2919
|
+
</dt>
|
|
2920
|
+
<dd>
|
|
2921
|
+
|
|
2922
|
+
<span class="param-type"><code>Array.<Class></code></span>
|
|
2923
|
+
|
|
|
2924
|
+
|
|
2925
|
+
<span class="param-type"><code>null</code></span>
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
</dd>
|
|
2929
|
+
</dl>
|
|
2930
|
+
|
|
2931
|
+
|
|
2932
|
+
<div class="param-desc">
|
|
2933
|
+
<p>the new array of instances of this class created from the specified
|
|
2934
|
+
data object array, or <code>null</code> if the specified data object array is
|
|
2935
|
+
<code>null</code> or <code>undefined</code>.</p>
|
|
2936
|
+
</div>
|
|
2937
|
+
|
|
2938
|
+
|
|
2939
|
+
</div>
|
|
2940
|
+
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
|
|
2944
|
+
|
|
2945
|
+
</div>
|
|
2946
|
+
|
|
2947
|
+
|
|
2948
|
+
<div class="section-method">
|
|
2949
|
+
|
|
2950
|
+
|
|
2951
|
+
|
|
2952
|
+
|
|
2953
|
+
<h4 class="name" id=".Class.createPage"><span class="type-signature">(static) </span>Class.createPage<span class="signature">(page, options)</span><span class="type-signature"> → {<a href="Page.html">Page</a>|null}</span></h4>
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
|
|
2957
|
+
|
|
2958
|
+
|
|
2959
|
+
|
|
2960
|
+
<div class="description">
|
|
2961
|
+
<p>Creates a new page object based on the specified pagination data object.</p>
|
|
2962
|
+
<p>Typically, the pagination data object is the JSON representation of a
|
|
2963
|
+
list of domain objects obtained from a server using the GET method, and
|
|
2964
|
+
the object should conform to the <code>Page</code> class definition.</p>
|
|
2965
|
+
</div>
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
|
|
2970
|
+
|
|
2971
|
+
<dl class="details">
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
|
|
2985
|
+
|
|
2986
|
+
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
|
|
3000
|
+
|
|
3001
|
+
|
|
3002
|
+
<dt class="tag-see">See:</dt>
|
|
3003
|
+
<dd class="tag-see">
|
|
3004
|
+
<ul>
|
|
3005
|
+
<li>DefaultOptions.get('assign')</li>
|
|
3006
|
+
</ul>
|
|
3007
|
+
</dd>
|
|
3008
|
+
|
|
3009
|
+
|
|
3010
|
+
|
|
3011
|
+
</dl>
|
|
3012
|
+
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
|
|
3019
|
+
|
|
3020
|
+
|
|
3021
|
+
<h5>Parameters:</h5>
|
|
3022
|
+
|
|
3023
|
+
|
|
3024
|
+
<table class="params">
|
|
3025
|
+
<thead>
|
|
3026
|
+
<tr>
|
|
3027
|
+
|
|
3028
|
+
<th>Name</th>
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
<th>Type</th>
|
|
3032
|
+
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
|
|
3037
|
+
<th class="last">Description</th>
|
|
3038
|
+
</tr>
|
|
3039
|
+
</thead>
|
|
3040
|
+
|
|
3041
|
+
<tbody>
|
|
3042
|
+
|
|
3043
|
+
|
|
3044
|
+
<tr>
|
|
3045
|
+
|
|
3046
|
+
<td class="name"><code>page</code></td>
|
|
3047
|
+
|
|
3048
|
+
|
|
3049
|
+
<td class="type">
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
<span class="param-type"><code>object</code></span>
|
|
3053
|
+
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
</td>
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
<td class="description last">
|
|
3063
|
+
<p>the specified pagination data object, which must conform to the
|
|
3064
|
+
<code>Page</code> class definition.</p>
|
|
3065
|
+
|
|
3066
|
+
</td>
|
|
3067
|
+
</tr>
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
<tr>
|
|
3072
|
+
|
|
3073
|
+
<td class="name"><code>options</code></td>
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
<td class="type">
|
|
3077
|
+
|
|
3078
|
+
|
|
3079
|
+
<span class="param-type"><code>null</code></span>
|
|
3080
|
+
|
|
|
3081
|
+
|
|
3082
|
+
<span class="param-type"><code>undefined</code></span>
|
|
3083
|
+
|
|
|
3084
|
+
|
|
3085
|
+
<span class="param-type"><code>object</code></span>
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
</td>
|
|
3090
|
+
|
|
3091
|
+
|
|
3092
|
+
|
|
3093
|
+
|
|
3094
|
+
|
|
3095
|
+
<td class="description last">
|
|
3096
|
+
<p>the additional options for the creation. If this argument is
|
|
3097
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
3098
|
+
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.
|
|
3099
|
+
Available options are:</p>
|
|
3100
|
+
<ul>
|
|
3101
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
3102
|
+
after the assignment. The default value is <code>true</code>.</li>
|
|
3103
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
3104
|
+
style of the target object. The default value is <code>false</code>.</li>
|
|
3105
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
3106
|
+
i.e., the elements in the <code>content</code> array of the first argument of
|
|
3107
|
+
the <code>createPage()</code> method. The default value of this argument is
|
|
3108
|
+
<code>'LOWER_UNDERSCORE'</code>.</li>
|
|
3109
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
3110
|
+
i.e., the elements in the <code>content</code> array of the <code>Page</code> object
|
|
3111
|
+
returned by the <code>createPage()</code> method. The default value of this
|
|
3112
|
+
argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
3113
|
+
<li><code>types: object</code>, the additional information about types of
|
|
3114
|
+
fields of classes. The keys of this object are the path of the fields
|
|
3115
|
+
or sub-fields of the target object, the values are the type of the
|
|
3116
|
+
fields, represented as the constructor function of the type.
|
|
3117
|
+
The default value is <code>{}</code>.</li>
|
|
3118
|
+
<li><code>elementTypes: object</code>, the additional information about types of
|
|
3119
|
+
elements of fields of classes. The keys of this object are the path of
|
|
3120
|
+
the fields or sub-fields of the target object, the values are the type
|
|
3121
|
+
of the elements, represented as the constructor function of the type.
|
|
3122
|
+
The default value is <code>{}</code>.</li>
|
|
3123
|
+
</ul>
|
|
3124
|
+
|
|
3125
|
+
</td>
|
|
3126
|
+
</tr>
|
|
3127
|
+
|
|
3128
|
+
|
|
3129
|
+
</tbody>
|
|
3130
|
+
</table>
|
|
3131
|
+
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
|
|
3135
|
+
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
|
|
3142
|
+
|
|
3143
|
+
|
|
3144
|
+
|
|
3145
|
+
|
|
3146
|
+
|
|
3147
|
+
<div class="section-returns">
|
|
3148
|
+
<h5>Returns:</h5>
|
|
3149
|
+
|
|
3150
|
+
|
|
3151
|
+
|
|
3152
|
+
<dl class="param-type">
|
|
3153
|
+
<dt>
|
|
3154
|
+
Type:
|
|
3155
|
+
</dt>
|
|
3156
|
+
<dd>
|
|
3157
|
+
|
|
3158
|
+
<span class="param-type"><code><a href="Page.html">Page</a></code></span>
|
|
3159
|
+
|
|
|
3160
|
+
|
|
3161
|
+
<span class="param-type"><code>null</code></span>
|
|
3162
|
+
|
|
3163
|
+
|
|
3164
|
+
</dd>
|
|
3165
|
+
</dl>
|
|
3166
|
+
|
|
3167
|
+
|
|
3168
|
+
<div class="param-desc">
|
|
3169
|
+
<p>A new <code>Page</code> object, whose <code>content</code> property is the result of
|
|
3170
|
+
<code>this.createArray(page.content, true)</code>, and the other properties
|
|
3171
|
+
matching those of the <code>page</code> object. If the argument <code>page</code> is not a
|
|
3172
|
+
valid <code>Page</code> object, this function returns <code>null</code>.</p>
|
|
3173
|
+
</div>
|
|
3174
|
+
|
|
3175
|
+
|
|
3176
|
+
</div>
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
</div>
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
<div class="section-method">
|
|
3186
|
+
|
|
3187
|
+
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
<h4 class="name" id=".Class.isNullishOrEmpty"><span class="type-signature">(static) </span>Class.isNullishOrEmpty<span class="signature">(obj)</span><span class="type-signature"> → {boolean}</span></h4>
|
|
3191
|
+
|
|
3192
|
+
|
|
3193
|
+
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
<div class="description">
|
|
3198
|
+
<p>Determines whether the given instance of this class is <code>undefined</code>,
|
|
3199
|
+
<code>null</code>, or an empty object constructed with default values.</p>
|
|
3200
|
+
</div>
|
|
3201
|
+
|
|
3202
|
+
|
|
3203
|
+
|
|
3204
|
+
|
|
3205
|
+
|
|
3206
|
+
<dl class="details">
|
|
3207
|
+
|
|
3208
|
+
|
|
3209
|
+
|
|
3210
|
+
|
|
3211
|
+
|
|
3212
|
+
|
|
3213
|
+
|
|
3214
|
+
|
|
3215
|
+
|
|
3216
|
+
|
|
3217
|
+
|
|
3218
|
+
|
|
3219
|
+
|
|
3220
|
+
|
|
3221
|
+
|
|
3222
|
+
|
|
3223
|
+
|
|
3224
|
+
|
|
3225
|
+
|
|
3226
|
+
|
|
3227
|
+
|
|
3228
|
+
|
|
3229
|
+
|
|
3230
|
+
|
|
3231
|
+
|
|
3232
|
+
|
|
3233
|
+
|
|
3234
|
+
|
|
3235
|
+
|
|
3236
|
+
|
|
3237
|
+
|
|
3238
|
+
|
|
3239
|
+
</dl>
|
|
3240
|
+
|
|
3241
|
+
|
|
3242
|
+
|
|
3243
|
+
|
|
3244
|
+
|
|
3245
|
+
|
|
3246
|
+
|
|
3247
|
+
|
|
3248
|
+
|
|
3249
|
+
<h5>Parameters:</h5>
|
|
3250
|
+
|
|
3251
|
+
|
|
3252
|
+
<table class="params">
|
|
3253
|
+
<thead>
|
|
3254
|
+
<tr>
|
|
3255
|
+
|
|
3256
|
+
<th>Name</th>
|
|
3257
|
+
|
|
3258
|
+
|
|
3259
|
+
<th>Type</th>
|
|
3260
|
+
|
|
3261
|
+
|
|
3262
|
+
|
|
3263
|
+
|
|
3264
|
+
|
|
3265
|
+
<th class="last">Description</th>
|
|
3266
|
+
</tr>
|
|
3267
|
+
</thead>
|
|
3268
|
+
|
|
3269
|
+
<tbody>
|
|
3270
|
+
|
|
3271
|
+
|
|
3272
|
+
<tr>
|
|
3273
|
+
|
|
3274
|
+
<td class="name"><code>obj</code></td>
|
|
3275
|
+
|
|
3276
|
+
|
|
3277
|
+
<td class="type">
|
|
3278
|
+
|
|
3279
|
+
|
|
3280
|
+
<span class="param-type"><code>object</code></span>
|
|
3281
|
+
|
|
3282
|
+
|
|
3283
|
+
|
|
3284
|
+
</td>
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
|
|
3288
|
+
|
|
3289
|
+
|
|
3290
|
+
<td class="description last">
|
|
3291
|
+
<p>the specified object.</p>
|
|
3292
|
+
|
|
3293
|
+
</td>
|
|
3294
|
+
</tr>
|
|
3295
|
+
|
|
3296
|
+
|
|
3297
|
+
</tbody>
|
|
3298
|
+
</table>
|
|
3299
|
+
|
|
3300
|
+
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
|
|
3307
|
+
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
|
|
3311
|
+
|
|
3312
|
+
|
|
3313
|
+
<div class="section-throws">
|
|
3314
|
+
<h5>Throws:</h5>
|
|
3315
|
+
|
|
3316
|
+
|
|
3317
|
+
|
|
3318
|
+
<div class="param-desc">
|
|
3319
|
+
|
|
3320
|
+
<p>TypeError
|
|
3321
|
+
if the specified object is not nullish and is not a instance of this
|
|
3322
|
+
class.</p>
|
|
3323
|
+
|
|
3324
|
+
</div>
|
|
3325
|
+
|
|
3326
|
+
|
|
3327
|
+
|
|
3328
|
+
</div>
|
|
3329
|
+
|
|
3330
|
+
|
|
3331
|
+
|
|
3332
|
+
<div class="section-returns">
|
|
3333
|
+
<h5>Returns:</h5>
|
|
3334
|
+
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
<dl class="param-type">
|
|
3338
|
+
<dt>
|
|
3339
|
+
Type:
|
|
3340
|
+
</dt>
|
|
3341
|
+
<dd>
|
|
3342
|
+
|
|
3343
|
+
<span class="param-type"><code>boolean</code></span>
|
|
3344
|
+
|
|
3345
|
+
|
|
3346
|
+
</dd>
|
|
3347
|
+
</dl>
|
|
3348
|
+
|
|
3349
|
+
|
|
3350
|
+
<div class="param-desc">
|
|
3351
|
+
<p><code>true</code> if the specified object is <code>undefined</code>, or <code>null</code> or an empty
|
|
3352
|
+
instance of this class; <code>false</code> otherwise.</p>
|
|
3353
|
+
</div>
|
|
3354
|
+
|
|
3355
|
+
|
|
3356
|
+
</div>
|
|
3357
|
+
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
|
|
3362
|
+
</div>
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
<div class="section-method">
|
|
3366
|
+
|
|
3367
|
+
|
|
3368
|
+
|
|
3369
|
+
|
|
3370
|
+
<h4 class="name" id=".Class.parseJsonString"><span class="type-signature">(static) </span>Class.parseJsonString<span class="signature">(json, options)</span><span class="type-signature"> → {object}</span></h4>
|
|
3371
|
+
|
|
3372
|
+
|
|
3373
|
+
|
|
3374
|
+
|
|
3375
|
+
|
|
3376
|
+
|
|
3377
|
+
<div class="description">
|
|
3378
|
+
<p>Parses an object of this class from a JSON string.</p>
|
|
3379
|
+
<p><strong>NOTE:</strong> This method supports integer values fall out of IEEE 754 integer
|
|
3380
|
+
precision. For example, the integer value <code>9223372036854775807</code> will be
|
|
3381
|
+
parsed as the native <code>bigint</code> value <code>9223372036854775807n</code>.</p>
|
|
3382
|
+
</div>
|
|
3383
|
+
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
|
|
3387
|
+
|
|
3388
|
+
<dl class="details">
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
|
|
3393
|
+
|
|
3394
|
+
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
|
|
3406
|
+
|
|
3407
|
+
|
|
3408
|
+
|
|
3409
|
+
|
|
3410
|
+
|
|
3411
|
+
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
|
|
3415
|
+
|
|
3416
|
+
|
|
3417
|
+
|
|
3418
|
+
|
|
3419
|
+
<dt class="tag-see">See:</dt>
|
|
3420
|
+
<dd class="tag-see">
|
|
3421
|
+
<ul>
|
|
3422
|
+
<li>toJsonString()</li>
|
|
3423
|
+
</ul>
|
|
3424
|
+
</dd>
|
|
3425
|
+
|
|
3426
|
+
|
|
3427
|
+
|
|
3428
|
+
</dl>
|
|
3429
|
+
|
|
3430
|
+
|
|
3431
|
+
|
|
3432
|
+
|
|
3433
|
+
|
|
3434
|
+
|
|
3435
|
+
|
|
3436
|
+
|
|
3437
|
+
|
|
3438
|
+
<h5>Parameters:</h5>
|
|
3439
|
+
|
|
3440
|
+
|
|
3441
|
+
<table class="params">
|
|
3442
|
+
<thead>
|
|
3443
|
+
<tr>
|
|
3444
|
+
|
|
3445
|
+
<th>Name</th>
|
|
3446
|
+
|
|
3447
|
+
|
|
3448
|
+
<th>Type</th>
|
|
3449
|
+
|
|
3450
|
+
|
|
3451
|
+
|
|
3452
|
+
|
|
3453
|
+
|
|
3454
|
+
<th class="last">Description</th>
|
|
3455
|
+
</tr>
|
|
3456
|
+
</thead>
|
|
3457
|
+
|
|
3458
|
+
<tbody>
|
|
3459
|
+
|
|
3460
|
+
|
|
3461
|
+
<tr>
|
|
3462
|
+
|
|
3463
|
+
<td class="name"><code>json</code></td>
|
|
3464
|
+
|
|
3465
|
+
|
|
3466
|
+
<td class="type">
|
|
3467
|
+
|
|
3468
|
+
|
|
3469
|
+
<span class="param-type"><code>string</code></span>
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
|
|
3473
|
+
</td>
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
<td class="description last">
|
|
3480
|
+
<p>the JSON string to be parsed.</p>
|
|
3481
|
+
|
|
3482
|
+
</td>
|
|
3483
|
+
</tr>
|
|
3484
|
+
|
|
3485
|
+
|
|
3486
|
+
|
|
3487
|
+
<tr>
|
|
3488
|
+
|
|
3489
|
+
<td class="name"><code>options</code></td>
|
|
3490
|
+
|
|
3491
|
+
|
|
3492
|
+
<td class="type">
|
|
3493
|
+
|
|
3494
|
+
|
|
3495
|
+
<span class="param-type"><code>null</code></span>
|
|
3496
|
+
|
|
|
3497
|
+
|
|
3498
|
+
<span class="param-type"><code>undefined</code></span>
|
|
3499
|
+
|
|
|
3500
|
+
|
|
3501
|
+
<span class="param-type"><code>object</code></span>
|
|
3502
|
+
|
|
3503
|
+
|
|
3504
|
+
|
|
3505
|
+
</td>
|
|
3506
|
+
|
|
3507
|
+
|
|
3508
|
+
|
|
3509
|
+
|
|
3510
|
+
|
|
3511
|
+
<td class="description last">
|
|
3512
|
+
<p>the additional options for the parsing. If this argument is
|
|
3513
|
+
<code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
3514
|
+
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.
|
|
3515
|
+
Available options are:</p>
|
|
3516
|
+
<ul>
|
|
3517
|
+
<li><code>normalize: boolean</code>, indicates whether to normalize this object
|
|
3518
|
+
after the assignment. The default value is <code>true</code>.</li>
|
|
3519
|
+
<li><code>convertNaming: boolean</code>, indicates whether to convert the naming
|
|
3520
|
+
style of the target object. The default value is <code>false</code>.</li>
|
|
3521
|
+
<li><code>sourceNamingStyle: string</code>, the naming style of the source object,
|
|
3522
|
+
i.e., the first argument of the <code>assign()</code> method. The default
|
|
3523
|
+
value of this argument is <code>'LOWER_UNDERSCORE'</code>.</li>
|
|
3524
|
+
<li><code>targetNamingStyle: string</code>, the naming style of the target object,
|
|
3525
|
+
i.e., the object calling the <code>assign()</code> method. The default value
|
|
3526
|
+
of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
3527
|
+
</ul>
|
|
3528
|
+
|
|
3529
|
+
</td>
|
|
3530
|
+
</tr>
|
|
3531
|
+
|
|
3532
|
+
|
|
3533
|
+
</tbody>
|
|
3534
|
+
</table>
|
|
3535
|
+
|
|
3536
|
+
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
|
|
3540
|
+
|
|
3541
|
+
|
|
3542
|
+
|
|
3543
|
+
|
|
3544
|
+
|
|
3545
|
+
|
|
3546
|
+
|
|
3547
|
+
|
|
3548
|
+
|
|
3549
|
+
|
|
3550
|
+
|
|
3551
|
+
<div class="section-returns">
|
|
3552
|
+
<h5>Returns:</h5>
|
|
3553
|
+
|
|
3554
|
+
|
|
3555
|
+
|
|
3556
|
+
<dl class="param-type">
|
|
3557
|
+
<dt>
|
|
3558
|
+
Type:
|
|
3559
|
+
</dt>
|
|
3560
|
+
<dd>
|
|
3561
|
+
|
|
3562
|
+
<span class="param-type"><code>object</code></span>
|
|
3563
|
+
|
|
3564
|
+
|
|
3565
|
+
</dd>
|
|
3566
|
+
</dl>
|
|
3567
|
+
|
|
3568
|
+
|
|
3569
|
+
<div class="param-desc">
|
|
3570
|
+
<p>the object deserialized from the specified JSON string.</p>
|
|
3571
|
+
</div>
|
|
3572
|
+
|
|
3573
|
+
|
|
3574
|
+
</div>
|
|
3575
|
+
|
|
3576
|
+
|
|
3577
|
+
|
|
3578
|
+
|
|
3579
|
+
|
|
3580
|
+
</div>
|
|
3581
|
+
|
|
3582
|
+
|
|
3583
|
+
|
|
3584
|
+
|
|
3585
|
+
|
|
3586
|
+
|
|
3587
|
+
</article>
|
|
3588
|
+
|
|
3589
|
+
</section>
|
|
3590
|
+
|
|
3591
|
+
|
|
3592
|
+
|
|
3593
|
+
|
|
3594
|
+
</div>
|
|
3595
|
+
|
|
3596
|
+
<br class="clear">
|
|
3597
|
+
|
|
3598
|
+
<footer>
|
|
3599
|
+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
3600
|
+
on Mon Jan 06 2025 12:25:48 GMT+0800 (China Standard Time)
|
|
3601
|
+
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
3602
|
+
</footer>
|
|
3603
|
+
|
|
3604
|
+
<script>prettyPrint();</script>
|
|
3605
|
+
<script src="scripts/linenumber.js"></script>
|
|
3606
|
+
</body>
|
|
3607
|
+
</html>
|