Skip to content

Commit 6c7494b

Browse files
committed
Fixes #50, #135.
1 parent ce7e5e3 commit 6c7494b

File tree

7 files changed

+40
-26
lines changed

7 files changed

+40
-26
lines changed

nodejs/scripts/jsonix.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,7 @@ Jsonix.Binding.Unmarshaller.Simplified = Jsonix.Class(Jsonix.Binding.Unmarshalle
21082108
CLASS_NAME : 'Jsonix.Binding.Unmarshaller.Simplified'
21092109
});
21102110
Jsonix.Model.TypeInfo = Jsonix.Class({
2111+
module: null,
21112112
name : null,
21122113
baseTypeInfo : null,
21132114
initialize : function() {
@@ -2199,17 +2200,17 @@ Jsonix.Model.ClassInfo = Jsonix
21992200
// Obsolete
22002201
destroy : function() {
22012202
},
2202-
build : function(context, module) {
2203+
build : function(context) {
22032204
if (!this.built) {
2204-
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, module);
2205+
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, this.module);
22052206
if (Jsonix.Util.Type.exists(this.baseTypeInfo)) {
2206-
this.baseTypeInfo.build(context, module);
2207+
this.baseTypeInfo.build(context);
22072208
}
22082209

22092210
// Build properties in this context
22102211
for ( var index = 0; index < this.properties.length; index++) {
22112212
var propertyInfo = this.properties[index];
2212-
propertyInfo.build(context, module);
2213+
propertyInfo.build(context, this.module);
22132214
}
22142215

22152216
// Build the structure
@@ -2553,10 +2554,10 @@ Jsonix.Model.EnumLeafInfo = Jsonix.Class(Jsonix.Model.TypeInfo, {
25532554
this.entries = vs;
25542555
}
25552556
},
2556-
build : function(context, module) {
2557+
build : function(context) {
25572558
if (!this.built) {
2558-
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, module);
2559-
this.baseTypeInfo.build(context, module);
2559+
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, this.module);
2560+
this.baseTypeInfo.build(context);
25602561
var items = this.entries;
25612562
var entries = {};
25622563
var keys = [];
@@ -2687,6 +2688,7 @@ Jsonix.Model.EnumLeafInfo = Jsonix.Class(Jsonix.Model.TypeInfo, {
26872688
CLASS_NAME : 'Jsonix.Model.EnumLeafInfo'
26882689
});
26892690
Jsonix.Model.ElementInfo = Jsonix.Class({
2691+
module: null,
26902692
elementName : null,
26912693
typeInfo : null,
26922694
substitutionHead : null,
@@ -2715,11 +2717,11 @@ Jsonix.Model.ElementInfo = Jsonix.Class({
27152717
var sc = mapping.scope||mapping.sc||null;
27162718
this.scope = sc;
27172719
},
2718-
build : function(context, module) {
2720+
build : function(context) {
27192721
// If element info is not yet built
27202722
if (!this.built) {
2721-
this.typeInfo = context.resolveTypeInfo(this.typeInfo, module);
2722-
this.scope = context.resolveTypeInfo(this.scope, module);
2723+
this.typeInfo = context.resolveTypeInfo(this.typeInfo, this.module);
2724+
this.scope = context.resolveTypeInfo(this.scope, this.module);
27232725
this.built = true;
27242726
}
27252727
},
@@ -3874,6 +3876,7 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
38743876
var classInfo = new this.mappingStyle.classInfo(mapping, {
38753877
mappingStyle : this.mappingStyle
38763878
});
3879+
classInfo.module = this;
38773880
return classInfo;
38783881
},
38793882
createEnumLeafInfo : function(mapping) {
@@ -3883,6 +3886,7 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
38833886
var enumLeafInfo = new this.mappingStyle.enumLeafInfo(mapping, {
38843887
mappingStyle : this.mappingStyle
38853888
});
3889+
enumLeafInfo.module = this;
38863890
return enumLeafInfo;
38873891
},
38883892
createList : function(mapping) {
@@ -3899,7 +3903,9 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
38993903
}
39003904
var s = mapping.separator || mapping.sep || ' ';
39013905
Jsonix.Util.Ensure.ensureExists(ti);
3902-
return new Jsonix.Schema.XSD.List(ti, tn, s);
3906+
var listTypeInfo = new Jsonix.Schema.XSD.List(ti, tn, s);
3907+
listTypeInfo.module = this;
3908+
return listTypeInfo;
39033909
},
39043910
createElementInfo : function(mapping) {
39053911
Jsonix.Util.Ensure.ensureObject(mapping);
@@ -3935,6 +3941,7 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
39353941
var elementInfo = new this.mappingStyle.elementInfo(mapping, {
39363942
mappingStyle : this.mappingStyle
39373943
});
3944+
elementInfo.module = this;
39383945
return elementInfo;
39393946
},
39403947
registerTypeInfos : function(context) {
@@ -4138,9 +4145,9 @@ Jsonix.Schema.XSD.List = Jsonix
41384145
this.trimmedSeparator = trimmedSeparator;
41394146
}
41404147
},
4141-
build : function(context, module) {
4148+
build : function(context) {
41424149
if (!this.built) {
4143-
this.typeInfo = context.resolveTypeInfo(this.typeInfo, module);
4150+
this.typeInfo = context.resolveTypeInfo(this.typeInfo, this.module);
41444151
this.built = true;
41454152
}
41464153
},

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/ClassInfo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ Jsonix.Model.ClassInfo = Jsonix
7373
// Obsolete
7474
destroy : function() {
7575
},
76-
build : function(context, module) {
76+
build : function(context) {
7777
if (!this.built) {
78-
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, module);
78+
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, this.module);
7979
if (Jsonix.Util.Type.exists(this.baseTypeInfo)) {
80-
this.baseTypeInfo.build(context, module);
80+
this.baseTypeInfo.build(context);
8181
}
8282

8383
// Build properties in this context
8484
for ( var index = 0; index < this.properties.length; index++) {
8585
var propertyInfo = this.properties[index];
86-
propertyInfo.build(context, module);
86+
propertyInfo.build(context, this.module);
8787
}
8888

8989
// Build the structure

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/ElementInfo.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Jsonix.Model.ElementInfo = Jsonix.Class({
2+
module: null,
23
elementName : null,
34
typeInfo : null,
45
substitutionHead : null,
@@ -27,11 +28,11 @@ Jsonix.Model.ElementInfo = Jsonix.Class({
2728
var sc = mapping.scope||mapping.sc||null;
2829
this.scope = sc;
2930
},
30-
build : function(context, module) {
31+
build : function(context) {
3132
// If element info is not yet built
3233
if (!this.built) {
33-
this.typeInfo = context.resolveTypeInfo(this.typeInfo, module);
34-
this.scope = context.resolveTypeInfo(this.scope, module);
34+
this.typeInfo = context.resolveTypeInfo(this.typeInfo, this.module);
35+
this.scope = context.resolveTypeInfo(this.scope, this.module);
3536
this.built = true;
3637
}
3738
},

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/EnumLeafInfo.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ Jsonix.Model.EnumLeafInfo = Jsonix.Class(Jsonix.Model.TypeInfo, {
2626
this.entries = vs;
2727
}
2828
},
29-
build : function(context, module) {
29+
build : function(context) {
3030
if (!this.built) {
31-
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, module);
32-
this.baseTypeInfo.build(context, module);
31+
this.baseTypeInfo = context.resolveTypeInfo(this.baseTypeInfo, this.module);
32+
this.baseTypeInfo.build(context);
3333
var items = this.entries;
3434
var entries = {};
3535
var keys = [];

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/Module.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
137137
var classInfo = new this.mappingStyle.classInfo(mapping, {
138138
mappingStyle : this.mappingStyle
139139
});
140+
classInfo.module = this;
140141
return classInfo;
141142
},
142143
createEnumLeafInfo : function(mapping) {
@@ -146,6 +147,7 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
146147
var enumLeafInfo = new this.mappingStyle.enumLeafInfo(mapping, {
147148
mappingStyle : this.mappingStyle
148149
});
150+
enumLeafInfo.module = this;
149151
return enumLeafInfo;
150152
},
151153
createList : function(mapping) {
@@ -162,7 +164,9 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
162164
}
163165
var s = mapping.separator || mapping.sep || ' ';
164166
Jsonix.Util.Ensure.ensureExists(ti);
165-
return new Jsonix.Schema.XSD.List(ti, tn, s);
167+
var listTypeInfo = new Jsonix.Schema.XSD.List(ti, tn, s);
168+
listTypeInfo.module = this;
169+
return listTypeInfo;
166170
},
167171
createElementInfo : function(mapping) {
168172
Jsonix.Util.Ensure.ensureObject(mapping);
@@ -198,6 +202,7 @@ Jsonix.Model.Module = Jsonix.Class(Jsonix.Mapping.Styled, {
198202
var elementInfo = new this.mappingStyle.elementInfo(mapping, {
199203
mappingStyle : this.mappingStyle
200204
});
205+
elementInfo.module = this;
201206
return elementInfo;
202207
},
203208
registerTypeInfos : function(context) {

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/TypeInfo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Jsonix.Model.TypeInfo = Jsonix.Class({
2+
module: null,
23
name : null,
34
baseTypeInfo : null,
45
initialize : function() {

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Schema/XSD/List.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Jsonix.Schema.XSD.List = Jsonix
3636
this.trimmedSeparator = trimmedSeparator;
3737
}
3838
},
39-
build : function(context, module) {
39+
build : function(context) {
4040
if (!this.built) {
41-
this.typeInfo = context.resolveTypeInfo(this.typeInfo, module);
41+
this.typeInfo = context.resolveTypeInfo(this.typeInfo, this.module);
4242
this.built = true;
4343
}
4444
},

0 commit comments

Comments
 (0)