Skip to content

Commit

Permalink
Fixes #132.
Browse files Browse the repository at this point in the history
  • Loading branch information
highsource committed Dec 28, 2015
1 parent 8e27a90 commit a85473c
Show file tree
Hide file tree
Showing 19 changed files with 629 additions and 534 deletions.
71 changes: 59 additions & 12 deletions nodejs/scripts/jsonix.js
Original file line number Diff line number Diff line change
Expand Up @@ -4059,10 +4059,13 @@ Jsonix.Schema.XSD.AnySimpleType = Jsonix.Class(Jsonix.Model.TypeInfo, {
Jsonix.Model.TypeInfo.prototype.initialize.apply(this, []);
},
print : function(value, context, output, scope) {
throw new Error('Abstract method [print].');
return value;
},
parse : function(text, context, input, scope) {
throw new Error('Abstract method [parse].');
return text;
},
isInstance : function(value, context, scope) {
return true;
},
reprint : function(value, context, output, scope) {
// Only reprint when the value is a string but not an instance
Expand Down Expand Up @@ -4096,7 +4099,7 @@ Jsonix.Schema.XSD.AnySimpleType = Jsonix.Class(Jsonix.Model.TypeInfo, {
},
CLASS_NAME : 'Jsonix.Schema.XSD.AnySimpleType'
});

Jsonix.Schema.XSD.AnySimpleType.INSTANCE = new Jsonix.Schema.XSD.AnySimpleType();
Jsonix.Schema.XSD.List = Jsonix
.Class(
Jsonix.Schema.XSD.AnySimpleType,
Expand Down Expand Up @@ -5315,6 +5318,20 @@ Jsonix.Schema.XSD.Duration.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Sch
Jsonix.Schema.XSD.DateTime = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'DateTime',
typeName : Jsonix.Schema.XSD.qname('dateTime'),
parse : function(value, context, input, scope) {
return this.parseDateTime(value);
},
print : function(value, context, output, scope) {
return this.printDateTime(value);
},
CLASS_NAME : 'Jsonix.Schema.XSD.DateTime'
});
Jsonix.Schema.XSD.DateTime.INSTANCE = new Jsonix.Schema.XSD.DateTime();
Jsonix.Schema.XSD.DateTime.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTime.INSTANCE);

Jsonix.Schema.XSD.DateTimeAsDate = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'DateTimeAsDate',
typeName : Jsonix.Schema.XSD.qname('dateTime'),
parse : function(value, context, input, scope) {
var calendar = this.parseDateTime(value);
var date = new Date();
Expand Down Expand Up @@ -5403,14 +5420,27 @@ Jsonix.Schema.XSD.DateTime = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
isInstance : function(value, context, scope) {
return Jsonix.Util.Type.isDate(value);
},
CLASS_NAME : 'Jsonix.Schema.XSD.DateTime'
CLASS_NAME : 'Jsonix.Schema.XSD.DateTimeAsDate'
});
Jsonix.Schema.XSD.DateTime.INSTANCE = new Jsonix.Schema.XSD.DateTime();
Jsonix.Schema.XSD.DateTime.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTime.INSTANCE);
Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE = new Jsonix.Schema.XSD.DateTimeAsDate();
Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE);

Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'Time',
typeName : Jsonix.Schema.XSD.qname('time'),
parse : function(value, context, input, scope) {
return this.parseTime(value);
},
print : function(value, context, output, scope) {
return this.printTime(value);
},
CLASS_NAME : 'Jsonix.Schema.XSD.Time'
});
Jsonix.Schema.XSD.Time.INSTANCE = new Jsonix.Schema.XSD.Time();
Jsonix.Schema.XSD.Time.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Time.INSTANCE);
Jsonix.Schema.XSD.TimeAsDate = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'TimeAsDate',
typeName : Jsonix.Schema.XSD.qname('time'),
parse : function(value, context, input, scope) {
var calendar = this.parseTime(value);
var date = new Date();
Expand Down Expand Up @@ -5512,13 +5542,26 @@ Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
isInstance : function(value, context, scope) {
return Jsonix.Util.Type.isDate(value) && value.getTime() > -86400000 && value.getTime() < 86400000;
},
CLASS_NAME : 'Jsonix.Schema.XSD.Time'
CLASS_NAME : 'Jsonix.Schema.XSD.TimeAsDate'
});
Jsonix.Schema.XSD.Time.INSTANCE = new Jsonix.Schema.XSD.Time();
Jsonix.Schema.XSD.Time.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Time.INSTANCE);
Jsonix.Schema.XSD.TimeAsDate.INSTANCE = new Jsonix.Schema.XSD.TimeAsDate();
Jsonix.Schema.XSD.TimeAsDate.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.TimeAsDate.INSTANCE);
Jsonix.Schema.XSD.Date = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'Date',
typeName : Jsonix.Schema.XSD.qname('date'),
parse : function(value, context, input, scope) {
return this.parseDate(value);
},
print : function(value, context, output, scope) {
return this.printDate(value);
},
CLASS_NAME : 'Jsonix.Schema.XSD.Date'
});
Jsonix.Schema.XSD.Date.INSTANCE = new Jsonix.Schema.XSD.Date();
Jsonix.Schema.XSD.Date.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Date.INSTANCE);
Jsonix.Schema.XSD.DateAsDate = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'DateAsDate',
typeName : Jsonix.Schema.XSD.qname('date'),
parse : function(value, context, input, scope) {
var calendar = this.parseDate(value);
var date = new Date();
Expand Down Expand Up @@ -5627,10 +5670,10 @@ Jsonix.Schema.XSD.Date = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
isInstance : function(value, context, scope) {
return Jsonix.Util.Type.isDate(value);
},
CLASS_NAME : 'Jsonix.Schema.XSD.Date'
CLASS_NAME : 'Jsonix.Schema.XSD.DateAsDate'
});
Jsonix.Schema.XSD.Date.INSTANCE = new Jsonix.Schema.XSD.Date();
Jsonix.Schema.XSD.Date.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Date.INSTANCE);
Jsonix.Schema.XSD.DateAsDate.INSTANCE = new Jsonix.Schema.XSD.DateAsDate();
Jsonix.Schema.XSD.DateAsDate.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateAsDate.INSTANCE);
Jsonix.Schema.XSD.GYearMonth = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
name : 'GYearMonth',
typeName : Jsonix.Schema.XSD.qname('gYearMonth'),
Expand Down Expand Up @@ -5998,12 +6041,15 @@ Jsonix.Context = Jsonix
*/
builtinTypeInfos : [
Jsonix.Schema.XSD.AnyType.INSTANCE,
Jsonix.Schema.XSD.AnySimpleType.INSTANCE,
Jsonix.Schema.XSD.AnyURI.INSTANCE,
Jsonix.Schema.XSD.Base64Binary.INSTANCE,
Jsonix.Schema.XSD.Boolean.INSTANCE,
Jsonix.Schema.XSD.Byte.INSTANCE,
Jsonix.Schema.XSD.Calendar.INSTANCE,
Jsonix.Schema.XSD.DateAsDate.INSTANCE,
Jsonix.Schema.XSD.Date.INSTANCE,
Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE,
Jsonix.Schema.XSD.DateTime.INSTANCE,
Jsonix.Schema.XSD.Decimal.INSTANCE,
Jsonix.Schema.XSD.Double.INSTANCE,
Expand Down Expand Up @@ -6036,6 +6082,7 @@ Jsonix.Context = Jsonix
Jsonix.Schema.XSD.Short.INSTANCE,
Jsonix.Schema.XSD.String.INSTANCE,
Jsonix.Schema.XSD.Strings.INSTANCE,
Jsonix.Schema.XSD.TimeAsDate.INSTANCE,
Jsonix.Schema.XSD.Time.INSTANCE,
Jsonix.Schema.XSD.Token.INSTANCE,
Jsonix.Schema.XSD.UnsignedByte.INSTANCE,
Expand Down
Loading

0 comments on commit a85473c

Please sign in to comment.