How to use n.util.type method in sinon

Best JavaScript code snippet using sinon

Jsonix-min.js

Source:Jsonix-min.js Github

copy

Full Screen

1var _jsonix_factory = function(_jsonix_xmldom, _jsonix_xmlhttprequest, _jsonix_fs)2{3 // Complete Jsonix script is included below 4var Jsonix={singleFile:true};5Jsonix.Util={};6Jsonix.Util.extend=function(f,g){f=f||{};7if(g){for(var h in g){var e=g[h];8if(e!==undefined){f[h]=e9}}sourceIsEvt=typeof window!=="undefined"&&window!==null&&typeof window.Event==="function"&&g instanceof window.Event;10if(!sourceIsEvt&&g.hasOwnProperty&&g.hasOwnProperty("toString")){f.toString=g.toString11}}return f12};13Jsonix.Class=function(){var n=function(){this.initialize.apply(this,arguments)14};15var p={};16var k=function(){};17var l,i,o;18for(var m=0,j=arguments.length;19m<j;20++m){o=arguments[m];21if(typeof o=="function"){if(m===0&&j>1){i=o.prototype.initialize;22o.prototype.initialize=k;23p=new o();24if(i===undefined){delete o.prototype.initialize25}else{o.prototype.initialize=i26}}l=o.prototype27}else{l=o28}Jsonix.Util.extend(p,l)29}n.prototype=p;30return n31};32Jsonix.XML={XMLNS_NS:"http://www.w3.org/2000/xmlns/",XMLNS_P:"xmlns"};33Jsonix.DOM={isDomImplementationAvailable:function(){if(typeof _jsonix_xmldom!=="undefined"){return true34}else{if(typeof document!=="undefined"&&Jsonix.Util.Type.exists(document.implementation)&&Jsonix.Util.Type.isFunction(document.implementation.createDocument)){return true35}else{return false36}}},createDocument:function(){if(typeof _jsonix_xmldom!=="undefined"){return new (_jsonix_xmldom.DOMImplementation)().createDocument()37}else{if(typeof document!=="undefined"&&Jsonix.Util.Type.exists(document.implementation)&&Jsonix.Util.Type.isFunction(document.implementation.createDocument)){return document.implementation.createDocument("","",null)38}else{if(typeof ActiveXObject!=="undefined"){return new ActiveXObject("MSXML2.DOMDocument")39}else{throw new Error("Error created the DOM document.")40}}}},serialize:function(b){Jsonix.Util.Ensure.ensureExists(b);41if(typeof _jsonix_xmldom!=="undefined"){return(new (_jsonix_xmldom).XMLSerializer()).serializeToString(b)42}else{if(Jsonix.Util.Type.exists(XMLSerializer)){return(new XMLSerializer()).serializeToString(b)43}else{if(Jsonix.Util.Type.exists(b.xml)){return b.xml44}else{throw new Error("Could not serialize the node, neither XMLSerializer nor the [xml] property were found.")45}}}},parse:function(g){Jsonix.Util.Ensure.ensureExists(g);46if(typeof _jsonix_xmldom!=="undefined"){return(new (_jsonix_xmldom).DOMParser()).parseFromString(g,"application/xml")47}else{if(typeof DOMParser!="undefined"){return(new DOMParser()).parseFromString(g,"application/xml")48}else{if(typeof ActiveXObject!="undefined"){var h=Jsonix.DOM.createDocument("","");49h.loadXML(g);50return h51}else{var f="data:text/xml;charset=utf-8,"+encodeURIComponent(g);52var e=new XMLHttpRequest();53e.open("GET",f,false);54if(e.overrideMimeType){e.overrideMimeType("text/xml")55}e.send(null);56return e.responseXML57}}}},load:function(e,g,f){var h=Jsonix.Request.INSTANCE;58h.issue(e,function(a){var b;59if(Jsonix.Util.Type.exists(a.responseXML)&&Jsonix.Util.Type.exists(a.responseXML.documentElement)){b=a.responseXML60}else{if(Jsonix.Util.Type.isString(a.responseText)){b=Jsonix.DOM.parse(a.responseText)61}else{throw new Error("Response does not have valid [responseXML] or [responseText].")62}}g(b)63},function(a){throw new Error("Could not retrieve XML from URL ["+e+"].")64},f)65},xlinkFixRequired:null,isXlinkFixRequired:function(){if(Jsonix.DOM.xlinkFixRequired===null){if(typeof navigator==="undefined"){Jsonix.DOM.xlinkFixRequired=false66}else{if(!!navigator.userAgent&&(/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor))){var f=Jsonix.DOM.createDocument();67var d=f.createElement("test");68d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","urn:test");69f.appendChild(d);70var e=Jsonix.DOM.serialize(f);71Jsonix.DOM.xlinkFixRequired=(e.indexOf("xmlns:xlink")===-1)72}else{Jsonix.DOM.xlinkFixRequired=false73}}}return Jsonix.DOM.xlinkFixRequired74}};75Jsonix.Request=Jsonix.Class({factories:[function(){return new XMLHttpRequest()76},function(){return new ActiveXObject("Msxml2.XMLHTTP")77},function(){return new ActiveXObject("Msxml2.XMLHTTP.6.0")78},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")79},function(){return new ActiveXObject("Microsoft.XMLHTTP")80},function(){if(typeof _jsonix_xmlhttprequest!=="undefined"){var b=_jsonix_xmlhttprequest.XMLHttpRequest;81return new b()82}else{return null83}}],initialize:function(){},issue:function(y,q,x,n){Jsonix.Util.Ensure.ensureString(y);84if(Jsonix.Util.Type.exists(q)){Jsonix.Util.Ensure.ensureFunction(q)85}else{q=function(){}86}if(Jsonix.Util.Type.exists(x)){Jsonix.Util.Ensure.ensureFunction(x)87}else{x=function(){}88}if(Jsonix.Util.Type.exists(n)){Jsonix.Util.Ensure.ensureObject(n)89}else{n={}90}var w=this.createTransport();91var z=Jsonix.Util.Type.isString(n.method)?n.method:"GET";92var v=Jsonix.Util.Type.isBoolean(n.async)?n.async:true;93var p=Jsonix.Util.Type.isString(n.proxy)?n.proxy:Jsonix.Request.PROXY;94var u=Jsonix.Util.Type.isString(n.user)?n.user:null;95var o=Jsonix.Util.Type.isString(n.password)?n.password:null;96if(Jsonix.Util.Type.isString(p)&&(y.indexOf("http")===0)){y=p+encodeURIComponent(y)97}if(Jsonix.Util.Type.isString(u)){w.open(z,y,v,u,o)98}else{w.open(z,y,v)99}if(Jsonix.Util.Type.isObject(n.headers)){for(var s in n.headers){if(n.headers.hasOwnProperty(s)){w.setRequestHeader(s,n.headers[s])100}}}var t=Jsonix.Util.Type.exists(n.data)?n.data:null;101if(!v){w.send(t);102this.handleTransport(w,q,x)103}else{var r=this;104if(typeof window!=="undefined"){w.onreadystatechange=function(){r.handleTransport(w,q,x)105};106window.setTimeout(function(){w.send(t)107},0)108}else{w.onreadystatechange=function(){r.handleTransport(w,q,x)109};110w.send(t)111}}return w112},handleTransport:function(f,d,e){if(f.readyState==4){if(!f.status||(f.status>=200&&f.status<300)){d(f)113}if(f.status&&(f.status<200||f.status>=300)){e(f)114}}},createTransport:function(){for(var f=0,e=this.factories.length;115f<e;116f++){try{var g=this.factories[f]();117if(g!==null){return g118}}catch(h){}}throw new Error("Could not create XML HTTP transport.")119},CLASS_NAME:"Jsonix.Request"});120Jsonix.Request.INSTANCE=new Jsonix.Request();121Jsonix.Request.PROXY=null;122Jsonix.Schema={};123Jsonix.Model={};124Jsonix.Util.Type={exists:function(b){return(typeof b!=="undefined"&&b!==null)125},isUndefined:function(b){return typeof b==="undefined"126},isString:function(b){return typeof b==="string"127},isBoolean:function(b){return typeof b==="boolean"128},isObject:function(b){return typeof b==="object"129},isFunction:function(b){return typeof b==="function"130},isNumber:function(b){return(typeof b==="number")&&!isNaN(b)131},isNumberOrNaN:function(b){return(b===+b)||(Object.prototype.toString.call(b)==="[object Number]")132},isNaN:function(b){return Jsonix.Util.Type.isNumberOrNaN(b)&&isNaN(b)133},isArray:function(b){return !!(b&&b.concat&&b.unshift&&!b.callee)134},isDate:function(b){return !!(b&&b.getTimezoneOffset&&b.setUTCFullYear)135},isRegExp:function(b){return !!(b&&b.test&&b.exec&&(b.ignoreCase||b.ignoreCase===false))136},isNode:function(b){return(typeof Node==="object"||typeof Node==="function")?(b instanceof Node):(b&&(typeof b==="object")&&(typeof b.nodeType==="number")&&(typeof b.nodeName==="string"))137},isEqual:function(u,w,A){var a=Jsonix.Util.Type.isFunction(A);138var y=function(g,e,m){var i=slice.call(arguments);139var h=i.length<=1;140var f=h?0:i[0];141var d=h?i[0]:i[1];142var j=i[2]||1;143var k=Math.max(Math.ceil((d-f)/j),0);144var c=0;145var l=new Array(k);146while(c<k){l[c++]=f;147f+=j148}return l149};150var x=Object.keys||function(e){if(Jsonix.Util.Type.isArray(e)){return y(0,e.length)151}var c=[];152for(var d in e){if(e.hasOwnProperty(d)){c[c.length]=d153}}return c154};155if(u===w){return true156}if(Jsonix.Util.Type.isNaN(u)&&Jsonix.Util.Type.isNaN(w)){return true157}var C=typeof u;158var E=typeof w;159if(C!=E){if(a){A("Types differ ["+C+"], ["+E+"].")160}return false161}if(u==w){return true162}if((!u&&w)||(u&&!w)){if(a){A("One is falsy, the other is truthy.")163}return false164}if(Jsonix.Util.Type.isDate(u)&&Jsonix.Util.Type.isDate(w)){return u.getTime()===w.getTime()165}if(Jsonix.Util.Type.isNaN(u)&&Jsonix.Util.Type.isNaN(w)){return false166}if(Jsonix.Util.Type.isRegExp(u)&&Jsonix.Util.Type.isRegExp(w)){return u.source===w.source&&u.global===w.global&&u.ignoreCase===w.ignoreCase&&u.multiline===w.multiline167}if(Jsonix.Util.Type.isNode(u)&&Jsonix.Util.Type.isNode(w)){var b=Jsonix.DOM.serialize(u);168var z=Jsonix.DOM.serialize(w);169if(b!==z){if(a){A("Nodes differ.");170A("A="+b);171A("B="+z)172}return false173}else{return true174}}if(C!=="object"){return false175}if(Jsonix.Util.Type.isArray(u)&&(u.length!==w.length)){if(a){A("Lengths differ.");176A("A.length="+u.length);177A("B.length="+w.length)178}return false179}var s=x(u);180var v=x(w);181if(s.length!==v.length){if(a){A("Different number of properties ["+s.length+"], ["+v.length+"].")182}for(var D=0;183D<s.length;184D++){if(a){A("A ["+s[D]+"]="+u[s[D]])185}}for(var F=0;186F<v.length;187F++){if(a){A("B ["+v[F]+"]="+w[v[F]])188}}return false189}for(var B=0;190B<s.length;191B++){var t=s[B];192if(!(t in w)||!Jsonix.Util.Type.isEqual(u[t],w[t],A)){if(a){A("One of the properties differ.");193A("Key: ["+t+"].");194A("Left: ["+u[t]+"].");195A("Right: ["+w[t]+"].")196}return false197}}return true198},cloneObject:function(e,f){f=f||{};199for(var d in e){if(e.hasOwnProperty(d)){f[d]=e[d]200}}return f201},defaultValue:function(){var i=arguments;202if(i.length===0){return undefined203}else{var g=i[i.length-1];204var f=typeof g;205for(var j=0;206j<i.length-1;207j++){var h=i[j];208if(typeof h===f){return h209}}return g210}}};211Jsonix.Util.NumberUtils={isInteger:function(b){return Jsonix.Util.Type.isNumber(b)&&((b%1)===0)212}};213Jsonix.Util.StringUtils={trim:(!!String.prototype.trim)?function(b){Jsonix.Util.Ensure.ensureString(b);214return b.trim()215}:function(b){Jsonix.Util.Ensure.ensureString(b);216return b.replace(/^\s\s*/,"").replace(/\s\s*$/,"")217},isEmpty:function(h){var c=h.length;218if(!c){return true219}for(var f=0;220f<c;221f++){var g=h[f];222if(g===" "){}else{if(g>"\u000D"&&g<"\u0085"){return false223}else{if(g<"\u00A0"){if(g<"\u0009"){return false224}else{if(g>"\u0085"){return false225}}}else{if(g>"\u00A0"){if(g<"\u2028"){if(g<"\u180E"){if(g<"\u1680"){return false226}else{if(g>"\u1680"){return false227}}}else{if(g>"\u180E"){if(g<"\u2000"){return false228}else{if(g>"\u200A"){return false229}}}}}else{if(g>"\u2029"){if(g<"\u205F"){if(g<"\u202F"){return false230}else{if(g>"\u202F"){return false231}}}else{if(g>"\u205F"){if(g<"\u3000"){return false232}else{if(g>"\u3000"){return false233}}}}}}}}}}}return true234},isNotBlank:function(b){return Jsonix.Util.Type.isString(b)&&!Jsonix.Util.StringUtils.isEmpty(b)235},whitespaceCharacters:"\u0009\u000A\u000B\u000C\u000D \u0085\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000",whitespaceCharactersMap:{"\u0009":true,"\u000A":true,"\u000B":true,"\u000C":true,"\u000D":true," ":true,"\u0085":true,"\u00A0":true,"\u1680":true,"\u180E":true,"\u2000":true,"\u2001":true,"\u2002":true,"\u2003":true,"\u2004":true,"\u2005":true,"\u2006":true,"\u2007":true,"\u2008":true,"\u2009":true,"\u200A":true,"\u2028":true,"\u2029":true,"\u202F":true,"\u205F":true,"\u3000":true},splitBySeparatorChars:function(n,u){Jsonix.Util.Ensure.ensureString(n);236Jsonix.Util.Ensure.ensureString(u);237var p=n.length;238if(p===0){return[]239}if(u.length===1){return n.split(u)240}else{var o=[];241var t=1;242var r=0;243var v=0;244var q=false;245var s=false;246var m=-1;247var i=false;248while(r<p){if(u.indexOf(n.charAt(r))>=0){if(q||i){s=true;249if(t++==m){r=p;250s=false251}o.push(n.substring(v,r));252q=false253}v=++r;254continue255}s=false;256q=true;257r++258}if(q||(i&&s)){o.push(n.substring(v,r))259}return o260}}};261Jsonix.Util.Ensure={ensureBoolean:function(b){if(!Jsonix.Util.Type.isBoolean(b)){throw new Error("Argument ["+b+"] must be a boolean.")262}},ensureString:function(b){if(!Jsonix.Util.Type.isString(b)){throw new Error("Argument ["+b+"] must be a string.")263}},ensureNumber:function(b){if(!Jsonix.Util.Type.isNumber(b)){throw new Error("Argument ["+b+"] must be a number.")264}},ensureNumberOrNaN:function(b){if(!Jsonix.Util.Type.isNumberOrNaN(b)){throw new Error("Argument ["+b+"] must be a number or NaN.")265}},ensureInteger:function(b){if(!Jsonix.Util.Type.isNumber(b)){throw new Error("Argument must be an integer, but it is not a number.")266}else{if(!Jsonix.Util.NumberUtils.isInteger(b)){throw new Error("Argument ["+b+"] must be an integer.")267}}},ensureDate:function(b){if(!(b instanceof Date)){throw new Error("Argument ["+b+"] must be a date.")268}},ensureObject:function(b){if(!Jsonix.Util.Type.isObject(b)){throw new Error("Argument ["+b+"] must be an object.")269}},ensureArray:function(b){if(!Jsonix.Util.Type.isArray(b)){throw new Error("Argument ["+b+"] must be an array.")270}},ensureFunction:function(b){if(!Jsonix.Util.Type.isFunction(b)){throw new Error("Argument ["+b+"] must be a function.")271}},ensureExists:function(b){if(!Jsonix.Util.Type.exists(b)){throw new Error("Argument ["+b+"] does not exist.")272}}};273Jsonix.XML.QName=Jsonix.Class({key:null,namespaceURI:null,localPart:null,prefix:null,string:null,initialize:function(n,j,r){var q;274var o;275var m;276var k;277var l;278if(!Jsonix.Util.Type.exists(j)){q="";279o=n;280m=""281}else{if(!Jsonix.Util.Type.exists(r)){q=Jsonix.Util.Type.exists(n)?n:"";282o=j;283var p=j.indexOf(":");284if(p>0&&p<j.length){m=j.substring(0,p);285o=j.substring(p+1)286}else{m="";287o=j288}}else{q=Jsonix.Util.Type.exists(n)?n:"";289o=j;290m=Jsonix.Util.Type.exists(r)?r:""291}}this.namespaceURI=q;292this.localPart=o;293this.prefix=m;294this.key=(q!==""?("{"+q+"}"):"")+o;295this.string=(q!==""?("{"+q+"}"):"")+(m!==""?(m+":"):"")+o296},toString:function(){return this.string297},toCanonicalString:function(c){var d=c?c.getPrefix(this.namespaceURI,this.prefix):this.prefix;298return this.prefix+(this.prefix===""?"":":")+this.localPart299},clone:function(){return new Jsonix.XML.QName(this.namespaceURI,this.localPart,this.prefix)300},equals:function(b){if(!b){return false301}else{return(this.namespaceURI==b.namespaceURI)&&(this.localPart==b.localPart)302}},CLASS_NAME:"Jsonix.XML.QName"});303Jsonix.XML.QName.fromString=function(n,r,m){var t=n.indexOf("{");304var l=n.lastIndexOf("}");305var s;306var k;307if((t===0)&&(l>0)&&(l<n.length)){s=n.substring(1,l);308k=n.substring(l+1)309}else{s=null;310k=n311}var q=k.indexOf(":");312var o;313var p;314if(q>0&&q<k.length){o=k.substring(0,q);315p=k.substring(q+1)316}else{o="";317p=k318}if(s===null){if(o===""&&Jsonix.Util.Type.isString(m)){s=m319}else{if(r){s=r.getNamespaceURI(o)320}}}if(!Jsonix.Util.Type.isString(s)){s=m||""321}return new Jsonix.XML.QName(s,p,o)322};323Jsonix.XML.QName.fromObject=function(h){Jsonix.Util.Ensure.ensureObject(h);324if(h instanceof Jsonix.XML.QName||(Jsonix.Util.Type.isString(h.CLASS_NAME)&&h.CLASS_NAME==="Jsonix.XML.QName")){return h325}var f=h.localPart||h.lp||null;326Jsonix.Util.Ensure.ensureString(f);327var e=h.namespaceURI||h.ns||"";328var g=h.prefix||h.p||"";329return new Jsonix.XML.QName(e,f,g)330};331Jsonix.XML.QName.fromObjectOrString=function(f,d,e){if(Jsonix.Util.Type.isString(f)){return Jsonix.XML.QName.fromString(f,d,e)332}else{return Jsonix.XML.QName.fromObject(f)333}};334Jsonix.XML.QName.key=function(f,e){Jsonix.Util.Ensure.ensureString(e);335if(f){var d=e.indexOf(":");336if(d>0&&d<e.length){localName=e.substring(d+1)337}else{localName=e338}return"{"+f+"}"+localName339}else{return e340}};341Jsonix.XML.Calendar=Jsonix.Class({year:NaN,month:NaN,day:NaN,hour:NaN,minute:NaN,second:NaN,fractionalSecond:NaN,timezone:NaN,date:null,initialize:function(f){Jsonix.Util.Ensure.ensureObject(f);342if(Jsonix.Util.Type.exists(f.year)){Jsonix.Util.Ensure.ensureInteger(f.year);343Jsonix.XML.Calendar.validateYear(f.year);344this.year=f.year345}else{this.year=NaN346}if(Jsonix.Util.Type.exists(f.month)){Jsonix.Util.Ensure.ensureInteger(f.month);347Jsonix.XML.Calendar.validateMonth(f.month);348this.month=f.month349}else{this.month=NaN350}if(Jsonix.Util.Type.exists(f.day)){Jsonix.Util.Ensure.ensureInteger(f.day);351if(Jsonix.Util.NumberUtils.isInteger(f.year)&&Jsonix.Util.NumberUtils.isInteger(f.month)){Jsonix.XML.Calendar.validateYearMonthDay(f.year,f.month,f.day)352}else{if(Jsonix.Util.NumberUtils.isInteger(f.month)){Jsonix.XML.Calendar.validateMonthDay(f.month,f.day)353}else{Jsonix.XML.Calendar.validateDay(f.day)354}}this.day=f.day355}else{this.day=NaN356}if(Jsonix.Util.Type.exists(f.hour)){Jsonix.Util.Ensure.ensureInteger(f.hour);357Jsonix.XML.Calendar.validateHour(f.hour);358this.hour=f.hour359}else{this.hour=NaN360}if(Jsonix.Util.Type.exists(f.minute)){Jsonix.Util.Ensure.ensureInteger(f.minute);361Jsonix.XML.Calendar.validateMinute(f.minute);362this.minute=f.minute363}else{this.minute=NaN364}if(Jsonix.Util.Type.exists(f.second)){Jsonix.Util.Ensure.ensureInteger(f.second);365Jsonix.XML.Calendar.validateSecond(f.second);366this.second=f.second367}else{this.second=NaN368}if(Jsonix.Util.Type.exists(f.fractionalSecond)){Jsonix.Util.Ensure.ensureNumber(f.fractionalSecond);369Jsonix.XML.Calendar.validateFractionalSecond(f.fractionalSecond);370this.fractionalSecond=f.fractionalSecond371}else{this.fractionalSecond=NaN372}if(Jsonix.Util.Type.exists(f.timezone)){if(Jsonix.Util.Type.isNaN(f.timezone)){this.timezone=NaN373}else{Jsonix.Util.Ensure.ensureInteger(f.timezone);374Jsonix.XML.Calendar.validateTimezone(f.timezone);375this.timezone=f.timezone376}}else{this.timezone=NaN377}var d=new Date(0);378d.setUTCFullYear(this.year||1970);379d.setUTCMonth(this.month-1||0);380d.setUTCDate(this.day||1);381d.setUTCHours(this.hour||0);382d.setUTCMinutes(this.minute||0);383d.setUTCSeconds(this.second||0);384d.setUTCMilliseconds((this.fractionalSecond||0)*1000);385var e=-60000*(this.timezone||0);386this.date=new Date(d.getTime()+e)387},CLASS_NAME:"Jsonix.XML.Calendar"});388Jsonix.XML.Calendar.MIN_TIMEZONE=-14*60;389Jsonix.XML.Calendar.MAX_TIMEZONE=14*60;390Jsonix.XML.Calendar.DAYS_IN_MONTH=[31,29,31,30,31,30,31,31,30,31,30,31];391Jsonix.XML.Calendar.fromObject=function(b){Jsonix.Util.Ensure.ensureObject(b);392if(Jsonix.Util.Type.isString(b.CLASS_NAME)&&b.CLASS_NAME==="Jsonix.XML.Calendar"){return b393}return new Jsonix.XML.Calendar(b)394};395Jsonix.XML.Calendar.validateYear=function(b){if(b===0){throw new Error("Invalid year ["+b+"]. Year must not be [0].")396}};397Jsonix.XML.Calendar.validateMonth=function(b){if(b<1||b>12){throw new Error("Invalid month ["+b+"]. Month must be in range [1, 12].")398}};399Jsonix.XML.Calendar.validateDay=function(b){if(b<1||b>31){throw new Error("Invalid day ["+b+"]. Day must be in range [1, 31].")400}};401Jsonix.XML.Calendar.validateMonthDay=function(f,d){Jsonix.XML.Calendar.validateMonth(f);402var e=Jsonix.XML.Calendar.DAYS_IN_MONTH[f-1];403if(d<1||d>Jsonix.XML.Calendar.DAYS_IN_MONTH[f-1]){throw new Error("Invalid day ["+d+"]. Day must be in range [1, "+e+"].")404}};405Jsonix.XML.Calendar.validateYearMonthDay=function(d,f,e){Jsonix.XML.Calendar.validateYear(d);406Jsonix.XML.Calendar.validateMonthDay(f,e)407};408Jsonix.XML.Calendar.validateHour=function(b){if(b<0||b>23){throw new Error("Invalid hour ["+b+"]. Hour must be in range [0, 23].")409}};410Jsonix.XML.Calendar.validateMinute=function(b){if(b<0||b>59){throw new Error("Invalid minute ["+b+"]. Minute must be in range [0, 59].")411}};412Jsonix.XML.Calendar.validateSecond=function(b){if(b<0||b>59){throw new Error("Invalid second ["+b+"]. Second must be in range [0, 59].")413}};414Jsonix.XML.Calendar.validateFractionalSecond=function(b){if(b<0||b>59){throw new Error("Invalid fractional second ["+b+"]. Fractional second must be in range [0, 1).")415}};416Jsonix.XML.Calendar.validateTimezone=function(b){if(b<Jsonix.XML.Calendar.MIN_TIMEZONE||b>Jsonix.XML.Calendar.MAX_TIMEZONE){throw new Error("Invalid timezone ["+b+"]. Timezone must not be in range ["+Jsonix.XML.Calendar.MIN_TIMEZONE+", "+Jsonix.XML.Calendar.MAX_TIMEZONE+"].")417}};418Jsonix.XML.Input=Jsonix.Class({root:null,node:null,attributes:null,eventType:null,pns:null,initialize:function(c){Jsonix.Util.Ensure.ensureExists(c);419this.root=c;420var d={"":""};421d[Jsonix.XML.XMLNS_P]=Jsonix.XML.XMLNS_NS;422this.pns=[d]423},hasNext:function(){if(this.node===null){return true424}else{if(this.node===this.root){var b=this.node.nodeType;425if(b===9&&this.eventType===8){return false426}else{if(b===1&&this.eventType===2){return false427}else{return true428}}}else{return true429}}},next:function(){if(this.eventType===null){return this.enter(this.root)430}if(this.eventType===7){var d=this.node.documentElement;431if(d){return this.enter(d)432}else{return this.leave(this.node)433}}else{if(this.eventType===1){var f=this.node.firstChild;434if(f){return this.enter(f)435}else{return this.leave(this.node)436}}else{if(this.eventType===2){var e=this.node.nextSibling;437if(e){return this.enter(e)438}else{return this.leave(this.node)439}}else{return this.leave(this.node)440}}}},enter:function(f){var e=f.nodeType;441this.node=f;442this.attributes=null;443if(e===1){this.eventType=1;444this.pushNS(f);445return this.eventType446}else{if(e===2){this.eventType=10;447return this.eventType448}else{if(e===3){var d=f.nodeValue;449if(Jsonix.Util.StringUtils.isEmpty(d)){this.eventType=6450}else{this.eventType=4451}return this.eventType452}else{if(e===4){this.eventType=12;453return this.eventType454}else{if(e===5){this.eventType=9;455return this.eventType456}else{if(e===6){this.eventType=15;457return this.eventType458}else{if(e===7){this.eventType=3;459return this.eventType460}else{if(e===8){this.eventType=5;461return this.eventType462}else{if(e===9){this.eventType=7;463return this.eventType464}else{if(e===10){this.eventType=12;465return this.eventType466}else{if(e===12){this.eventType=14;467return this.eventType468}else{throw new Error("Node type ["+e+"] is not supported.")469}}}}}}}}}}}},leave:function(h){if(h.nodeType===9){if(this.eventType==8){throw new Error("Invalid state.")470}else{this.node=h;471this.attributes=null;472this.eventType=8;473return this.eventType474}}else{if(h.nodeType===1){if(this.eventType==2){var g=h.nextSibling;475if(g){return this.enter(g)476}}else{this.node=h;477this.attributes=null;478this.eventType=2;479this.popNS();480return this.eventType481}}}var e=h.nextSibling;482if(e){return this.enter(e)483}else{var f=h.parentNode;484this.node=f;485this.attributes=null;486if(f.nodeType===9){this.eventType=8487}else{this.eventType=2488}return this.eventType489}},getName:function(){var b=this.node;490if(Jsonix.Util.Type.isString(b.nodeName)){if(Jsonix.Util.Type.isString(b.namespaceURI)){return new Jsonix.XML.QName(b.namespaceURI,b.nodeName)491}else{return new Jsonix.XML.QName(b.nodeName)492}}else{return null493}},getNameKey:function(){var b=this.node;494if(Jsonix.Util.Type.isString(b.nodeName)){return Jsonix.XML.QName.key(b.namespaceURI,b.nodeName)495}else{return null496}},getText:function(){return this.node.nodeValue497},nextTag:function(){var b=this.next();498while(b===7||b===4||b===12||b===6||b===3||b===5){b=this.next()499}if(b!==1&&b!==2){throw new Error("Expected start or end tag.")500}return b501},skipElement:function(){if(this.eventType!==Jsonix.XML.Input.START_ELEMENT){throw new Error("Parser must be on START_ELEMENT to skip element.")502}var d=1;503var c;504do{c=this.nextTag();505d+=(c===Jsonix.XML.Input.START_ELEMENT)?1:-1506}while(d>0);507return c508},getElementText:function(){if(this.eventType!=1){throw new Error("Parser must be on START_ELEMENT to read next text.")509}var c=this.next();510var d="";511while(c!==2){if(c===4||c===12||c===6||c===9){d=d+this.getText()512}else{if(c===3||c===5){}else{if(c===8){throw new Error("Unexpected end of document when reading element text content.")513}else{if(c===1){throw new Error("Element text content may not contain START_ELEMENT.")514}else{throw new Error("Unexpected event type ["+c+"].")515}}}}c=this.next()516}return d517},retrieveElement:function(){var b;518if(this.eventType===1){b=this.node519}else{if(this.eventType===10){b=this.node.parentNode520}else{throw new Error("Element can only be retrieved for START_ELEMENT or ATTRIBUTE nodes.")521}}return b522},retrieveAttributes:function(){var b;523if(this.attributes){b=this.attributes524}else{if(this.eventType===1){b=this.node.attributes;525this.attributes=b526}else{if(this.eventType===10){b=this.node.parentNode.attributes;527this.attributes=b528}else{throw new Error("Attributes can only be retrieved for START_ELEMENT or ATTRIBUTE nodes.")529}}}return b530},getAttributeCount:function(){var b=this.retrieveAttributes();531return b.length532},getAttributeName:function(d){var e=this.retrieveAttributes();533if(d<0||d>=e.length){throw new Error("Invalid attribute index ["+d+"].")534}var f=e[d];535if(Jsonix.Util.Type.isString(f.namespaceURI)){return new Jsonix.XML.QName(f.namespaceURI,f.nodeName)536}else{return new Jsonix.XML.QName(f.nodeName)537}},getAttributeNameKey:function(d){var e=this.retrieveAttributes();538if(d<0||d>=e.length){throw new Error("Invalid attribute index ["+d+"].")539}var f=e[d];540return Jsonix.XML.QName.key(f.namespaceURI,f.nodeName)541},getAttributeValue:function(d){var e=this.retrieveAttributes();542if(d<0||d>=e.length){throw new Error("Invalid attribute index ["+d+"].")543}var f=e[d];544return f.value545},getAttributeValueNS:null,getAttributeValueNSViaElement:function(d,e){var f=this.retrieveElement();546return f.getAttributeNS(d,e)547},getAttributeValueNSViaAttribute:function(d,e){var f=this.getAttributeNodeNS(d,e);548if(Jsonix.Util.Type.exists(f)){return f.nodeValue549}else{return null550}},getAttributeNodeNS:null,getAttributeNodeNSViaElement:function(d,e){var f=this.retrieveElement();551return f.getAttributeNodeNS(d,e)552},getAttributeNodeNSViaAttributes:function(o,p){var l=null;553var i=this.retrieveAttributes();554var m,k;555for(var n=0,j=i.length;556n<j;557++n){m=i[n];558if(m.namespaceURI===o){k=(m.prefix)?(m.prefix+":"+p):p;559if(k===m.nodeName){l=m;560break561}}}return l562},getElement:function(){if(this.eventType===1||this.eventType===2){this.eventType=2;563return this.node564}else{throw new Error("Parser must be on START_ELEMENT or END_ELEMENT to return current element.")565}},pushNS:function(x){var n=this.pns.length-1;566var t=this.pns[n];567var q=Jsonix.Util.Type.isObject(t)?n:t;568this.pns.push(q);569n++;570var w=true;571if(x.attributes){var u=x.attributes;572var p=u.length;573if(p>0){for(var v=0;574v<p;575v++){var y=u[v];576var s=y.nodeName;577var z=null;578var r=null;579var o=false;580if(s==="xmlns"){z="";581r=y.value;582o=true583}else{if(s.substring(0,6)==="xmlns:"){z=s.substring(6);584r=y.value;585o=true586}}if(o){if(w){q=Jsonix.Util.Type.cloneObject(this.pns[q],{});587this.pns[n]=q;588w=false589}q[z]=r590}}}}},popNS:function(){this.pns.pop()591},getNamespaceURI:function(d){var e=this.pns.length-1;592var f=this.pns[e];593f=Jsonix.Util.Type.isObject(f)?f:this.pns[f];594return f[d]595},CLASS_NAME:"Jsonix.XML.Input"});596Jsonix.XML.Input.prototype.getAttributeValueNS=(Jsonix.DOM.isDomImplementationAvailable())?Jsonix.XML.Input.prototype.getAttributeValueNSViaElement:Jsonix.XML.Input.prototype.getAttributeValueNSViaAttribute;597Jsonix.XML.Input.prototype.getAttributeNodeNS=(Jsonix.DOM.isDomImplementationAvailable())?Jsonix.XML.Input.prototype.getAttributeNodeNSViaElement:Jsonix.XML.Input.prototype.getAttributeNodeNSViaAttributes;598Jsonix.XML.Input.START_ELEMENT=1;599Jsonix.XML.Input.END_ELEMENT=2;600Jsonix.XML.Input.PROCESSING_INSTRUCTION=3;601Jsonix.XML.Input.CHARACTERS=4;602Jsonix.XML.Input.COMMENT=5;603Jsonix.XML.Input.SPACE=6;604Jsonix.XML.Input.START_DOCUMENT=7;605Jsonix.XML.Input.END_DOCUMENT=8;606Jsonix.XML.Input.ENTITY_REFERENCE=9;607Jsonix.XML.Input.ATTRIBUTE=10;608Jsonix.XML.Input.DTD=11;609Jsonix.XML.Input.CDATA=12;610Jsonix.XML.Input.NAMESPACE=13;611Jsonix.XML.Input.NOTATION_DECLARATION=14;612Jsonix.XML.Input.ENTITY_DECLARATION=15;613Jsonix.XML.Output=Jsonix.Class({document:null,documentElement:null,node:null,nodes:null,nsp:null,pns:null,namespacePrefixIndex:0,xmldom:null,initialize:function(e){if(typeof ActiveXObject!=="undefined"){this.xmldom=new ActiveXObject("Microsoft.XMLDOM")614}else{this.xmldom=null615}this.nodes=[];616var f={"":""};617f[Jsonix.XML.XMLNS_NS]=Jsonix.XML.XMLNS_P;618if(Jsonix.Util.Type.isObject(e)){if(Jsonix.Util.Type.isObject(e.namespacePrefixes)){Jsonix.Util.Type.cloneObject(e.namespacePrefixes,f)619}}this.nsp=[f];620var d={"":""};621d[Jsonix.XML.XMLNS_P]=Jsonix.XML.XMLNS_NS;622this.pns=[d]623},destroy:function(){this.xmldom=null624},writeStartDocument:function(){var b=Jsonix.DOM.createDocument();625this.document=b;626return this.push(b)627},writeEndDocument:function(){return this.pop()628},writeStartElement:function(p){Jsonix.Util.Ensure.ensureObject(p);629var j=p.localPart||p.lp||null;630Jsonix.Util.Ensure.ensureString(j);631var n=p.namespaceURI||p.ns||null;632var i=Jsonix.Util.Type.isString(n)?n:"";633var k=p.prefix||p.p;634var m=this.getPrefix(i,k);635var l=(!m?j:m+":"+j);636var o;637if(Jsonix.Util.Type.isFunction(this.document.createElementNS)){o=this.document.createElementNS(i,l)638}else{if(this.xmldom){o=this.xmldom.createNode(1,l,i)639}else{throw new Error("Could not create an element node.")640}}this.peek().appendChild(o);641this.push(o);642this.declareNamespace(i,m);643if(this.documentElement===null){this.documentElement=o;644this.declareNamespaces()645}return o646},writeEndElement:function(){return this.pop()647},writeCharacters:function(c){var d;648if(Jsonix.Util.Type.isFunction(this.document.createTextNode)){d=this.document.createTextNode(c)649}else{if(this.xmldom){d=this.xmldom.createTextNode(c)650}else{throw new Error("Could not create a text node.")651}}this.peek().appendChild(d);652return d653},writeCdata:function(c){var d;654if(Jsonix.Util.Type.isFunction(this.document.createCDATASection)){d=this.document.createCDATASection(c)655}else{if(this.xmldom){d=this.xmldom.createCDATASection(c)656}else{throw new Error("Could not create a CDATA section node.")657}}this.peek().appendChild(d);658return d659},writeAttribute:function(t,k){Jsonix.Util.Ensure.ensureString(k);660Jsonix.Util.Ensure.ensureObject(t);661var n=t.localPart||t.lp||null;662Jsonix.Util.Ensure.ensureString(n);663var l=t.namespaceURI||t.ns||null;664var q=Jsonix.Util.Type.isString(l)?l:"";665var s=t.prefix||t.p||null;666var m=this.getPrefix(q,s);667var o=(!m?n:m+":"+n);668var p=this.peek();669if(q===""){p.setAttribute(o,k)670}else{if(p.setAttributeNS){p.setAttributeNS(q,o,k)671}else{if(this.xmldom){var r=this.document.createNode(2,o,q);672r.nodeValue=k;673p.setAttributeNode(r)674}else{if(q===Jsonix.XML.XMLNS_NS){p.setAttribute(o,k)675}else{throw new Error("The [setAttributeNS] method is not implemented")676}}}this.declareNamespace(q,m)677}},writeNode:function(c){var d;678if(Jsonix.Util.Type.exists(this.document.importNode)){d=this.document.importNode(c,true)679}else{d=c680}this.peek().appendChild(d);681return d682},push:function(b){this.nodes.push(b);683this.pushNS();684return b685},peek:function(){return this.nodes[this.nodes.length-1]686},pop:function(){this.popNS();687var b=this.nodes.pop();688return b689},pushNS:function(){var k=this.nsp.length-1;690var g=this.pns.length-1;691var h=this.nsp[k];692var j=this.pns[g];693var l=Jsonix.Util.Type.isObject(h)?k:h;694var i=Jsonix.Util.Type.isObject(j)?g:j;695this.nsp.push(l);696this.pns.push(i)697},popNS:function(){this.nsp.pop();698this.pns.pop()699},declareNamespaces:function(){var f=this.nsp.length-1;700var h=this.nsp[f];701h=Jsonix.Util.Type.isNumber(h)?this.nsp[h]:h;702var e,g;703for(e in h){if(h.hasOwnProperty(e)){g=h[e];704this.declareNamespace(e,g)705}}},declareNamespace:function(j,i){var f=this.pns.length-1;706var h=this.pns[f];707var g;708if(Jsonix.Util.Type.isNumber(h)){g=true;709h=this.pns[h]710}else{g=false711}if(h[i]!==j){if(i===""){this.writeAttribute({lp:Jsonix.XML.XMLNS_P},j)712}else{this.writeAttribute({ns:Jsonix.XML.XMLNS_NS,lp:i,p:Jsonix.XML.XMLNS_P},j)713}if(g){h=Jsonix.Util.Type.cloneObject(h,{});714this.pns[f]=h715}h[i]=j716}},getPrefix:function(j,i){var g=this.nsp.length-1;717var k=this.nsp[g];718var h;719if(Jsonix.Util.Type.isNumber(k)){h=true;720k=this.nsp[k]721}else{h=false722}if(Jsonix.Util.Type.isString(i)){var l=k[j];723if(i===l){}else{if(h){k=Jsonix.Util.Type.cloneObject(k,{});724this.nsp[g]=k725}k[j]=i726}}else{i=k[j];727if(!Jsonix.Util.Type.exists(i)){i="p"+(this.namespacePrefixIndex++);728if(h){k=Jsonix.Util.Type.cloneObject(k,{});729this.nsp[g]=k730}k[j]=i731}}return i732},getNamespaceURI:function(d){var e=this.pns.length-1;733var f=this.pns[e];734f=Jsonix.Util.Type.isObject(f)?f:this.pns[f];735return f[d]736},CLASS_NAME:"Jsonix.XML.Output"});737Jsonix.Mapping={};738Jsonix.Mapping.Style=Jsonix.Class({marshaller:null,unmarshaller:null,module:null,elementInfo:null,classInfo:null,enumLeafInfo:null,anyAttributePropertyInfo:null,anyElementPropertyInfo:null,attributePropertyInfo:null,elementMapPropertyInfo:null,elementPropertyInfo:null,elementsPropertyInfo:null,elementRefPropertyInfo:null,elementRefsPropertyInfo:null,valuePropertyInfo:null,initialize:function(){},CLASS_NAME:"Jsonix.Mapping.Style"});739Jsonix.Mapping.Style.STYLES={};740Jsonix.Mapping.Styled=Jsonix.Class({mappingStyle:null,initialize:function(d){if(Jsonix.Util.Type.exists(d)){Jsonix.Util.Ensure.ensureObject(d);741if(Jsonix.Util.Type.isString(d.mappingStyle)){var c=Jsonix.Mapping.Style.STYLES[d.mappingStyle];742if(!c){throw new Error("Mapping style ["+d.mappingStyle+"] is not known.")743}this.mappingStyle=c744}else{if(Jsonix.Util.Type.isObject(d.mappingStyle)){this.mappingStyle=d.mappingStyle745}}}if(!this.mappingStyle){this.mappingStyle=Jsonix.Mapping.Style.STYLES.standard746}},CLASS_NAME:"Jsonix.Mapping.Styled"});747Jsonix.Binding={};748Jsonix.Binding.Marshalls={};749Jsonix.Binding.Marshalls.Element=Jsonix.Class({marshalElement:function(o,u,t,l){var q=this.convertToTypedNamedValue(o,u,t,l);750var p=q.typeInfo;751var v=undefined;752if(u.supportXsiType&&Jsonix.Util.Type.exists(q.value)){var r=u.getTypeInfoByValue(q.value);753if(r&&r.typeName){v=r754}}var m=v||p;755if(m){t.writeStartElement(q.name);756if(v&&p!==v){var n=v.typeName;757var s=Jsonix.Schema.XSD.QName.INSTANCE.print(n,u,t,l);758t.writeAttribute(Jsonix.Schema.XSI.TYPE_QNAME,s)759}if(Jsonix.Util.Type.exists(q.value)){m.marshal(q.value,u,t,l)760}t.writeEndElement()761}else{throw new Error("Element ["+q.name.key+"] is not known in this context, could not determine its type.")762}},getTypeInfoByElementName:function(f,e,g){var h=e.getElementInfo(f,g);763if(Jsonix.Util.Type.exists(h)){return h.typeInfo764}else{return undefined765}}});766Jsonix.Binding.Marshalls.Element.AsElementRef=Jsonix.Class({convertToTypedNamedValue:function(i,f,g,j){Jsonix.Util.Ensure.ensureObject(i);767var h=this.convertToNamedValue(i,f,g,j);768return{name:h.name,value:h.value,typeInfo:this.getTypeInfoByElementName(h.name,f,j)}769},convertToNamedValue:function(j,m,h,l){var n;770var k;771if(Jsonix.Util.Type.exists(j.name)&&!Jsonix.Util.Type.isUndefined(j.value)){n=Jsonix.XML.QName.fromObjectOrString(j.name,m);772k=Jsonix.Util.Type.exists(j.value)?j.value:null;773return{name:n,value:k}774}else{for(var i in j){if(j.hasOwnProperty(i)){n=Jsonix.XML.QName.fromObjectOrString(i,m);775k=j[i];776return{name:n,value:k}777}}}throw new Error("Invalid element value ["+j+"]. Element values must either have {name:'myElementName', value: elementValue} or {myElementName:elementValue} structure.")778}});779Jsonix.Binding.Unmarshalls={};780Jsonix.Binding.Unmarshalls.WrapperElement=Jsonix.Class({mixed:false,unmarshalWrapperElement:function(f,g,j,h){var i=g.next();781while(i!==Jsonix.XML.Input.END_ELEMENT){if(i===Jsonix.XML.Input.START_ELEMENT){this.unmarshalElement(f,g,j,h)782}else{if(this.mixed&&(i===Jsonix.XML.Input.CHARACTERS||i===Jsonix.XML.Input.CDATA||i===Jsonix.XML.Input.ENTITY_REFERENCE)){h(g.getText())783}else{if(i===Jsonix.XML.Input.SPACE||i===Jsonix.XML.Input.COMMENT||i===Jsonix.XML.Input.PROCESSING_INSTRUCTION){}else{throw new Error("Illegal state: unexpected event type ["+i+"].")784}}}i=g.next()785}}});786Jsonix.Binding.Unmarshalls.Element=Jsonix.Class({allowTypedObject:true,allowDom:false,unmarshalElement:function(q,o,j,l){if(o.eventType!=1){throw new Error("Parser must be on START_ELEMENT to read next element.")787}var k=this.getTypeInfoByInputElement(q,o,j);788var r=o.getName();789var p;790if(this.allowTypedObject){if(Jsonix.Util.Type.exists(k)){var n=k.unmarshal(q,o,j);791var m={name:r,value:n,typeInfo:k};792p=this.convertFromTypedNamedValue(m,q,o,j)793}else{if(this.allowDom){p=o.getElement()794}else{throw new Error("Element ["+r.toString()+"] could not be unmarshalled as is not known in this context and the property does not allow DOM content.")795}}}else{if(this.allowDom){p=o.getElement()796}else{throw new Error("Element ["+r.toString()+"] could not be unmarshalled as the property neither allows typed objects nor DOM as content. This is a sign of invalid mappings, do not use [allowTypedObject : false] and [allowDom : false] at the same time.")797}}l(p)798},getTypeInfoByInputElement:function(n,p,m){var i=null;799if(n.supportXsiType){var j=p.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI,Jsonix.Schema.XSI.TYPE);800if(Jsonix.Util.StringUtils.isNotBlank(j)){var k=Jsonix.Schema.XSD.QName.INSTANCE.parse(j,n,p,m);801i=n.getTypeInfoByTypeNameKey(k.key)802}}var o=p.getName();803var l=i?i:this.getTypeInfoByElementName(o,n,m);804return l805},getTypeInfoByElementName:function(f,e,g){var h=e.getElementInfo(f,g);806if(Jsonix.Util.Type.exists(h)){return h.typeInfo807}else{return undefined808}}});809Jsonix.Binding.Unmarshalls.Element.AsElementRef=Jsonix.Class({convertFromTypedNamedValue:function(g,e,f,h){return{name:g.name,value:g.value}810}});811Jsonix.Binding.Unmarshalls.Element.AsSimplifiedElementRef=Jsonix.Class({convertFromTypedNamedValue:function(i,l,g,k){var h=i.name.toCanonicalString(l);812var j={};813j[h]=i.value;814return j815}});816Jsonix.Binding.Marshaller=Jsonix.Class(Jsonix.Binding.Marshalls.Element,Jsonix.Binding.Marshalls.Element.AsElementRef,{context:null,initialize:function(b){Jsonix.Util.Ensure.ensureObject(b);817this.context=b818},marshalString:function(e){var d=this.marshalDocument(e);819var f=Jsonix.DOM.serialize(d);820return f821},marshalDocument:function(d){var e=new Jsonix.XML.Output({namespacePrefixes:this.context.namespacePrefixes});822var f=e.writeStartDocument();823this.marshalElement(d,this.context,e,undefined);824e.writeEndDocument();825return f826},CLASS_NAME:"Jsonix.Binding.Marshaller"});827Jsonix.Binding.Marshaller.Simplified=Jsonix.Class(Jsonix.Binding.Marshaller,{CLASS_NAME:"Jsonix.Binding.Marshaller.Simplified"});828Jsonix.Binding.Unmarshaller=Jsonix.Class(Jsonix.Binding.Unmarshalls.Element,Jsonix.Binding.Unmarshalls.Element.AsElementRef,{context:null,allowTypedObject:true,allowDom:false,initialize:function(b){Jsonix.Util.Ensure.ensureObject(b);829this.context=b830},unmarshalString:function(c){Jsonix.Util.Ensure.ensureString(c);831var d=Jsonix.DOM.parse(c);832return this.unmarshalDocument(d)833},unmarshalURL:function(d,f,e){Jsonix.Util.Ensure.ensureString(d);834Jsonix.Util.Ensure.ensureFunction(f);835if(Jsonix.Util.Type.exists(e)){Jsonix.Util.Ensure.ensureObject(e)836}that=this;837Jsonix.DOM.load(d,function(a){f(that.unmarshalDocument(a))838},e)839},unmarshalFile:function(g,h,e){if(typeof _jsonix_fs==="undefined"){throw new Error("File unmarshalling is only available in environments which support file systems.")840}Jsonix.Util.Ensure.ensureString(g);841Jsonix.Util.Ensure.ensureFunction(h);842if(Jsonix.Util.Type.exists(e)){Jsonix.Util.Ensure.ensureObject(e)843}that=this;844var f=_jsonix_fs;845f.readFile(g,e,function(d,c){if(d){throw d846}else{var a=c.toString();847var b=Jsonix.DOM.parse(a);848h(that.unmarshalDocument(b))849}})850},unmarshalDocument:function(i,j){var f=new Jsonix.XML.Input(i);851var g=null;852var h=function(a){g=a853};854f.nextTag();855this.unmarshalElement(this.context,f,j,h);856return g857},CLASS_NAME:"Jsonix.Binding.Unmarshaller"});858Jsonix.Binding.Unmarshaller.Simplified=Jsonix.Class(Jsonix.Binding.Unmarshaller,Jsonix.Binding.Unmarshalls.Element.AsSimplifiedElementRef,{CLASS_NAME:"Jsonix.Binding.Unmarshaller.Simplified"});859Jsonix.Model.TypeInfo=Jsonix.Class({module:null,name:null,baseTypeInfo:null,initialize:function(){},isBasedOn:function(c){var d=this;860while(d){if(c===d){return true861}d=d.baseTypeInfo862}return false863},CLASS_NAME:"Jsonix.Model.TypeInfo"});864Jsonix.Model.ClassInfo=Jsonix.Class(Jsonix.Model.TypeInfo,Jsonix.Mapping.Styled,{name:null,localName:null,typeName:null,instanceFactory:null,properties:null,propertiesMap:null,structure:null,targetNamespace:"",defaultElementNamespaceURI:"",defaultAttributeNamespaceURI:"",built:false,initialize:function(w,m){Jsonix.Model.TypeInfo.prototype.initialize.apply(this,[]);865Jsonix.Mapping.Styled.prototype.initialize.apply(this,[m]);866Jsonix.Util.Ensure.ensureObject(w);867var v=w.name||w.n||undefined;868Jsonix.Util.Ensure.ensureString(v);869this.name=v;870var q=w.localName||w.ln||null;871this.localName=q;872var r=w.defaultElementNamespaceURI||w.dens||w.targetNamespace||w.tns||"";873this.defaultElementNamespaceURI=r;874var n=w.targetNamespace||w.tns||w.defaultElementNamespaceURI||w.dens||this.defaultElementNamespaceURI;875this.targetNamespace=n;876var p=w.defaultAttributeNamespaceURI||w.dans||"";877this.defaultAttributeNamespaceURI=p;878var u=w.baseTypeInfo||w.bti||null;879this.baseTypeInfo=u;880var t=w.instanceFactory||w.inF||undefined;881if(Jsonix.Util.Type.exists(t)){Jsonix.Util.Ensure.ensureFunction(t);882this.instanceFactory=t883}var o=w.typeName||w.tn||undefined;884if(Jsonix.Util.Type.exists(o)){if(Jsonix.Util.Type.isString(o)){this.typeName=new Jsonix.XML.QName(this.targetNamespace,o)885}else{this.typeName=Jsonix.XML.QName.fromObject(o)886}}else{if(Jsonix.Util.Type.exists(q)){this.typeName=new Jsonix.XML.QName(n,q)887}}this.properties=[];888this.propertiesMap={};889var x=w.propertyInfos||w.ps||[];890Jsonix.Util.Ensure.ensureArray(x);891for(var s=0;892s<x.length;893s++){this.p(x[s])894}},getPropertyInfoByName:function(b){return this.propertiesMap[b]895},destroy:function(){},build:function(h){if(!this.built){this.baseTypeInfo=h.resolveTypeInfo(this.baseTypeInfo,this.module);896if(Jsonix.Util.Type.exists(this.baseTypeInfo)){this.baseTypeInfo.build(h)897}for(var e=0;898e<this.properties.length;899e++){var g=this.properties[e];900g.build(h,this.module)901}var f={elements:null,attributes:{},anyAttribute:null,value:null,any:null};902this.buildStructure(h,f);903this.structure=f904}},buildStructure:function(h,f){if(Jsonix.Util.Type.exists(this.baseTypeInfo)){this.baseTypeInfo.buildStructure(h,f)905}for(var e=0;906e<this.properties.length;907e++){var g=this.properties[e];908g.buildStructure(h,f)909}},unmarshal:function(B,w){this.build(B);910var p;911if(this.instanceFactory){p=new this.instanceFactory()912}else{p={TYPE_NAME:this.name}913}if(w.eventType!==1){throw new Error("Parser must be on START_ELEMENT to read a class info.")914}if(Jsonix.Util.Type.exists(this.structure.attributes)){var D=w.getAttributeCount();915if(D!==0){for(var z=0;916z<D;917z++){var u=w.getAttributeNameKey(z);918if(Jsonix.Util.Type.exists(this.structure.attributes[u])){var A=w.getAttributeValue(z);919if(Jsonix.Util.Type.isString(A)){var C=this.structure.attributes[u];920this.unmarshalPropertyValue(B,w,C,p,A)921}}}}}if(Jsonix.Util.Type.exists(this.structure.anyAttribute)){var y=this.structure.anyAttribute;922this.unmarshalProperty(B,w,y,p)923}if(Jsonix.Util.Type.exists(this.structure.elements)){var v=w.next();924while(v!==Jsonix.XML.Input.END_ELEMENT){if(v===Jsonix.XML.Input.START_ELEMENT){var q=w.getNameKey();925if(Jsonix.Util.Type.exists(this.structure.elements[q])){var r=this.structure.elements[q];926this.unmarshalProperty(B,w,r,p)927}else{if(Jsonix.Util.Type.exists(this.structure.any)){var s=this.structure.any;928this.unmarshalProperty(B,w,s,p)929}else{v=w.skipElement()930}}}else{if((v===Jsonix.XML.Input.CHARACTERS||v===Jsonix.XML.Input.CDATA||v===Jsonix.XML.Input.ENTITY_REFERENCE)){if(Jsonix.Util.Type.exists(this.structure.mixed)){var x=this.structure.mixed;931this.unmarshalProperty(B,w,x,p)932}}else{if(v===Jsonix.XML.Input.SPACE||v===Jsonix.XML.Input.COMMENT||v===Jsonix.XML.Input.PROCESSING_INSTRUCTION){}else{throw new Error("Illegal state: unexpected event type ["+v+"].")933}}}v=w.next()934}}else{if(Jsonix.Util.Type.exists(this.structure.value)){var t=this.structure.value;935this.unmarshalProperty(B,w,t,p)936}else{w.nextTag()937}}if(w.eventType!==2){throw new Error("Illegal state: must be END_ELEMENT.")938}return p939},unmarshalProperty:function(i,j,h,g){var f=h.unmarshal(i,j,this);940h.setProperty(g,f)941},unmarshalPropertyValue:function(k,l,i,h,j){var g=i.unmarshalValue(j,k,l,this);942i.setProperty(h,g)943},marshal:function(l,q,p,k){if(this.isMarshallable(l,q,k)){if(Jsonix.Util.Type.exists(this.baseTypeInfo)){this.baseTypeInfo.marshal(l,q,p)944}for(var n=0;945n<this.properties.length;946n++){var m=this.properties[n];947var o=l[m.name];948if(Jsonix.Util.Type.exists(o)){m.marshal(o,q,p,this)949}}}else{if(this.structure.value){var j=this.structure.value;950j.marshal(l,q,p,this)951}else{if(this.properties.length===1){var r=this.properties[0];952r.marshal(l,q,p,this)953}else{throw new Error("The passed value ["+l+"] is not an object and there is no single suitable property to marshal it.")954}}}},isMarshallable:function(f,e,d){return this.isInstance(f,e,d)||(Jsonix.Util.Type.isObject(f)&&!Jsonix.Util.Type.isArray(f))955},isInstance:function(f,e,d){if(this.instanceFactory){return f instanceof this.instanceFactory956}else{return Jsonix.Util.Type.isObject(f)&&Jsonix.Util.Type.isString(f.TYPE_NAME)&&f.TYPE_NAME===this.name957}},b:function(b){Jsonix.Util.Ensure.ensureObject(b);958this.baseTypeInfo=b;959return this960},ps:function(){return this961},p:function(e){Jsonix.Util.Ensure.ensureObject(e);962if(e instanceof Jsonix.Model.PropertyInfo){this.addProperty(e)963}else{e=Jsonix.Util.Type.cloneObject(e);964var f=e.type||e.t||"element";965if(Jsonix.Util.Type.isFunction(this.propertyInfoCreators[f])){var d=this.propertyInfoCreators[f];966d.call(this,e)967}else{throw new Error("Unknown property info type ["+f+"].")968}}},aa:function(b){this.addDefaultNamespaces(b);969return this.addProperty(new this.mappingStyle.anyAttributePropertyInfo(b,{mappingStyle:this.mappingStyle}))970},ae:function(b){this.addDefaultNamespaces(b);971return this.addProperty(new this.mappingStyle.anyElementPropertyInfo(b,{mappingStyle:this.mappingStyle}))972},a:function(b){this.addDefaultNamespaces(b);973return this.addProperty(new this.mappingStyle.attributePropertyInfo(b,{mappingStyle:this.mappingStyle}))974},em:function(b){this.addDefaultNamespaces(b);975return this.addProperty(new this.mappingStyle.elementMapPropertyInfo(b,{mappingStyle:this.mappingStyle}))976},e:function(b){this.addDefaultNamespaces(b);977return this.addProperty(new this.mappingStyle.elementPropertyInfo(b,{mappingStyle:this.mappingStyle}))978},es:function(b){this.addDefaultNamespaces(b);979return this.addProperty(new this.mappingStyle.elementsPropertyInfo(b,{mappingStyle:this.mappingStyle}))980},er:function(b){this.addDefaultNamespaces(b);981return this.addProperty(new this.mappingStyle.elementRefPropertyInfo(b,{mappingStyle:this.mappingStyle}))982},ers:function(b){this.addDefaultNamespaces(b);983return this.addProperty(new this.mappingStyle.elementRefsPropertyInfo(b,{mappingStyle:this.mappingStyle}))984},v:function(b){this.addDefaultNamespaces(b);985return this.addProperty(new this.mappingStyle.valuePropertyInfo(b,{mappingStyle:this.mappingStyle}))986},addDefaultNamespaces:function(b){if(Jsonix.Util.Type.isObject(b)){if(!Jsonix.Util.Type.isString(b.defaultElementNamespaceURI)){b.defaultElementNamespaceURI=this.defaultElementNamespaceURI987}if(!Jsonix.Util.Type.isString(b.defaultAttributeNamespaceURI)){b.defaultAttributeNamespaceURI=this.defaultAttributeNamespaceURI988}}},addProperty:function(b){this.properties.push(b);989this.propertiesMap[b.name]=b;990return this991},CLASS_NAME:"Jsonix.Model.ClassInfo"});992Jsonix.Model.ClassInfo.prototype.propertyInfoCreators={aa:Jsonix.Model.ClassInfo.prototype.aa,anyAttribute:Jsonix.Model.ClassInfo.prototype.aa,ae:Jsonix.Model.ClassInfo.prototype.ae,anyElement:Jsonix.Model.ClassInfo.prototype.ae,a:Jsonix.Model.ClassInfo.prototype.a,attribute:Jsonix.Model.ClassInfo.prototype.a,em:Jsonix.Model.ClassInfo.prototype.em,elementMap:Jsonix.Model.ClassInfo.prototype.em,e:Jsonix.Model.ClassInfo.prototype.e,element:Jsonix.Model.ClassInfo.prototype.e,es:Jsonix.Model.ClassInfo.prototype.es,elements:Jsonix.Model.ClassInfo.prototype.es,er:Jsonix.Model.ClassInfo.prototype.er,elementRef:Jsonix.Model.ClassInfo.prototype.er,ers:Jsonix.Model.ClassInfo.prototype.ers,elementRefs:Jsonix.Model.ClassInfo.prototype.ers,v:Jsonix.Model.ClassInfo.prototype.v,value:Jsonix.Model.ClassInfo.prototype.v};993Jsonix.Model.EnumLeafInfo=Jsonix.Class(Jsonix.Model.TypeInfo,{name:null,baseTypeInfo:"String",entries:null,keys:null,values:null,built:false,initialize:function(f){Jsonix.Model.TypeInfo.prototype.initialize.apply(this,[]);994Jsonix.Util.Ensure.ensureObject(f);995var g=f.name||f.n||undefined;996Jsonix.Util.Ensure.ensureString(g);997this.name=g;998var e=f.baseTypeInfo||f.bti||"String";999this.baseTypeInfo=e;1000var h=f.values||f.vs||undefined;1001Jsonix.Util.Ensure.ensureExists(h);1002if(!(Jsonix.Util.Type.isObject(h)||Jsonix.Util.Type.isArray(h))){throw new Error("Enum values must be either an array or an object.")1003}else{this.entries=h1004}},build:function(m){if(!this.built){this.baseTypeInfo=m.resolveTypeInfo(this.baseTypeInfo,this.module);1005this.baseTypeInfo.build(m);1006var p=this.entries;1007var j={};1008var l=[];1009var i=[];1010var o=0;1011var n;1012var k;1013if(Jsonix.Util.Type.isArray(p)){for(o=0;1014o<p.length;1015o++){k=p[o];1016if(Jsonix.Util.Type.isString(k)){n=k;1017if(!(Jsonix.Util.Type.isFunction(this.baseTypeInfo.parse))){throw new Error("Enum value is provided as string but the base type ["+this.baseTypeInfo.name+"] of the enum info ["+this.name+"] does not implement the parse method.")1018}k=this.baseTypeInfo.parse(k,m,null,this)1019}else{if(this.baseTypeInfo.isInstance(k,m,this)){if(!(Jsonix.Util.Type.isFunction(this.baseTypeInfo.print))){throw new Error("The base type ["+this.baseTypeInfo.name+"] of the enum info ["+this.name+"] does not implement the print method, unable to produce the enum key as string.")1020}n=this.baseTypeInfo.print(k,m,null,this)1021}else{throw new Error("Enum value ["+k+"] is not an instance of the enum base type ["+this.baseTypeInfo.name+"].")1022}}j[n]=k;1023l[o]=n;1024i[o]=k1025}}else{if(Jsonix.Util.Type.isObject(p)){for(n in p){if(p.hasOwnProperty(n)){k=p[n];1026if(Jsonix.Util.Type.isString(k)){if(!(Jsonix.Util.Type.isFunction(this.baseTypeInfo.parse))){throw new Error("Enum value is provided as string but the base type ["+this.baseTypeInfo.name+"] of the enum info ["+this.name+"] does not implement the parse method.")1027}k=this.baseTypeInfo.parse(k,m,null,this)1028}else{if(!this.baseTypeInfo.isInstance(k,m,this)){throw new Error("Enum value ["+k+"] is not an instance of the enum base type ["+this.baseTypeInfo.name+"].")1029}}j[n]=k;1030l[o]=n;1031i[o]=k;1032o++1033}}}else{throw new Error("Enum values must be either an array or an object.")1034}}this.entries=j;1035this.keys=l;1036this.values=i;1037this.built=true1038}},unmarshal:function(e,f,h){var g=f.getElementText();1039return this.parse(g,e,f,h)1040},marshal:function(g,e,f,h){if(Jsonix.Util.Type.exists(g)){f.writeCharacters(this.reprint(g,e,f,h))1041}},reprint:function(g,e,f,h){if(Jsonix.Util.Type.isString(g)&&!this.isInstance(g,e,h)){return this.print(this.parse(g,e,null,h),e,f,h)1042}else{return this.print(g,e,f,h)1043}},print:function(h,j,g,i){for(var f=0;1044f<this.values.length;1045f++){if(this.values[f]===h){return this.keys[f]1046}}throw new Error("Value ["+h+"] is invalid for the enum type ["+this.name+"].")1047},parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1048if(this.entries.hasOwnProperty(g)){return this.entries[g]1049}else{throw new Error("Value ["+g+"] is invalid for the enum type ["+this.name+"].")1050}},isInstance:function(g,e,h){for(var f=0;1051f<this.values.length;1052f++){if(this.values[f]===g){return true1053}}return false1054},CLASS_NAME:"Jsonix.Model.EnumLeafInfo"});1055Jsonix.Model.ElementInfo=Jsonix.Class({module:null,elementName:null,typeInfo:null,substitutionHead:null,scope:null,built:false,initialize:function(g){Jsonix.Util.Ensure.ensureObject(g);1056var j=g.defaultElementNamespaceURI||g.dens||"";1057this.defaultElementNamespaceURI=j;1058var h=g.elementName||g.en||undefined;1059if(Jsonix.Util.Type.isObject(h)){this.elementName=Jsonix.XML.QName.fromObject(h)1060}else{Jsonix.Util.Ensure.ensureString(h);1061this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,h)1062}var k=g.typeInfo||g.ti||"String";1063this.typeInfo=k;1064var l=g.substitutionHead||g.sh||null;1065this.substitutionHead=l;1066var i=g.scope||g.sc||null;1067this.scope=i1068},build:function(b){if(!this.built){this.typeInfo=b.resolveTypeInfo(this.typeInfo,this.module);1069this.scope=b.resolveTypeInfo(this.scope,this.module);1070this.built=true1071}},CLASS_NAME:"Jsonix.Model.ElementInfo"});1072Jsonix.Model.PropertyInfo=Jsonix.Class({name:null,collection:false,targetNamespace:"",defaultElementNamespaceURI:"",defaultAttributeNamespaceURI:"",built:false,initialize:function(r){Jsonix.Util.Ensure.ensureObject(r);1073var p=r.name||r.n||undefined;1074Jsonix.Util.Ensure.ensureString(p);1075this.name=p;1076var m=r.defaultElementNamespaceURI||r.dens||r.targetNamespace||r.tns||"";1077this.defaultElementNamespaceURI=m;1078var j=r.targetNamespace||r.tns||r.defaultElementNamespaceURI||r.dens||this.defaultElementNamespaceURI;1079this.targetNamespace=j;1080var k=r.defaultAttributeNamespaceURI||r.dans||"";1081this.defaultAttributeNamespaceURI=k;1082var o=r.collection||r.col||false;1083this.collection=o;1084var n=r.required||r.rq||false;1085this.required=n;1086if(this.collection){var l;1087if(Jsonix.Util.Type.isNumber(r.minOccurs)){l=r.minOccurs1088}else{if(Jsonix.Util.Type.isNumber(r.mno)){l=r.mno1089}else{l=11090}}this.minOccurs=l;1091var q;1092if(Jsonix.Util.Type.isNumber(r.maxOccurs)){q=r.maxOccurs1093}else{if(Jsonix.Util.Type.isNumber(r.mxo)){q=r.mxo1094}else{q=null1095}}this.maxOccurs=q1096}},build:function(c,d){if(!this.built){this.doBuild(c,d);1097this.built=true1098}},doBuild:function(c,d){throw new Error("Abstract method [doBuild].")1099},buildStructure:function(c,d){throw new Error("Abstract method [buildStructure].")1100},setProperty:function(d,f){if(Jsonix.Util.Type.exists(f)){if(this.collection){Jsonix.Util.Ensure.ensureArray(f,"Collection property requires an array value.");1101if(!Jsonix.Util.Type.exists(d[this.name])){d[this.name]=[]1102}for(var e=0;1103e<f.length;1104e++){d[this.name].push(f[e])1105}}else{d[this.name]=f1106}}},CLASS_NAME:"Jsonix.Model.PropertyInfo"});1107Jsonix.Model.AnyAttributePropertyInfo=Jsonix.Class(Jsonix.Model.PropertyInfo,{initialize:function(b){Jsonix.Util.Ensure.ensureObject(b);1108Jsonix.Model.PropertyInfo.prototype.initialize.apply(this,[b])1109},unmarshal:function(m,p,l){var n=p.getAttributeCount();1110if(n===0){return null1111}else{var j={};1112for(var o=0;1113o<n;1114o++){var k=p.getAttributeValue(o);1115if(Jsonix.Util.Type.isString(k)){var i=this.convertFromAttributeName(p.getAttributeName(o),m,p,l);1116j[i]=k1117}}return j1118}},marshal:function(j,l,n,k){if(!Jsonix.Util.Type.isObject(j)){return1119}for(var h in j){if(j.hasOwnProperty(h)){var i=j[h];1120if(Jsonix.Util.Type.isString(i)){var m=this.convertToAttributeName(h,l,n,k);1121n.writeAttribute(m,i)1122}}}},convertFromAttributeName:function(e,h,f,g){return e.key1123},convertToAttributeName:function(e,h,f,g){return Jsonix.XML.QName.fromObjectOrString(e,h)1124},doBuild:function(c,d){},buildStructure:function(c,d){Jsonix.Util.Ensure.ensureObject(d);1125d.anyAttribute=this1126},CLASS_NAME:"Jsonix.Model.AnyAttributePropertyInfo"});1127Jsonix.Model.AnyAttributePropertyInfo.Simplified=Jsonix.Class(Jsonix.Model.AnyAttributePropertyInfo,{convertFromAttributeName:function(e,h,f,g){return e.toCanonicalString(h)1128}});1129Jsonix.Model.SingleTypePropertyInfo=Jsonix.Class(Jsonix.Model.PropertyInfo,{typeInfo:"String",initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1130Jsonix.Model.PropertyInfo.prototype.initialize.apply(this,[d]);1131var c=d.typeInfo||d.ti||"String";1132this.typeInfo=c1133},doBuild:function(c,d){this.typeInfo=c.resolveTypeInfo(this.typeInfo,d)1134},unmarshalValue:function(g,e,f,h){return this.parse(g,e,f,h)1135},parse:function(g,e,f,h){return this.typeInfo.parse(g,e,f,h)1136},print:function(g,e,f,h){return this.typeInfo.reprint(g,e,f,h)1137},CLASS_NAME:"Jsonix.Model.SingleTypePropertyInfo"});1138Jsonix.Model.AttributePropertyInfo=Jsonix.Class(Jsonix.Model.SingleTypePropertyInfo,{attributeName:null,initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1139Jsonix.Model.SingleTypePropertyInfo.prototype.initialize.apply(this,[d]);1140var c=d.attributeName||d.an||undefined;1141if(Jsonix.Util.Type.isObject(c)){this.attributeName=Jsonix.XML.QName.fromObject(c)1142}else{if(Jsonix.Util.Type.isString(c)){this.attributeName=new Jsonix.XML.QName(this.defaultAttributeNamespaceURI,c)1143}else{this.attributeName=new Jsonix.XML.QName(this.defaultAttributeNamespaceURI,this.name)1144}}},unmarshal:function(m,p,k){var n=p.getAttributeCount();1145var j=null;1146for(var o=0;1147o<n;1148o++){var i=p.getAttributeNameKey(o);1149if(this.attributeName.key===i){var l=p.getAttributeValue(o);1150if(Jsonix.Util.Type.isString(l)){j=this.unmarshalValue(l,m,p,k)1151}}}return j1152},marshal:function(g,e,f,h){if(Jsonix.Util.Type.exists(g)){f.writeAttribute(this.attributeName,this.print(g,e,f,h))1153}},buildStructure:function(f,e){Jsonix.Util.Ensure.ensureObject(e);1154Jsonix.Util.Ensure.ensureObject(e.attributes);1155var d=this.attributeName.key;1156e.attributes[d]=this1157},CLASS_NAME:"Jsonix.Model.AttributePropertyInfo"});1158Jsonix.Model.ValuePropertyInfo=Jsonix.Class(Jsonix.Model.SingleTypePropertyInfo,{initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1159Jsonix.Model.SingleTypePropertyInfo.prototype.initialize.apply(this,[d]);1160var c=d.asCDATA||d.c||false;1161this.asCDATA=c1162},unmarshal:function(e,f,h){var g=f.getElementText();1163return this.unmarshalValue(g,e,f,h)1164},marshal:function(g,e,f,h){if(!Jsonix.Util.Type.exists(g)){return1165}if(this.asCDATA){f.writeCdata(this.print(g,e,f,h))1166}else{f.writeCharacters(this.print(g,e,f,h))1167}},buildStructure:function(c,d){Jsonix.Util.Ensure.ensureObject(d);1168if(Jsonix.Util.Type.exists(d.elements)){throw new Error("The structure already defines element mappings, it cannot define a value property.")1169}else{d.value=this1170}},CLASS_NAME:"Jsonix.Model.ValuePropertyInfo"});1171Jsonix.Model.AbstractElementsPropertyInfo=Jsonix.Class(Jsonix.Binding.Unmarshalls.Element,Jsonix.Binding.Unmarshalls.WrapperElement,Jsonix.Model.PropertyInfo,{wrapperElementName:null,allowDom:false,allowTypedObject:true,mixed:false,initialize:function(c){Jsonix.Util.Ensure.ensureObject(c);1172Jsonix.Model.PropertyInfo.prototype.initialize.apply(this,[c]);1173var d=c.wrapperElementName||c.wen||undefined;1174if(Jsonix.Util.Type.isObject(d)){this.wrapperElementName=Jsonix.XML.QName.fromObject(d)1175}else{if(Jsonix.Util.Type.isString(d)){this.wrapperElementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,d)1176}else{this.wrapperElementName=null1177}}},unmarshal:function(l,g,k){var h=null;1178var j=this;1179var i=function(a){if(j.collection){if(h===null){h=[]1180}h.push(a)1181}else{if(h===null){h=a1182}else{throw new Error("Value already set.")1183}}};1184if(Jsonix.Util.Type.exists(this.wrapperElementName)){this.unmarshalWrapperElement(l,g,k,i)1185}else{this.unmarshalElement(l,g,k,i)1186}return h1187},marshal:function(i,l,h,k){if(!Jsonix.Util.Type.exists(i)){return1188}if(Jsonix.Util.Type.exists(this.wrapperElementName)){h.writeStartElement(this.wrapperElementName)1189}if(!this.collection){this.marshalElement(i,l,h,k)1190}else{Jsonix.Util.Ensure.ensureArray(i);1191for(var g=0;1192g<i.length;1193g++){var j=i[g];1194this.marshalElement(j,l,h,k)1195}}if(Jsonix.Util.Type.exists(this.wrapperElementName)){h.writeEndElement()1196}},convertFromTypedNamedValue:function(g,e,f,h){return g.value1197},buildStructure:function(c,d){Jsonix.Util.Ensure.ensureObject(d);1198if(Jsonix.Util.Type.exists(d.value)){throw new Error("The structure already defines a value property.")1199}else{if(!Jsonix.Util.Type.exists(d.elements)){d.elements={}1200}}if(Jsonix.Util.Type.exists(this.wrapperElementName)){d.elements[this.wrapperElementName.key]=this1201}else{this.buildStructureElements(c,d)1202}},buildStructureElements:function(c,d){throw new Error("Abstract method [buildStructureElements].")1203},CLASS_NAME:"Jsonix.Model.AbstractElementsPropertyInfo"});1204Jsonix.Model.ElementPropertyInfo=Jsonix.Class(Jsonix.Model.AbstractElementsPropertyInfo,Jsonix.Binding.Marshalls.Element,{typeInfo:"String",elementName:null,initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1205Jsonix.Model.AbstractElementsPropertyInfo.prototype.initialize.apply(this,[d]);1206var f=d.typeInfo||d.ti||"String";1207if(Jsonix.Util.Type.isObject(f)){this.typeInfo=f1208}else{Jsonix.Util.Ensure.ensureString(f);1209this.typeInfo=f1210}var e=d.elementName||d.en||undefined;1211if(Jsonix.Util.Type.isObject(e)){this.elementName=Jsonix.XML.QName.fromObject(e)1212}else{if(Jsonix.Util.Type.isString(e)){this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,e)1213}else{this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,this.name)1214}}},getTypeInfoByElementName:function(e,d,f){return this.typeInfo1215},convertToTypedNamedValue:function(g,e,f,h){return{name:this.elementName,value:g,typeInfo:this.typeInfo}1216},doBuild:function(c,d){this.typeInfo=c.resolveTypeInfo(this.typeInfo,d)1217},buildStructureElements:function(c,d){d.elements[this.elementName.key]=this1218},CLASS_NAME:"Jsonix.Model.ElementPropertyInfo"});1219Jsonix.Model.ElementsPropertyInfo=Jsonix.Class(Jsonix.Model.AbstractElementsPropertyInfo,Jsonix.Binding.Marshalls.Element,{elementTypeInfos:null,elementTypeInfosMap:null,initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1220Jsonix.Model.AbstractElementsPropertyInfo.prototype.initialize.apply(this,[d]);1221var f=d.elementTypeInfos||d.etis||[];1222Jsonix.Util.Ensure.ensureArray(f);1223this.elementTypeInfos=[];1224for(var e=0;1225e<f.length;1226e++){this.elementTypeInfos[e]=Jsonix.Util.Type.cloneObject(f[e])1227}},getTypeInfoByElementName:function(e,d,f){return this.elementTypeInfosMap[e.key]1228},convertToTypedNamedValue:function(q,v,u,o){for(var s=0;1229s<this.elementTypeInfos.length;1230s++){var r=this.elementTypeInfos[s];1231var p=r.typeInfo;1232if(p.isInstance(q,v,o)){var n=r.elementName;1233return{name:n,value:q,typeInfo:p}1234}}if(v.supportXsiType){var w=v.getTypeInfoByValue(q);1235if(w&&w.typeName){for(var t=0;1236t<this.elementTypeInfos.length;1237t++){var z=this.elementTypeInfos[t];1238var x=z.typeInfo;1239if(w.isBasedOn(x)){var y=z.elementName;1240return{name:y,value:q,typeInfo:x}1241}}}}throw new Error("Could not find an element with type info supporting the value ["+q+"].")1242},doBuild:function(k,l){this.elementTypeInfosMap={};1243var i,j;1244for(var g=0;1245g<this.elementTypeInfos.length;1246g++){var h=this.elementTypeInfos[g];1247Jsonix.Util.Ensure.ensureObject(h);1248i=h.typeInfo||h.ti||"String";1249h.typeInfo=k.resolveTypeInfo(i,l);1250j=h.elementName||h.en||undefined;1251h.elementName=Jsonix.XML.QName.fromObjectOrString(j,k,this.defaultElementNamespaceURI);1252this.elementTypeInfosMap[h.elementName.key]=h.typeInfo1253}},buildStructureElements:function(g,f){for(var h=0;1254h<this.elementTypeInfos.length;1255h++){var e=this.elementTypeInfos[h];1256f.elements[e.elementName.key]=this1257}},CLASS_NAME:"Jsonix.Model.ElementsPropertyInfo"});1258Jsonix.Model.ElementMapPropertyInfo=Jsonix.Class(Jsonix.Model.AbstractElementsPropertyInfo,{elementName:null,key:null,value:null,entryTypeInfo:null,initialize:function(g){Jsonix.Util.Ensure.ensureObject(g);1259Jsonix.Model.AbstractElementsPropertyInfo.prototype.initialize.apply(this,[g]);1260var e=g.key||g.k||undefined;1261Jsonix.Util.Ensure.ensureObject(e);1262var f=g.value||g.v||undefined;1263Jsonix.Util.Ensure.ensureObject(f);1264var h=g.elementName||g.en||undefined;1265if(Jsonix.Util.Type.isObject(h)){this.elementName=Jsonix.XML.QName.fromObject(h)1266}else{if(Jsonix.Util.Type.isString(h)){this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,h)1267}else{this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,this.name)1268}}this.entryTypeInfo=new Jsonix.Model.ClassInfo({name:"Map<"+e.name+","+f.name+">",propertyInfos:[e,f]})1269},unmarshal:function(l,g,k){var h=null;1270var j=this;1271var i=function(a){if(Jsonix.Util.Type.exists(a)){Jsonix.Util.Ensure.ensureObject(a,"Map property requires an object.");1272if(!Jsonix.Util.Type.exists(h)){h={}1273}for(var c in a){if(a.hasOwnProperty(c)){var b=a[c];1274if(j.collection){if(!Jsonix.Util.Type.exists(h[c])){h[c]=[]1275}h[c].push(b)1276}else{if(!Jsonix.Util.Type.exists(h[c])){h[c]=b1277}else{throw new Error("Value was already set.")1278}}}}}};1279if(Jsonix.Util.Type.exists(this.wrapperElementName)){this.unmarshalWrapperElement(l,g,k,i)1280}else{this.unmarshalElement(l,g,k,i)1281}return h1282},getTypeInfoByInputElement:function(d,e,f){return this.entryTypeInfo1283},convertFromTypedNamedValue:function(i,l,g,k){var j=i.value;1284var h={};1285if(Jsonix.Util.Type.isString(j[this.key.name])){h[j[this.key.name]]=j[this.value.name]1286}return h1287},marshal:function(g,e,f,h){if(!Jsonix.Util.Type.exists(g)){return1288}if(Jsonix.Util.Type.exists(this.wrapperElementName)){f.writeStartElement(this.wrapperElementName)1289}this.marshalElement(g,e,f,h);1290if(Jsonix.Util.Type.exists(this.wrapperElementName)){f.writeEndElement()1291}},marshalElement:function(l,r,q,j){if(!!l){for(var m in l){if(l.hasOwnProperty(m)){var p=l[m];1292if(!this.collection){var o={};1293o[this.key.name]=m;1294o[this.value.name]=p;1295q.writeStartElement(this.elementName);1296this.entryTypeInfo.marshal(o,r,q,j);1297q.writeEndElement()1298}else{for(var n=0;1299n<p.length;1300n++){var k={};1301k[this.key.name]=m;1302k[this.value.name]=p[n];1303q.writeStartElement(this.elementName);1304this.entryTypeInfo.marshal(k,r,q,j);1305q.writeEndElement()1306}}}}}},doBuild:function(c,d){this.entryTypeInfo.build(c,d);1307this.key=this.entryTypeInfo.properties[0];1308this.value=this.entryTypeInfo.properties[1]1309},buildStructureElements:function(c,d){d.elements[this.elementName.key]=this1310},setProperty:function(l,j){if(Jsonix.Util.Type.exists(j)){Jsonix.Util.Ensure.ensureObject(j,"Map property requires an object.");1311if(!Jsonix.Util.Type.exists(l[this.name])){l[this.name]={}1312}var i=l[this.name];1313for(var g in j){if(j.hasOwnProperty(g)){var k=j[g];1314if(this.collection){if(!Jsonix.Util.Type.exists(i[g])){i[g]=[]1315}for(var h=0;1316h<k.length;1317h++){i[g].push(k[h])1318}}else{i[g]=k1319}}}}},CLASS_NAME:"Jsonix.Model.ElementMapPropertyInfo"});1320Jsonix.Model.AbstractElementRefsPropertyInfo=Jsonix.Class(Jsonix.Binding.Marshalls.Element,Jsonix.Binding.Marshalls.Element.AsElementRef,Jsonix.Binding.Unmarshalls.Element,Jsonix.Binding.Unmarshalls.WrapperElement,Jsonix.Binding.Unmarshalls.Element.AsElementRef,Jsonix.Model.PropertyInfo,{wrapperElementName:null,allowDom:true,allowTypedObject:true,mixed:true,initialize:function(f){Jsonix.Util.Ensure.ensureObject(f,"Mapping must be an object.");1321Jsonix.Model.PropertyInfo.prototype.initialize.apply(this,[f]);1322var g=f.wrapperElementName||f.wen||undefined;1323if(Jsonix.Util.Type.isObject(g)){this.wrapperElementName=Jsonix.XML.QName.fromObject(g)1324}else{if(Jsonix.Util.Type.isString(g)){this.wrapperElementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,g)1325}else{this.wrapperElementName=null1326}}var h=Jsonix.Util.Type.defaultValue(f.allowDom,f.dom,true);1327var j=Jsonix.Util.Type.defaultValue(f.allowTypedObject,f.typed,true);1328var i=Jsonix.Util.Type.defaultValue(f.mixed,f.mx,true);1329this.allowDom=h;1330this.allowTypedObject=j;1331this.mixed=i1332},unmarshal:function(n,h,m){var i=null;1333var l=this;1334var j=function(a){if(l.collection){if(i===null){i=[]1335}i.push(a)1336}else{if(i===null){i=a1337}else{throw new Error("Value already set.")1338}}};1339var k=h.eventType;1340if(k===Jsonix.XML.Input.START_ELEMENT){if(Jsonix.Util.Type.exists(this.wrapperElementName)){this.unmarshalWrapperElement(n,h,m,j)1341}else{this.unmarshalElement(n,h,m,j)1342}}else{if(this.mixed&&(k===Jsonix.XML.Input.CHARACTERS||k===Jsonix.XML.Input.CDATA||k===Jsonix.XML.Input.ENTITY_REFERENCE)){j(h.getText())1343}else{if(k===Jsonix.XML.Input.SPACE||k===Jsonix.XML.Input.COMMENT||k===Jsonix.XML.Input.PROCESSING_INSTRUCTION){}else{throw new Error("Illegal state: unexpected event type ["+k+"].")1344}}}return i1345},marshal:function(i,l,h,k){if(Jsonix.Util.Type.exists(i)){if(Jsonix.Util.Type.exists(this.wrapperElementName)){h.writeStartElement(this.wrapperElementName)1346}if(!this.collection){this.marshalItem(i,l,h,k)1347}else{Jsonix.Util.Ensure.ensureArray(i,"Collection property requires an array value.");1348for(var g=0;1349g<i.length;1350g++){var j=i[g];1351this.marshalItem(j,l,h,k)1352}}if(Jsonix.Util.Type.exists(this.wrapperElementName)){h.writeEndElement()1353}}},marshalItem:function(g,e,f,h){if(Jsonix.Util.Type.isString(g)){if(!this.mixed){throw new Error("Property is not mixed, can't handle string values.")1354}else{f.writeCharacters(g)1355}}else{if(this.allowDom&&Jsonix.Util.Type.exists(g.nodeType)){f.writeNode(g)1356}else{if(Jsonix.Util.Type.isObject(g)){this.marshalElement(g,e,f,h)1357}else{if(this.mixed){throw new Error("Unsupported content type, either objects or strings are supported.")1358}else{throw new Error("Unsupported content type, only objects are supported.")1359}}}}},getTypeInfoByElementName:function(g,f,i){var j=this.getPropertyElementTypeInfo(g,f);1360if(Jsonix.Util.Type.exists(j)){return j.typeInfo1361}else{var h=f.getElementInfo(g,i);1362if(Jsonix.Util.Type.exists(h)){return h.typeInfo1363}else{return undefined1364}}},getPropertyElementTypeInfo:function(d,c){throw new Error("Abstract method [getPropertyElementTypeInfo].")1365},buildStructure:function(c,d){Jsonix.Util.Ensure.ensureObject(d);1366if(Jsonix.Util.Type.exists(d.value)){throw new Error("The structure already defines a value property.")1367}else{if(!Jsonix.Util.Type.exists(d.elements)){d.elements={}1368}}if(Jsonix.Util.Type.exists(this.wrapperElementName)){d.elements[this.wrapperElementName.key]=this1369}else{this.buildStructureElements(c,d)1370}if((this.allowDom||this.allowTypedObject)){d.any=this1371}if(this.mixed&&!Jsonix.Util.Type.exists(this.wrapperElementName)){d.mixed=this1372}},buildStructureElements:function(c,d){throw new Error("Abstract method [buildStructureElements].")1373},buildStructureElementTypeInfos:function(k,h,g){h.elements[g.elementName.key]=this;1374var l=k.getSubstitutionMembers(g.elementName);1375if(Jsonix.Util.Type.isArray(l)){for(var i=0;1376i<l.length;1377i++){var j=l[i];1378this.buildStructureElementTypeInfos(k,h,j)1379}}},CLASS_NAME:"Jsonix.Model.AbstractElementRefsPropertyInfo"});1380Jsonix.Model.ElementRefPropertyInfo=Jsonix.Class(Jsonix.Model.AbstractElementRefsPropertyInfo,{typeInfo:"String",elementName:null,initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1381Jsonix.Model.AbstractElementRefsPropertyInfo.prototype.initialize.apply(this,[d]);1382var f=d.typeInfo||d.ti||"String";1383if(Jsonix.Util.Type.isObject(f)){this.typeInfo=f1384}else{Jsonix.Util.Ensure.ensureString(f);1385this.typeInfo=f1386}var e=d.elementName||d.en||undefined;1387if(Jsonix.Util.Type.isObject(e)){this.elementName=Jsonix.XML.QName.fromObject(e)1388}else{if(Jsonix.Util.Type.isString(e)){this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,e)1389}else{this.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,this.name)1390}}},getPropertyElementTypeInfo:function(e,f){var d=Jsonix.XML.QName.fromObjectOrString(e,f);1391if(d.key===this.elementName.key){return this1392}else{return null1393}},doBuild:function(c,d){this.typeInfo=c.resolveTypeInfo(this.typeInfo,d)1394},buildStructureElements:function(c,d){this.buildStructureElementTypeInfos(c,d,this)1395},CLASS_NAME:"Jsonix.Model.ElementRefPropertyInfo"});1396Jsonix.Model.ElementRefPropertyInfo.Simplified=Jsonix.Class(Jsonix.Model.ElementRefPropertyInfo,Jsonix.Binding.Unmarshalls.Element.AsSimplifiedElementRef,{CLASS_NAME:"Jsonix.Model.ElementRefPropertyInfo.Simplified"});1397Jsonix.Model.ElementRefsPropertyInfo=Jsonix.Class(Jsonix.Model.AbstractElementRefsPropertyInfo,{elementTypeInfos:null,elementTypeInfosMap:null,initialize:function(d){Jsonix.Util.Ensure.ensureObject(d);1398Jsonix.Model.AbstractElementRefsPropertyInfo.prototype.initialize.apply(this,[d]);1399var f=d.elementTypeInfos||d.etis||[];1400Jsonix.Util.Ensure.ensureArray(f);1401this.elementTypeInfos=[];1402for(var e=0;1403e<f.length;1404e++){this.elementTypeInfos[e]=Jsonix.Util.Type.cloneObject(f[e])1405}},getPropertyElementTypeInfo:function(f,h){var e=Jsonix.XML.QName.fromObjectOrString(f,h);1406var g=this.elementTypeInfosMap[e.key];1407if(Jsonix.Util.Type.exists(g)){return{elementName:e,typeInfo:g}1408}else{return null1409}},doBuild:function(k,l){this.elementTypeInfosMap={};1410var i,j;1411for(var g=0;1412g<this.elementTypeInfos.length;1413g++){var h=this.elementTypeInfos[g];1414Jsonix.Util.Ensure.ensureObject(h);1415i=h.typeInfo||h.ti||"String";1416h.typeInfo=k.resolveTypeInfo(i,l);1417j=h.elementName||h.en||undefined;1418h.elementName=Jsonix.XML.QName.fromObjectOrString(j,k,this.defaultElementNamespaceURI);1419this.elementTypeInfosMap[h.elementName.key]=h.typeInfo1420}},buildStructureElements:function(g,f){for(var h=0;1421h<this.elementTypeInfos.length;1422h++){var e=this.elementTypeInfos[h];1423this.buildStructureElementTypeInfos(g,f,e)1424}},CLASS_NAME:"Jsonix.Model.ElementRefsPropertyInfo"});1425Jsonix.Model.ElementRefsPropertyInfo.Simplified=Jsonix.Class(Jsonix.Model.ElementRefsPropertyInfo,Jsonix.Binding.Unmarshalls.Element.AsSimplifiedElementRef,{CLASS_NAME:"Jsonix.Model.ElementRefsPropertyInfo.Simplified"});1426Jsonix.Model.AnyElementPropertyInfo=Jsonix.Class(Jsonix.Binding.Marshalls.Element,Jsonix.Binding.Marshalls.Element.AsElementRef,Jsonix.Binding.Unmarshalls.Element,Jsonix.Binding.Unmarshalls.Element.AsElementRef,Jsonix.Model.PropertyInfo,{allowDom:true,allowTypedObject:true,mixed:true,initialize:function(f){Jsonix.Util.Ensure.ensureObject(f);1427Jsonix.Model.PropertyInfo.prototype.initialize.apply(this,[f]);1428var g=Jsonix.Util.Type.defaultValue(f.allowDom,f.dom,true);1429var e=Jsonix.Util.Type.defaultValue(f.allowTypedObject,f.typed,true);1430var h=Jsonix.Util.Type.defaultValue(f.mixed,f.mx,true);1431this.allowDom=g;1432this.allowTypedObject=e;1433this.mixed=h1434},unmarshal:function(n,h,m){var i=null;1435var l=this;1436var j=function(a){if(l.collection){if(i===null){i=[]1437}i.push(a)1438}else{if(i===null){i=a1439}else{throw new Error("Value already set.")1440}}};1441var k=h.eventType;1442if(k===Jsonix.XML.Input.START_ELEMENT){this.unmarshalElement(n,h,m,j)1443}else{if(this.mixed&&(k===Jsonix.XML.Input.CHARACTERS||k===Jsonix.XML.Input.CDATA||k===Jsonix.XML.Input.ENTITY_REFERENCE)){j(h.getText())1444}else{if(this.mixed&&(k===Jsonix.XML.Input.SPACE)){}else{if(k===Jsonix.XML.Input.COMMENT||k===Jsonix.XML.Input.PROCESSING_INSTRUCTION){}else{throw new Error("Illegal state: unexpected event type ["+k+"].")1445}}}}return i1446},marshal:function(h,j,g,i){if(!Jsonix.Util.Type.exists(h)){return1447}if(!this.collection){this.marshalItem(h,j,g,i)1448}else{Jsonix.Util.Ensure.ensureArray(h);1449for(var f=0;1450f<h.length;1451f++){this.marshalItem(h[f],j,g,i)1452}}},marshalItem:function(g,e,f,h){if(this.mixed&&Jsonix.Util.Type.isString(g)){f.writeCharacters(g)1453}else{if(this.allowDom&&Jsonix.Util.Type.exists(g.nodeType)){f.writeNode(g)1454}else{if(this.allowTypedObject){this.marshalElement(g,e,f,h)1455}}}},doBuild:function(c,d){},buildStructure:function(c,d){Jsonix.Util.Ensure.ensureObject(d);1456if(Jsonix.Util.Type.exists(d.value)){throw new Error("The structure already defines a value property.")1457}else{if(!Jsonix.Util.Type.exists(d.elements)){d.elements={}1458}}if((this.allowDom||this.allowTypedObject)){d.any=this1459}if(this.mixed){d.mixed=this1460}},CLASS_NAME:"Jsonix.Model.AnyElementPropertyInfo"});1461Jsonix.Model.AnyElementPropertyInfo.Simplified=Jsonix.Class(Jsonix.Model.AnyElementPropertyInfo,Jsonix.Binding.Unmarshalls.Element.AsSimplifiedElementRef,{CLASS_NAME:"Jsonix.Model.AnyElementPropertyInfo.Simplified"});1462Jsonix.Model.Module=Jsonix.Class(Jsonix.Mapping.Styled,{name:null,typeInfos:null,elementInfos:null,targetNamespace:"",defaultElementNamespaceURI:"",defaultAttributeNamespaceURI:"",initialize:function(r,j){Jsonix.Mapping.Styled.prototype.initialize.apply(this,[j]);1463this.typeInfos=[];1464this.elementInfos=[];1465if(typeof r!=="undefined"){Jsonix.Util.Ensure.ensureObject(r);1466var q=r.name||r.n||null;1467this.name=q;1468var n=r.defaultElementNamespaceURI||r.dens||r.targetNamespace||r.tns||"";1469this.defaultElementNamespaceURI=n;1470var k=r.targetNamespace||r.tns||r.defaultElementNamespaceURI||r.dens||this.defaultElementNamespaceURI;1471this.targetNamespace=k;1472var l=r.defaultAttributeNamespaceURI||r.dans||"";1473this.defaultAttributeNamespaceURI=l;1474var m=r.typeInfos||r.tis||[];1475this.initializeTypeInfos(m);1476for(var p in r){if(r.hasOwnProperty(p)){if(r[p] instanceof this.mappingStyle.classInfo){this.typeInfos.push(r[p])1477}}}var o=r.elementInfos||r.eis||[];1478this.initializeElementInfos(o)1479}},initializeTypeInfos:function(f){Jsonix.Util.Ensure.ensureArray(f);1480var h,e,g;1481for(h=0;1482h<f.length;1483h++){e=f[h];1484g=this.createTypeInfo(e);1485this.typeInfos.push(g)1486}},initializeElementInfos:function(h){Jsonix.Util.Ensure.ensureArray(h);1487var e,f,g;1488for(e=0;1489e<h.length;1490e++){f=h[e];1491g=this.createElementInfo(f);1492this.elementInfos.push(g)1493}},createTypeInfo:function(f){Jsonix.Util.Ensure.ensureObject(f);1494var g;1495if(f instanceof Jsonix.Model.TypeInfo){g=f1496}else{f=Jsonix.Util.Type.cloneObject(f);1497var e=f.type||f.t||"classInfo";1498if(Jsonix.Util.Type.isFunction(this.typeInfoCreators[e])){var h=this.typeInfoCreators[e];1499g=h.call(this,f)1500}else{throw new Error("Unknown type info type ["+e+"].")1501}}return g1502},initializeNames:function(e){var d=e.localName||e.ln||null;1503e.localName=d;1504var f=e.name||e.n||null;1505e.name=f;1506if(Jsonix.Util.Type.isString(e.name)){if(e.name.length>0&&e.name.charAt(0)==="."&&Jsonix.Util.Type.isString(this.name)){e.name=this.name+e.name1507}}else{if(Jsonix.Util.Type.isString(d)){if(Jsonix.Util.Type.isString(this.name)){e.name=this.name+"."+d1508}else{e.name=d1509}}else{throw new Error("Neither [name/n] nor [localName/ln] was provided for the class info.")1510}}},createClassInfo:function(f){Jsonix.Util.Ensure.ensureObject(f);1511var j=f.defaultElementNamespaceURI||f.dens||this.defaultElementNamespaceURI;1512f.defaultElementNamespaceURI=j;1513var g=f.targetNamespace||f.tns||this.targetNamespace;1514f.targetNamespace=g;1515var h=f.defaultAttributeNamespaceURI||f.dans||this.defaultAttributeNamespaceURI;1516f.defaultAttributeNamespaceURI=h;1517this.initializeNames(f);1518var i=new this.mappingStyle.classInfo(f,{mappingStyle:this.mappingStyle});1519i.module=this;1520return i1521},createEnumLeafInfo:function(d){Jsonix.Util.Ensure.ensureObject(d);1522this.initializeNames(d);1523var c=new this.mappingStyle.enumLeafInfo(d,{mappingStyle:this.mappingStyle});1524c.module=this;1525return c1526},createList:function(f){Jsonix.Util.Ensure.ensureObject(f);1527var h=f.baseTypeInfo||f.typeInfo||f.bti||f.ti||"String";1528var g=f.typeName||f.tn||null;1529if(Jsonix.Util.Type.exists(g)){if(Jsonix.Util.Type.isString(g)){g=new Jsonix.XML.QName(this.targetNamespace,g)1530}else{g=Jsonix.XML.QName.fromObject(g)1531}}var i=f.separator||f.sep||" ";1532Jsonix.Util.Ensure.ensureExists(h);1533var j=new Jsonix.Schema.XSD.List(h,g,i);1534j.module=this;1535return j1536},createElementInfo:function(g){Jsonix.Util.Ensure.ensureObject(g);1537g=Jsonix.Util.Type.cloneObject(g);1538var i=g.defaultElementNamespaceURI||g.dens||this.defaultElementNamespaceURI;1539g.defaultElementNamespaceURI=i;1540var h=g.elementName||g.en||undefined;1541Jsonix.Util.Ensure.ensureExists(h);1542var j=g.typeInfo||g.ti||"String";1543Jsonix.Util.Ensure.ensureExists(j);1544g.typeInfo=j;1545if(Jsonix.Util.Type.isObject(h)){g.elementName=Jsonix.XML.QName.fromObject(h)1546}else{if(Jsonix.Util.Type.isString(h)){g.elementName=new Jsonix.XML.QName(this.defaultElementNamespaceURI,h)1547}else{throw new Error("Element info ["+g+"] must provide an element name.")1548}}var l=g.substitutionHead||g.sh||null;1549if(Jsonix.Util.Type.exists(l)){if(Jsonix.Util.Type.isObject(l)){g.substitutionHead=Jsonix.XML.QName.fromObject(l)1550}else{Jsonix.Util.Ensure.ensureString(l);1551g.substitutionHead=new Jsonix.XML.QName(this.defaultElementNamespaceURI,l)1552}}var k=new this.mappingStyle.elementInfo(g,{mappingStyle:this.mappingStyle});1553k.module=this;1554return k1555},registerTypeInfos:function(d){for(var e=0;1556e<this.typeInfos.length;1557e++){var f=this.typeInfos[e];1558d.registerTypeInfo(f,this)1559}},buildTypeInfos:function(d){for(var e=0;1560e<this.typeInfos.length;1561e++){var f=this.typeInfos[e];1562f.build(d,this)1563}},registerElementInfos:function(d){for(var e=0;1564e<this.elementInfos.length;1565e++){var f=this.elementInfos[e];1566d.registerElementInfo(f,this)1567}},buildElementInfos:function(d){for(var e=0;1568e<this.elementInfos.length;1569e++){var f=this.elementInfos[e];1570f.build(d,this)1571}},cs:function(){return this1572},es:function(){return this1573},CLASS_NAME:"Jsonix.Model.Module"});1574Jsonix.Model.Module.prototype.typeInfoCreators={classInfo:Jsonix.Model.Module.prototype.createClassInfo,c:Jsonix.Model.Module.prototype.createClassInfo,enumInfo:Jsonix.Model.Module.prototype.createEnumLeafInfo,"enum":Jsonix.Model.Module.prototype.createEnumLeafInfo,list:Jsonix.Model.Module.prototype.createList,l:Jsonix.Model.Module.prototype.createList};1575Jsonix.Mapping.Style.Standard=Jsonix.Class(Jsonix.Mapping.Style,{marshaller:Jsonix.Binding.Marshaller,unmarshaller:Jsonix.Binding.Unmarshaller,module:Jsonix.Model.Module,elementInfo:Jsonix.Model.ElementInfo,classInfo:Jsonix.Model.ClassInfo,enumLeafInfo:Jsonix.Model.EnumLeafInfo,anyAttributePropertyInfo:Jsonix.Model.AnyAttributePropertyInfo,anyElementPropertyInfo:Jsonix.Model.AnyElementPropertyInfo,attributePropertyInfo:Jsonix.Model.AttributePropertyInfo,elementMapPropertyInfo:Jsonix.Model.ElementMapPropertyInfo,elementPropertyInfo:Jsonix.Model.ElementPropertyInfo,elementsPropertyInfo:Jsonix.Model.ElementsPropertyInfo,elementRefPropertyInfo:Jsonix.Model.ElementRefPropertyInfo,elementRefsPropertyInfo:Jsonix.Model.ElementRefsPropertyInfo,valuePropertyInfo:Jsonix.Model.ValuePropertyInfo,initialize:function(){Jsonix.Mapping.Style.prototype.initialize.apply(this)1576},CLASS_NAME:"Jsonix.Mapping.Style.Standard"});1577Jsonix.Mapping.Style.STYLES.standard=new Jsonix.Mapping.Style.Standard();1578Jsonix.Mapping.Style.Simplified=Jsonix.Class(Jsonix.Mapping.Style,{marshaller:Jsonix.Binding.Marshaller.Simplified,unmarshaller:Jsonix.Binding.Unmarshaller.Simplified,module:Jsonix.Model.Module,elementInfo:Jsonix.Model.ElementInfo,classInfo:Jsonix.Model.ClassInfo,enumLeafInfo:Jsonix.Model.EnumLeafInfo,anyAttributePropertyInfo:Jsonix.Model.AnyAttributePropertyInfo.Simplified,anyElementPropertyInfo:Jsonix.Model.AnyElementPropertyInfo.Simplified,attributePropertyInfo:Jsonix.Model.AttributePropertyInfo,elementMapPropertyInfo:Jsonix.Model.ElementMapPropertyInfo,elementPropertyInfo:Jsonix.Model.ElementPropertyInfo,elementsPropertyInfo:Jsonix.Model.ElementsPropertyInfo,elementRefPropertyInfo:Jsonix.Model.ElementRefPropertyInfo.Simplified,elementRefsPropertyInfo:Jsonix.Model.ElementRefsPropertyInfo.Simplified,valuePropertyInfo:Jsonix.Model.ValuePropertyInfo,initialize:function(){Jsonix.Mapping.Style.prototype.initialize.apply(this)1579},CLASS_NAME:"Jsonix.Mapping.Style.Simplified"});1580Jsonix.Mapping.Style.STYLES.simplified=new Jsonix.Mapping.Style.Simplified();1581Jsonix.Schema.XSD={};1582Jsonix.Schema.XSD.NAMESPACE_URI="http://www.w3.org/2001/XMLSchema";1583Jsonix.Schema.XSD.PREFIX="xsd";1584Jsonix.Schema.XSD.qname=function(b){Jsonix.Util.Ensure.ensureString(b);1585return new Jsonix.XML.QName(Jsonix.Schema.XSD.NAMESPACE_URI,b,Jsonix.Schema.XSD.PREFIX)1586};1587Jsonix.Schema.XSD.AnyType=Jsonix.Class(Jsonix.Model.ClassInfo,{typeName:Jsonix.Schema.XSD.qname("anyType"),initialize:function(){Jsonix.Model.ClassInfo.prototype.initialize.call(this,{name:"AnyType",propertyInfos:[{type:"anyAttribute",name:"attributes"},{type:"anyElement",name:"content",collection:true}]})1588},CLASS_NAME:"Jsonix.Schema.XSD.AnyType"});1589Jsonix.Schema.XSD.AnyType.INSTANCE=new Jsonix.Schema.XSD.AnyType();1590Jsonix.Schema.XSD.AnySimpleType=Jsonix.Class(Jsonix.Model.TypeInfo,{name:"AnySimpleType",typeName:Jsonix.Schema.XSD.qname("anySimpleType"),initialize:function(){Jsonix.Model.TypeInfo.prototype.initialize.apply(this,[])1591},print:function(g,e,f,h){return g1592},parse:function(g,e,f,h){return g1593},isInstance:function(f,e,d){return true1594},reprint:function(g,e,f,h){if(Jsonix.Util.Type.isString(g)&&!this.isInstance(g,e,h)){return this.print(this.parse(g,e,null,h),e,f,h)1595}else{return this.print(g,e,f,h)1596}},unmarshal:function(e,f,h){var g=f.getElementText();1597if(Jsonix.Util.StringUtils.isNotBlank(g)){return this.parse(g,e,f,h)1598}else{return null1599}},marshal:function(g,e,f,h){if(Jsonix.Util.Type.exists(g)){f.writeCharacters(this.reprint(g,e,f,h))1600}},build:function(c,d){},CLASS_NAME:"Jsonix.Schema.XSD.AnySimpleType"});1601Jsonix.Schema.XSD.AnySimpleType.INSTANCE=new Jsonix.Schema.XSD.AnySimpleType();1602Jsonix.Schema.XSD.List=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:null,typeName:null,typeInfo:null,separator:" ",trimmedSeparator:Jsonix.Util.StringUtils.whitespaceCharacters,simpleType:true,built:false,initialize:function(e,f,h){Jsonix.Util.Ensure.ensureExists(e);1603this.typeInfo=e;1604if(!Jsonix.Util.Type.exists(this.name)){this.name=e.name+"*"1605}if(Jsonix.Util.Type.exists(f)){this.typeName=f1606}if(Jsonix.Util.Type.isString(h)){this.separator=h1607}else{this.separator=" "1608}var g=Jsonix.Util.StringUtils.trim(this.separator);1609if(g.length===0){this.trimmedSeparator=Jsonix.Util.StringUtils.whitespaceCharacters1610}else{this.trimmedSeparator=g1611}},build:function(b){if(!this.built){this.typeInfo=b.resolveTypeInfo(this.typeInfo,this.module);1612this.built=true1613}},print:function(i,k,g,j){if(!Jsonix.Util.Type.exists(i)){return null1614}Jsonix.Util.Ensure.ensureArray(i);1615var h="";1616for(var l=0;1617l<i.length;1618l++){if(l>0){h=h+this.separator1619}h=h+this.typeInfo.reprint(i[l],k,g,j)1620}return h1621},parse:function(j,l,n,k){Jsonix.Util.Ensure.ensureString(j);1622var h=Jsonix.Util.StringUtils.splitBySeparatorChars(j,this.trimmedSeparator);1623var i=[];1624for(var m=0;1625m<h.length;1626m++){i.push(this.typeInfo.parse(Jsonix.Util.StringUtils.trim(h[m]),l,n,k))1627}return i1628},CLASS_NAME:"Jsonix.Schema.XSD.List"});1629Jsonix.Schema.XSD.String=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"String",typeName:Jsonix.Schema.XSD.qname("string"),unmarshal:function(e,f,h){var g=f.getElementText();1630return this.parse(g,e,f,h)1631},print:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1632return g1633},parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1634return g1635},isInstance:function(f,e,d){return Jsonix.Util.Type.isString(f)1636},CLASS_NAME:"Jsonix.Schema.XSD.String"});1637Jsonix.Schema.XSD.String.INSTANCE=new Jsonix.Schema.XSD.String();1638Jsonix.Schema.XSD.String.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.String.INSTANCE);1639Jsonix.Schema.XSD.Strings=Jsonix.Class(Jsonix.Schema.XSD.List,{name:"Strings",initialize:function(){Jsonix.Schema.XSD.List.prototype.initialize.apply(this,[Jsonix.Schema.XSD.String.INSTANCE,Jsonix.Schema.XSD.qname("strings")," "])1640},CLASS_NAME:"Jsonix.Schema.XSD.Strings"});1641Jsonix.Schema.XSD.Strings.INSTANCE=new Jsonix.Schema.XSD.Strings();1642Jsonix.Schema.XSD.NormalizedString=Jsonix.Class(Jsonix.Schema.XSD.String,{name:"NormalizedString",typeName:Jsonix.Schema.XSD.qname("normalizedString"),CLASS_NAME:"Jsonix.Schema.XSD.NormalizedString"});1643Jsonix.Schema.XSD.NormalizedString.INSTANCE=new Jsonix.Schema.XSD.NormalizedString();1644Jsonix.Schema.XSD.NormalizedString.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.NormalizedString.INSTANCE);1645Jsonix.Schema.XSD.Token=Jsonix.Class(Jsonix.Schema.XSD.NormalizedString,{name:"Token",typeName:Jsonix.Schema.XSD.qname("token"),CLASS_NAME:"Jsonix.Schema.XSD.Token"});1646Jsonix.Schema.XSD.Token.INSTANCE=new Jsonix.Schema.XSD.Token();1647Jsonix.Schema.XSD.Token.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Token.INSTANCE);1648Jsonix.Schema.XSD.Language=Jsonix.Class(Jsonix.Schema.XSD.Token,{name:"Language",typeName:Jsonix.Schema.XSD.qname("language"),CLASS_NAME:"Jsonix.Schema.XSD.Language"});1649Jsonix.Schema.XSD.Language.INSTANCE=new Jsonix.Schema.XSD.Language();1650Jsonix.Schema.XSD.Language.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Language.INSTANCE);1651Jsonix.Schema.XSD.Name=Jsonix.Class(Jsonix.Schema.XSD.Token,{name:"Name",typeName:Jsonix.Schema.XSD.qname("Name"),CLASS_NAME:"Jsonix.Schema.XSD.Name"});1652Jsonix.Schema.XSD.Name.INSTANCE=new Jsonix.Schema.XSD.Name();1653Jsonix.Schema.XSD.Name.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Name.INSTANCE);1654Jsonix.Schema.XSD.NCName=Jsonix.Class(Jsonix.Schema.XSD.Name,{name:"NCName",typeName:Jsonix.Schema.XSD.qname("NCName"),CLASS_NAME:"Jsonix.Schema.XSD.NCName"});1655Jsonix.Schema.XSD.NCName.INSTANCE=new Jsonix.Schema.XSD.NCName();1656Jsonix.Schema.XSD.NCName.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.NCName.INSTANCE);1657Jsonix.Schema.XSD.NMToken=Jsonix.Class(Jsonix.Schema.XSD.Token,{name:"NMToken",typeName:Jsonix.Schema.XSD.qname("NMTOKEN"),CLASS_NAME:"Jsonix.Schema.XSD.NMToken"});1658Jsonix.Schema.XSD.NMToken.INSTANCE=new Jsonix.Schema.XSD.NMToken();1659Jsonix.Schema.XSD.NMTokens=Jsonix.Class(Jsonix.Schema.XSD.List,{name:"NMTokens",initialize:function(){Jsonix.Schema.XSD.List.prototype.initialize.apply(this,[Jsonix.Schema.XSD.NMToken.INSTANCE,Jsonix.Schema.XSD.qname("NMTOKEN")," "])1660},CLASS_NAME:"Jsonix.Schema.XSD.NMTokens"});1661Jsonix.Schema.XSD.NMTokens.INSTANCE=new Jsonix.Schema.XSD.NMTokens();1662Jsonix.Schema.XSD.Boolean=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Boolean",typeName:Jsonix.Schema.XSD.qname("boolean"),print:function(g,e,f,h){Jsonix.Util.Ensure.ensureBoolean(g);1663return g?"true":"false"1664},parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1665if(g==="true"||g==="1"){return true1666}else{if(g==="false"||g==="0"){return false1667}else{throw new Error("Either [true], [1], [0] or [false] expected as boolean value.")1668}}},isInstance:function(f,e,d){return Jsonix.Util.Type.isBoolean(f)1669},CLASS_NAME:"Jsonix.Schema.XSD.Boolean"});1670Jsonix.Schema.XSD.Boolean.INSTANCE=new Jsonix.Schema.XSD.Boolean();1671Jsonix.Schema.XSD.Boolean.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Boolean.INSTANCE);1672Jsonix.Schema.XSD.Base64Binary=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Base64Binary",typeName:Jsonix.Schema.XSD.qname("base64Binary"),charToByte:{},byteToChar:[],initialize:function(){Jsonix.Schema.XSD.AnySimpleType.prototype.initialize.apply(this);1673var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";1674for(var h=0;1675h<f.length;1676h++){var e=f.charAt(h);1677var g=f.charCodeAt(h);1678this.byteToChar[h]=e;1679this.charToByte[e]=h1680}},print:function(g,e,f,h){Jsonix.Util.Ensure.ensureArray(g);1681return this.encode(g)1682},parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1683return this.decode(g)1684},encode:function(s){var w="";1685var i;1686var j;1687var o;1688var p;1689var q;1690var r;1691var t;1692var u=0;1693var v=0;1694var x=s.length;1695for(u=0;1696u<x;1697u+=3){i=s[u]&255;1698p=this.byteToChar[i>>2];1699if(u+1<x){j=s[u+1]&255;1700q=this.byteToChar[((i&3)<<4)|(j>>4)];1701if(u+2<x){o=s[u+2]&255;1702r=this.byteToChar[((j&15)<<2)|(o>>6)];1703t=this.byteToChar[o&63]1704}else{r=this.byteToChar[(j&15)<<2];1705t="="1706}}else{q=this.byteToChar[(i&3)<<4];1707r="=";1708t="="1709}w=w+p+q+r+t1710}return w1711},decode:function(j){input=j.replace(/[^A-Za-z0-9\+\/\=]/g,"");1712var x=(input.length/4)*3;1713if(input.charAt(input.length-1)==="="){x--1714}if(input.charAt(input.length-2)==="="){x--1715}var t=new Array(x);1716var i;1717var o;1718var p;1719var q;1720var r;1721var s;1722var u;1723var v=0;1724var w=0;1725for(v=0;1726v<x;1727v+=3){q=this.charToByte[input.charAt(w++)];1728r=this.charToByte[input.charAt(w++)];1729s=this.charToByte[input.charAt(w++)];1730u=this.charToByte[input.charAt(w++)];1731i=(q<<2)|(r>>4);1732o=((r&15)<<4)|(s>>2);1733p=((s&3)<<6)|u;1734t[v]=i;1735if(s!=64){t[v+1]=o1736}if(u!=64){t[v+2]=p1737}}return t1738},isInstance:function(f,e,d){return Jsonix.Util.Type.isArray(f)1739},CLASS_NAME:"Jsonix.Schema.XSD.Base64Binary"});1740Jsonix.Schema.XSD.Base64Binary.INSTANCE=new Jsonix.Schema.XSD.Base64Binary();1741Jsonix.Schema.XSD.Base64Binary.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Base64Binary.INSTANCE);1742Jsonix.Schema.XSD.HexBinary=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"HexBinary",typeName:Jsonix.Schema.XSD.qname("hexBinary"),charToQuartet:{},byteToDuplet:[],initialize:function(){Jsonix.Schema.XSD.AnySimpleType.prototype.initialize.apply(this);1743var d="0123456789ABCDEF";1744var f=d.toLowerCase();1745var e;1746for(e=0;1747e<16;1748e++){this.charToQuartet[d.charAt(e)]=e;1749if(e>=10){this.charToQuartet[f.charAt(e)]=e1750}}for(e=0;1751e<256;1752e++){this.byteToDuplet[e]=d[e>>4]+d[e&15]1753}},print:function(g,e,f,h){Jsonix.Util.Ensure.ensureArray(g);1754return this.encode(g)1755},parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1756return this.decode(g)1757},encode:function(f){var e="";1758for(var d=0;1759d<f.length;1760d++){e=e+this.byteToDuplet[f[d]&255]1761}return e1762},decode:function(j){var i=j.replace(/[^A-Fa-f0-9]/g,"");1763var l=i.length>>1;1764var n=new Array(l);1765for(var h=0;1766h<l;1767h++){var k=i.charAt(2*h);1768var m=i.charAt(2*h+1);1769n[h]=this.charToQuartet[k]<<4|this.charToQuartet[m]1770}return n1771},isInstance:function(f,e,d){return Jsonix.Util.Type.isArray(f)1772},CLASS_NAME:"Jsonix.Schema.XSD.HexBinary"});1773Jsonix.Schema.XSD.HexBinary.INSTANCE=new Jsonix.Schema.XSD.HexBinary();1774Jsonix.Schema.XSD.HexBinary.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.HexBinary.INSTANCE);1775Jsonix.Schema.XSD.Number=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Number",typeName:Jsonix.Schema.XSD.qname("number"),print:function(i,f,g,j){Jsonix.Util.Ensure.ensureNumberOrNaN(i);1776if(Jsonix.Util.Type.isNaN(i)){return"NaN"1777}else{if(i===Infinity){return"INF"1778}else{if(i===-Infinity){return"-INF"1779}else{var h=String(i);1780return h1781}}}},parse:function(h,f,g,j){Jsonix.Util.Ensure.ensureString(h);1782if(h==="-INF"){return -Infinity1783}else{if(h==="INF"){return Infinity1784}else{if(h==="NaN"){return NaN1785}else{var i=Number(h);1786Jsonix.Util.Ensure.ensureNumber(i);1787return i1788}}}},isInstance:function(f,e,d){return Jsonix.Util.Type.isNumberOrNaN(f)1789},CLASS_NAME:"Jsonix.Schema.XSD.Number"});1790Jsonix.Schema.XSD.Number.INSTANCE=new Jsonix.Schema.XSD.Number();1791Jsonix.Schema.XSD.Number.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Number.INSTANCE);1792Jsonix.Schema.XSD.Float=Jsonix.Class(Jsonix.Schema.XSD.Number,{name:"Float",typeName:Jsonix.Schema.XSD.qname("float"),isInstance:function(f,e,d){return Jsonix.Util.Type.isNaN(f)||f===-Infinity||f===Infinity||(Jsonix.Util.Type.isNumber(f)&&f>=this.MIN_VALUE&&f<=this.MAX_VALUE)1793},MIN_VALUE:-3.4028235e+38,MAX_VALUE:3.4028235e+38,CLASS_NAME:"Jsonix.Schema.XSD.Float"});1794Jsonix.Schema.XSD.Float.INSTANCE=new Jsonix.Schema.XSD.Float();1795Jsonix.Schema.XSD.Float.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Float.INSTANCE);1796Jsonix.Schema.XSD.Decimal=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Decimal",typeName:Jsonix.Schema.XSD.qname("decimal"),print:function(i,f,g,j){Jsonix.Util.Ensure.ensureNumber(i);1797var h=String(i);1798return h1799},parse:function(h,f,g,j){Jsonix.Util.Ensure.ensureString(h);1800var i=Number(h);1801Jsonix.Util.Ensure.ensureNumber(i);1802return i1803},isInstance:function(f,e,d){return Jsonix.Util.Type.isNumber(f)1804},CLASS_NAME:"Jsonix.Schema.XSD.Decimal"});1805Jsonix.Schema.XSD.Decimal.INSTANCE=new Jsonix.Schema.XSD.Decimal();1806Jsonix.Schema.XSD.Decimal.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Decimal.INSTANCE);1807Jsonix.Schema.XSD.Integer=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Integer",typeName:Jsonix.Schema.XSD.qname("integer"),print:function(i,f,g,j){Jsonix.Util.Ensure.ensureInteger(i);1808var h=String(i);1809return h1810},parse:function(h,f,g,j){Jsonix.Util.Ensure.ensureString(h);1811var i=Number(h);1812Jsonix.Util.Ensure.ensureInteger(i);1813return i1814},isInstance:function(f,e,d){return Jsonix.Util.NumberUtils.isInteger(f)&&f>=this.MIN_VALUE&&f<=this.MAX_VALUE1815},MIN_VALUE:-9223372036854776000,MAX_VALUE:9223372036854776000,CLASS_NAME:"Jsonix.Schema.XSD.Integer"});1816Jsonix.Schema.XSD.Integer.INSTANCE=new Jsonix.Schema.XSD.Integer();1817Jsonix.Schema.XSD.Integer.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Integer.INSTANCE);1818Jsonix.Schema.XSD.NonPositiveInteger=Jsonix.Class(Jsonix.Schema.XSD.Integer,{name:"NonPositiveInteger",typeName:Jsonix.Schema.XSD.qname("nonPositiveInteger"),MIN_VALUE:-9223372036854776000,MAX_VALUE:0,CLASS_NAME:"Jsonix.Schema.XSD.NonPositiveInteger"});1819Jsonix.Schema.XSD.NonPositiveInteger.INSTANCE=new Jsonix.Schema.XSD.NonPositiveInteger();1820Jsonix.Schema.XSD.NonPositiveInteger.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.NonPositiveInteger.INSTANCE);1821Jsonix.Schema.XSD.NegativeInteger=Jsonix.Class(Jsonix.Schema.XSD.NonPositiveInteger,{name:"NegativeInteger",typeName:Jsonix.Schema.XSD.qname("negativeInteger"),MIN_VALUE:-9223372036854776000,MAX_VALUE:-1,CLASS_NAME:"Jsonix.Schema.XSD.NegativeInteger"});1822Jsonix.Schema.XSD.NegativeInteger.INSTANCE=new Jsonix.Schema.XSD.NegativeInteger();1823Jsonix.Schema.XSD.NegativeInteger.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.NegativeInteger.INSTANCE);1824Jsonix.Schema.XSD.Long=Jsonix.Class(Jsonix.Schema.XSD.Integer,{name:"Long",typeName:Jsonix.Schema.XSD.qname("long"),MIN_VALUE:-9223372036854776000,MAX_VALUE:9223372036854776000,CLASS_NAME:"Jsonix.Schema.XSD.Long"});1825Jsonix.Schema.XSD.Long.INSTANCE=new Jsonix.Schema.XSD.Long();1826Jsonix.Schema.XSD.Long.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Long.INSTANCE);1827Jsonix.Schema.XSD.Int=Jsonix.Class(Jsonix.Schema.XSD.Long,{name:"Int",typeName:Jsonix.Schema.XSD.qname("int"),MIN_VALUE:-2147483648,MAX_VALUE:2147483647,CLASS_NAME:"Jsonix.Schema.XSD.Int"});1828Jsonix.Schema.XSD.Int.INSTANCE=new Jsonix.Schema.XSD.Int();1829Jsonix.Schema.XSD.Int.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Int.INSTANCE);1830Jsonix.Schema.XSD.Short=Jsonix.Class(Jsonix.Schema.XSD.Int,{name:"Short",typeName:Jsonix.Schema.XSD.qname("short"),MIN_VALUE:-32768,MAX_VALUE:32767,CLASS_NAME:"Jsonix.Schema.XSD.Short"});1831Jsonix.Schema.XSD.Short.INSTANCE=new Jsonix.Schema.XSD.Short();1832Jsonix.Schema.XSD.Short.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Short.INSTANCE);1833Jsonix.Schema.XSD.Byte=Jsonix.Class(Jsonix.Schema.XSD.Short,{name:"Byte",typeName:Jsonix.Schema.XSD.qname("byte"),MIN_VALUE:-128,MAX_VALUE:127,CLASS_NAME:"Jsonix.Schema.XSD.Byte"});1834Jsonix.Schema.XSD.Byte.INSTANCE=new Jsonix.Schema.XSD.Byte();1835Jsonix.Schema.XSD.Byte.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Byte.INSTANCE);1836Jsonix.Schema.XSD.NonNegativeInteger=Jsonix.Class(Jsonix.Schema.XSD.Integer,{name:"NonNegativeInteger",typeName:Jsonix.Schema.XSD.qname("nonNegativeInteger"),MIN_VALUE:0,MAX_VALUE:9223372036854776000,CLASS_NAME:"Jsonix.Schema.XSD.NonNegativeInteger"});1837Jsonix.Schema.XSD.NonNegativeInteger.INSTANCE=new Jsonix.Schema.XSD.NonNegativeInteger();1838Jsonix.Schema.XSD.NonNegativeInteger.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.NonNegativeInteger.INSTANCE);1839Jsonix.Schema.XSD.UnsignedLong=Jsonix.Class(Jsonix.Schema.XSD.NonNegativeInteger,{name:"UnsignedLong",typeName:Jsonix.Schema.XSD.qname("unsignedLong"),MIN_VALUE:0,MAX_VALUE:18446744073709552000,CLASS_NAME:"Jsonix.Schema.XSD.UnsignedLong"});1840Jsonix.Schema.XSD.UnsignedLong.INSTANCE=new Jsonix.Schema.XSD.UnsignedLong();1841Jsonix.Schema.XSD.UnsignedLong.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.UnsignedLong.INSTANCE);1842Jsonix.Schema.XSD.UnsignedInt=Jsonix.Class(Jsonix.Schema.XSD.UnsignedLong,{name:"UnsignedInt",typeName:Jsonix.Schema.XSD.qname("unsignedInt"),MIN_VALUE:0,MAX_VALUE:4294967295,CLASS_NAME:"Jsonix.Schema.XSD.UnsignedInt"});1843Jsonix.Schema.XSD.UnsignedInt.INSTANCE=new Jsonix.Schema.XSD.UnsignedInt();1844Jsonix.Schema.XSD.UnsignedInt.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.UnsignedInt.INSTANCE);1845Jsonix.Schema.XSD.UnsignedShort=Jsonix.Class(Jsonix.Schema.XSD.UnsignedInt,{name:"UnsignedShort",typeName:Jsonix.Schema.XSD.qname("unsignedShort"),MIN_VALUE:0,MAX_VALUE:65535,CLASS_NAME:"Jsonix.Schema.XSD.UnsignedShort"});1846Jsonix.Schema.XSD.UnsignedShort.INSTANCE=new Jsonix.Schema.XSD.UnsignedShort();1847Jsonix.Schema.XSD.UnsignedShort.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.UnsignedShort.INSTANCE);1848Jsonix.Schema.XSD.UnsignedByte=Jsonix.Class(Jsonix.Schema.XSD.UnsignedShort,{name:"UnsignedByte",typeName:Jsonix.Schema.XSD.qname("unsignedByte"),MIN_VALUE:0,MAX_VALUE:255,CLASS_NAME:"Jsonix.Schema.XSD.UnsignedByte"});1849Jsonix.Schema.XSD.UnsignedByte.INSTANCE=new Jsonix.Schema.XSD.UnsignedByte();1850Jsonix.Schema.XSD.UnsignedByte.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.UnsignedByte.INSTANCE);1851Jsonix.Schema.XSD.PositiveInteger=Jsonix.Class(Jsonix.Schema.XSD.NonNegativeInteger,{name:"PositiveInteger",typeName:Jsonix.Schema.XSD.qname("positiveInteger"),MIN_VALUE:1,MAX_VALUE:9223372036854776000,CLASS_NAME:"Jsonix.Schema.XSD.PositiveInteger"});1852Jsonix.Schema.XSD.PositiveInteger.INSTANCE=new Jsonix.Schema.XSD.PositiveInteger();1853Jsonix.Schema.XSD.PositiveInteger.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.PositiveInteger.INSTANCE);1854Jsonix.Schema.XSD.Double=Jsonix.Class(Jsonix.Schema.XSD.Number,{name:"Double",typeName:Jsonix.Schema.XSD.qname("double"),isInstance:function(f,e,d){return Jsonix.Util.Type.isNaN(f)||f===-Infinity||f===Infinity||(Jsonix.Util.Type.isNumber(f)&&f>=this.MIN_VALUE&&f<=this.MAX_VALUE)1855},MIN_VALUE:-1.7976931348623157e+308,MAX_VALUE:1.7976931348623157e+308,CLASS_NAME:"Jsonix.Schema.XSD.Double"});1856Jsonix.Schema.XSD.Double.INSTANCE=new Jsonix.Schema.XSD.Double();1857Jsonix.Schema.XSD.Double.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Double.INSTANCE);1858Jsonix.Schema.XSD.AnyURI=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"AnyURI",typeName:Jsonix.Schema.XSD.qname("anyURI"),print:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1859return g1860},parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1861return g1862},isInstance:function(f,e,d){return Jsonix.Util.Type.isString(f)1863},CLASS_NAME:"Jsonix.Schema.XSD.AnyURI"});1864Jsonix.Schema.XSD.AnyURI.INSTANCE=new Jsonix.Schema.XSD.AnyURI();1865Jsonix.Schema.XSD.AnyURI.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.AnyURI.INSTANCE);1866Jsonix.Schema.XSD.QName=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"QName",typeName:Jsonix.Schema.XSD.qname("QName"),print:function(j,n,h,m){var k=Jsonix.XML.QName.fromObject(j);1867var l;1868var i=k.localPart;1869if(h){l=h.getPrefix(k.namespaceURI,k.prefix||null);1870h.declareNamespace(k.namespaceURI,l)1871}else{l=k.prefix1872}return !l?i:(l+":"+i)1873},parse:function(k,r,l,j){Jsonix.Util.Ensure.ensureString(k);1874k=Jsonix.Util.StringUtils.trim(k);1875var m;1876var n;1877var p=k.indexOf(":");1878if(p===-1){m="";1879n=k1880}else{if(p>0&&p<(k.length-1)){m=k.substring(0,p);1881n=k.substring(p+1)1882}else{throw new Error("Invalid QName ["+k+"].")1883}}var o=l||r||null;1884if(!o){return k1885}else{var q=o.getNamespaceURI(m);1886if(Jsonix.Util.Type.isString(q)){return new Jsonix.XML.QName(q,n,m)1887}else{throw new Error("Prefix ["+m+"] of the QName ["+k+"] is not bound in this context.")1888}}},isInstance:function(f,e,d){return(f instanceof Jsonix.XML.QName)||(Jsonix.Util.Type.isObject(f)&&Jsonix.Util.Type.isString(f.localPart||f.lp))1889},CLASS_NAME:"Jsonix.Schema.XSD.QName"});1890Jsonix.Schema.XSD.QName.INSTANCE=new Jsonix.Schema.XSD.QName();1891Jsonix.Schema.XSD.QName.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.QName.INSTANCE);1892Jsonix.Schema.XSD.Calendar=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Calendar",typeName:Jsonix.Schema.XSD.qname("calendar"),parse:function(g,e,f,h){Jsonix.Util.Ensure.ensureString(g);1893if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.DATETIME_PATTERN+"$"))){return this.parseDateTime(g,e,f,h)1894}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.DATE_PATTERN+"$"))){return this.parseDate(g,e,f,h)1895}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.TIME_PATTERN+"$"))){return this.parseTime(g,e,f,h)1896}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.GYEAR_MONTH_PATTERN+"$"))){return this.parseGYearMonth(g,e,f,h)1897}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.GYEAR_PATTERN+"$"))){return this.parseGYear(g,e,f,h)1898}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.GMONTH_DAY_PATTERN+"$"))){return this.parseGMonthDay(g,e,f,h)1899}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.GMONTH_PATTERN+"$"))){return this.parseGMonth(g,e,f,h)1900}else{if(g.match(new RegExp("^"+Jsonix.Schema.XSD.Calendar.GDAY_PATTERN+"$"))){return this.parseGDay(g,e,f,h)1901}else{throw new Error("Value ["+g+"] does not match xs:dateTime, xs:date, xs:time, xs:gYearMonth, xs:gYear, xs:gMonthDay, xs:gMonth or xs:gDay patterns.")1902}}}}}}}}},parseGYearMonth:function(j,n,i,m){var l=new RegExp("^"+Jsonix.Schema.XSD.Calendar.GYEAR_MONTH_PATTERN+"$");1903var h=j.match(l);1904if(h!==null){var k={year:parseInt(h[1],10),month:parseInt(h[5],10),timezone:this.parseTimezoneString(h[7])};1905return new Jsonix.XML.Calendar(k)1906}throw new Error("Value ["+j+"] does not match the xs:gYearMonth pattern.")1907},parseGYear:function(j,n,i,m){var l=new RegExp("^"+Jsonix.Schema.XSD.Calendar.GYEAR_PATTERN+"$");1908var h=j.match(l);1909if(h!==null){var k={year:parseInt(h[1],10),timezone:this.parseTimezoneString(h[5])};1910return new Jsonix.XML.Calendar(k)1911}throw new Error("Value ["+j+"] does not match the xs:gYear pattern.")1912},parseGMonthDay:function(j,n,i,m){var k=new RegExp("^"+Jsonix.Schema.XSD.Calendar.GMONTH_DAY_PATTERN+"$");1913var h=j.match(k);1914if(h!==null){var l={month:parseInt(h[2],10),day:parseInt(h[3],10),timezone:this.parseTimezoneString(h[5])};1915return new Jsonix.XML.Calendar(l)1916}throw new Error("Value ["+j+"] does not match the xs:gMonthDay pattern.")1917},parseGMonth:function(k,n,i,m){var j=new RegExp("^"+Jsonix.Schema.XSD.Calendar.GMONTH_PATTERN+"$");1918var h=k.match(j);1919if(h!==null){var l={month:parseInt(h[2],10),timezone:this.parseTimezoneString(h[3])};1920return new Jsonix.XML.Calendar(l)1921}throw new Error("Value ["+k+"] does not match the xs:gMonth pattern.")1922},parseGDay:function(j,n,i,m){var l=new RegExp("^"+Jsonix.Schema.XSD.Calendar.GDAY_PATTERN+"$");1923var h=j.match(l);1924if(h!==null){var k={day:parseInt(h[2],10),timezone:this.parseTimezoneString(h[3])};1925return new Jsonix.XML.Calendar(k)1926}throw new Error("Value ["+j+"] does not match the xs:gDay pattern.")1927},parseDateTime:function(j,n,i,m){Jsonix.Util.Ensure.ensureString(j);1928var k=new RegExp("^"+Jsonix.Schema.XSD.Calendar.DATETIME_PATTERN+"$");1929var h=j.match(k);1930if(h!==null){var l={year:parseInt(h[1],10),month:parseInt(h[5],10),day:parseInt(h[7],10),hour:parseInt(h[9],10),minute:parseInt(h[10],10),second:parseInt(h[11],10),fractionalSecond:(h[12]?parseFloat(h[12]):0),timezone:this.parseTimezoneString(h[14])};1931return new Jsonix.XML.Calendar(l)1932}throw new Error("Value ["+value+"] does not match the xs:date pattern.")1933},parseDate:function(j,n,i,m){Jsonix.Util.Ensure.ensureString(j);1934var k=new RegExp("^"+Jsonix.Schema.XSD.Calendar.DATE_PATTERN+"$");1935var h=j.match(k);1936if(h!==null){var l={year:parseInt(h[1],10),month:parseInt(h[5],10),day:parseInt(h[7],10),timezone:this.parseTimezoneString(h[9])};1937return new Jsonix.XML.Calendar(l)1938}throw new Error("Value ["+value+"] does not match the xs:date pattern.")1939},parseTime:function(j,n,i,m){Jsonix.Util.Ensure.ensureString(j);1940var k=new RegExp("^"+Jsonix.Schema.XSD.Calendar.TIME_PATTERN+"$");1941var h=j.match(k);1942if(h!==null){var l={hour:parseInt(h[1],10),minute:parseInt(h[2],10),second:parseInt(h[3],10),fractionalSecond:(h[4]?parseFloat(h[4]):0),timezone:this.parseTimezoneString(h[6])};1943return new Jsonix.XML.Calendar(l)1944}throw new Error("Value ["+value+"] does not match the xs:time pattern.")1945},parseTimezoneString:function(i){if(!Jsonix.Util.Type.isString(i)){return NaN1946}else{if(i===""){return NaN1947}else{if(i==="Z"){return 01948}else{if(i==="+14:00"){return 14*601949}else{if(i==="-14:00"){return -14*601950}else{var j=new RegExp("^"+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+"$");1951var l=i.match(j);1952if(l!==null){var g=l[1]==="+"?1:-1;1953var h=parseInt(l[4],10);1954var k=parseInt(l[5],10);1955return g*(h*60+k)1956}throw new Error("Value ["+value+"] does not match the timezone pattern.")1957}}}}}},print:function(g,e,f,h){Jsonix.Util.Ensure.ensureObject(g);1958if(Jsonix.Util.NumberUtils.isInteger(g.year)&&Jsonix.Util.NumberUtils.isInteger(g.month)&&Jsonix.Util.NumberUtils.isInteger(g.day)&&Jsonix.Util.NumberUtils.isInteger(g.hour)&&Jsonix.Util.NumberUtils.isInteger(g.minute)&&Jsonix.Util.NumberUtils.isInteger(g.second)){return this.printDateTime(g)1959}else{if(Jsonix.Util.NumberUtils.isInteger(g.year)&&Jsonix.Util.NumberUtils.isInteger(g.month)&&Jsonix.Util.NumberUtils.isInteger(g.day)){return this.printDate(g)1960}else{if(Jsonix.Util.NumberUtils.isInteger(g.hour)&&Jsonix.Util.NumberUtils.isInteger(g.minute)&&Jsonix.Util.NumberUtils.isInteger(g.second)){return this.printTime(g)1961}else{if(Jsonix.Util.NumberUtils.isInteger(g.year)&&Jsonix.Util.NumberUtils.isInteger(g.month)){return this.printGYearMonth(g)1962}else{if(Jsonix.Util.NumberUtils.isInteger(g.month)&&Jsonix.Util.NumberUtils.isInteger(g.day)){return this.printGMonthDay(g)1963}else{if(Jsonix.Util.NumberUtils.isInteger(g.year)){return this.printGYear(g)1964}else{if(Jsonix.Util.NumberUtils.isInteger(g.month)){return this.printGMonth(g)1965}else{if(Jsonix.Util.NumberUtils.isInteger(g.day)){return this.printGDay(g)1966}else{throw new Error("Value ["+g+"] is not recognized as dateTime, date or time.")1967}}}}}}}}},printDateTime:function(c){Jsonix.Util.Ensure.ensureObject(c);1968Jsonix.Util.Ensure.ensureInteger(c.year);1969Jsonix.Util.Ensure.ensureInteger(c.month);1970Jsonix.Util.Ensure.ensureInteger(c.day);1971Jsonix.Util.Ensure.ensureInteger(c.hour);1972Jsonix.Util.Ensure.ensureInteger(c.minute);1973Jsonix.Util.Ensure.ensureNumber(c.second);1974if(Jsonix.Util.Type.exists(c.fractionalString)){Jsonix.Util.Ensure.ensureNumber(c.fractionalString)1975}if(Jsonix.Util.Type.exists(c.timezone)&&!Jsonix.Util.Type.isNaN(c.timezone)){Jsonix.Util.Ensure.ensureInteger(c.timezone)1976}var d=this.printDateString(c);1977d=d+"T";1978d=d+this.printTimeString(c);1979if(Jsonix.Util.Type.exists(c.timezone)){d=d+this.printTimezoneString(c.timezone)1980}return d1981},printDate:function(c){Jsonix.Util.Ensure.ensureObject(c);1982Jsonix.Util.Ensure.ensureNumber(c.year);1983Jsonix.Util.Ensure.ensureNumber(c.month);1984Jsonix.Util.Ensure.ensureNumber(c.day);1985if(Jsonix.Util.Type.exists(c.timezone)&&!Jsonix.Util.Type.isNaN(c.timezone)){Jsonix.Util.Ensure.ensureInteger(c.timezone)1986}var d=this.printDateString(c);1987if(Jsonix.Util.Type.exists(c.timezone)){d=d+this.printTimezoneString(c.timezone)1988}return d1989},printTime:function(c){Jsonix.Util.Ensure.ensureObject(c);1990Jsonix.Util.Ensure.ensureNumber(c.hour);1991Jsonix.Util.Ensure.ensureNumber(c.minute);1992Jsonix.Util.Ensure.ensureNumber(c.second);1993if(Jsonix.Util.Type.exists(c.fractionalString)){Jsonix.Util.Ensure.ensureNumber(c.fractionalString)1994}if(Jsonix.Util.Type.exists(c.timezone)&&!Jsonix.Util.Type.isNaN(c.timezone)){Jsonix.Util.Ensure.ensureInteger(c.timezone)1995}var d=this.printTimeString(c);1996if(Jsonix.Util.Type.exists(c.timezone)){d=d+this.printTimezoneString(c.timezone)1997}return d1998},printDateString:function(b){Jsonix.Util.Ensure.ensureObject(b);1999Jsonix.Util.Ensure.ensureInteger(b.year);2000Jsonix.Util.Ensure.ensureInteger(b.month);2001Jsonix.Util.Ensure.ensureInteger(b.day);2002return(b.year<0?("-"+this.printYear(-b.year)):this.printYear(b.year))+"-"+this.printMonth(b.month)+"-"+this.printDay(b.day)2003},printTimeString:function(c){Jsonix.Util.Ensure.ensureObject(c);2004Jsonix.Util.Ensure.ensureInteger(c.hour);2005Jsonix.Util.Ensure.ensureInteger(c.minute);2006Jsonix.Util.Ensure.ensureInteger(c.second);2007if(Jsonix.Util.Type.exists(c.fractionalSecond)){Jsonix.Util.Ensure.ensureNumber(c.fractionalSecond)2008}var d=this.printHour(c.hour);2009d=d+":";2010d=d+this.printMinute(c.minute);2011d=d+":";2012d=d+this.printSecond(c.second);2013if(Jsonix.Util.Type.exists(c.fractionalSecond)){d=d+this.printFractionalSecond(c.fractionalSecond)2014}return d2015},printTimezoneString:function(j){if(!Jsonix.Util.Type.exists(j)||Jsonix.Util.Type.isNaN(j)){return""2016}else{Jsonix.Util.Ensure.ensureInteger(j);2017var l=j<0?-1:(j>0?1:0);2018var k=j*l;2019var i=k%60;2020var g=Math.floor(k/60);2021var h;2022if(l===0){return"Z"2023}else{if(l>0){h="+"2024}else{if(l<0){h="-"2025}}h=h+this.printHour(g);2026h=h+":";2027h=h+this.printMinute(i);2028return h2029}}},printGDay:function(i,l,g,k){Jsonix.Util.Ensure.ensureObject(i);2030var h=undefined;2031var j=undefined;2032if(i instanceof Date){h=i.getDate()2033}else{Jsonix.Util.Ensure.ensureInteger(i.day);2034h=i.day;2035j=i.timezone2036}Jsonix.XML.Calendar.validateDay(h);2037Jsonix.XML.Calendar.validateTimezone(j);2038return"---"+this.printDay(h)+this.printTimezoneString(j)2039},printGMonth:function(j,g,h,l){Jsonix.Util.Ensure.ensureObject(j);2040var i=undefined;2041var k=undefined;2042if(j instanceof Date){i=j.getMonth()+12043}else{Jsonix.Util.Ensure.ensureInteger(j.month);2044i=j.month;2045k=j.timezone2046}Jsonix.XML.Calendar.validateMonth(i);2047Jsonix.XML.Calendar.validateTimezone(k);2048return"--"+this.printMonth(i)+this.printTimezoneString(k)2049},printGMonthDay:function(k,n,h,m){Jsonix.Util.Ensure.ensureObject(k);2050var j=undefined;2051var i=undefined;2052var l=undefined;2053if(k instanceof Date){j=k.getMonth()+1;2054i=k.getDate()2055}else{Jsonix.Util.Ensure.ensureInteger(k.month);2056Jsonix.Util.Ensure.ensureInteger(k.day);2057j=k.month;2058i=k.day;2059l=k.timezone2060}Jsonix.XML.Calendar.validateMonthDay(j,i);2061Jsonix.XML.Calendar.validateTimezone(l);2062return"--"+this.printMonth(j)+"-"+this.printDay(i)+this.printTimezoneString(l)2063},printGYear:function(i,g,h,k){Jsonix.Util.Ensure.ensureObject(i);2064var l=undefined;2065var j=undefined;2066if(i instanceof Date){l=i.getFullYear()2067}else{Jsonix.Util.Ensure.ensureInteger(i.year);2068l=i.year;2069j=i.timezone2070}Jsonix.XML.Calendar.validateYear(l);2071Jsonix.XML.Calendar.validateTimezone(j);2072return this.printSignedYear(l)+this.printTimezoneString(j)2073},printGYearMonth:function(k,h,i,m){Jsonix.Util.Ensure.ensureObject(k);2074var n=undefined;2075var j=undefined;2076var l=undefined;2077if(k instanceof Date){n=k.getFullYear();2078j=k.getMonth()+12079}else{Jsonix.Util.Ensure.ensureInteger(k.year);2080n=k.year;2081j=k.month;2082l=k.timezone2083}Jsonix.XML.Calendar.validateYear(n);2084Jsonix.XML.Calendar.validateMonth(j);2085Jsonix.XML.Calendar.validateTimezone(l);2086return this.printSignedYear(n)+"-"+this.printMonth(j)+this.printTimezoneString(l)2087},printSignedYear:function(b){return b<0?("-"+this.printYear(b*-1)):(this.printYear(b))2088},printYear:function(b){return this.printInteger(b,4)2089},printMonth:function(b){return this.printInteger(b,2)2090},printDay:function(b){return this.printInteger(b,2)2091},printHour:function(b){return this.printInteger(b,2)2092},printMinute:function(b){return this.printInteger(b,2)2093},printSecond:function(b){return this.printInteger(b,2)2094},printFractionalSecond:function(f){Jsonix.Util.Ensure.ensureNumber(f);2095if(f<0||f>=1){throw new Error("Fractional second ["+f+"] must be between 0 and 1.")2096}else{if(f===0){return""2097}else{var e=String(f);2098var d=e.indexOf(".");2099if(d<0){return""2100}else{return e.substring(d)2101}}}},printInteger:function(g,h){Jsonix.Util.Ensure.ensureInteger(g);2102Jsonix.Util.Ensure.ensureInteger(h);2103if(h<=0){throw new Error("Length ["+g+"] must be positive.")2104}if(g<0){throw new Error("Value ["+g+"] must not be negative.")2105}var f=String(g);2106for(var e=f.length;2107e<h;2108e++){f="0"+f2109}return f2110},isInstance:function(f,e,d){return Jsonix.Util.Type.isObject(f)&&((Jsonix.Util.NumberUtils.isInteger(f.year)&&Jsonix.Util.NumberUtils.isInteger(f.month)&&Jsonix.Util.NumberUtils.isInteger(f.day))||(Jsonix.Util.NumberUtils.isInteger(f.hour)&&Jsonix.Util.NumberUtils.isInteger(f.minute)&&Jsonix.Util.NumberUtils.isInteger(f.second)))2111},CLASS_NAME:"Jsonix.Schema.XSD.Calendar"});2112Jsonix.Schema.XSD.Calendar.YEAR_PATTERN="-?([1-9][0-9]*)?((?!(0000))[0-9]{4})";2113Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN="Z|([\\-\\+])(((0[0-9]|1[0-3]):([0-5][0-9]))|(14:00))";2114Jsonix.Schema.XSD.Calendar.MONTH_PATTERN="(0[1-9]|1[0-2])";2115Jsonix.Schema.XSD.Calendar.SINGLE_MONTH_PATTERN="\\-\\-"+Jsonix.Schema.XSD.Calendar.MONTH_PATTERN;2116Jsonix.Schema.XSD.Calendar.DAY_PATTERN="(0[1-9]|[12][0-9]|3[01])";2117Jsonix.Schema.XSD.Calendar.SINGLE_DAY_PATTERN="\\-\\-\\-"+Jsonix.Schema.XSD.Calendar.DAY_PATTERN;2118Jsonix.Schema.XSD.Calendar.GYEAR_PATTERN="("+Jsonix.Schema.XSD.Calendar.YEAR_PATTERN+")("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2119Jsonix.Schema.XSD.Calendar.GMONTH_PATTERN="("+Jsonix.Schema.XSD.Calendar.SINGLE_MONTH_PATTERN+")("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2120Jsonix.Schema.XSD.Calendar.GDAY_PATTERN="("+Jsonix.Schema.XSD.Calendar.SINGLE_DAY_PATTERN+")("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2121Jsonix.Schema.XSD.Calendar.GYEAR_MONTH_PATTERN="("+Jsonix.Schema.XSD.Calendar.YEAR_PATTERN+")-("+Jsonix.Schema.XSD.Calendar.DAY_PATTERN+")("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2122Jsonix.Schema.XSD.Calendar.GMONTH_DAY_PATTERN="("+Jsonix.Schema.XSD.Calendar.SINGLE_MONTH_PATTERN+")-("+Jsonix.Schema.XSD.Calendar.DAY_PATTERN+")("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2123Jsonix.Schema.XSD.Calendar.DATE_PART_PATTERN="("+Jsonix.Schema.XSD.Calendar.YEAR_PATTERN+")-("+Jsonix.Schema.XSD.Calendar.MONTH_PATTERN+")-("+Jsonix.Schema.XSD.Calendar.DAY_PATTERN+")";2124Jsonix.Schema.XSD.Calendar.TIME_PART_PATTERN="([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\\.([0-9]+))?";2125Jsonix.Schema.XSD.Calendar.TIME_PATTERN=Jsonix.Schema.XSD.Calendar.TIME_PART_PATTERN+"("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2126Jsonix.Schema.XSD.Calendar.DATE_PATTERN=Jsonix.Schema.XSD.Calendar.DATE_PART_PATTERN+"("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2127Jsonix.Schema.XSD.Calendar.DATETIME_PATTERN=Jsonix.Schema.XSD.Calendar.DATE_PART_PATTERN+"T"+Jsonix.Schema.XSD.Calendar.TIME_PART_PATTERN+"("+Jsonix.Schema.XSD.Calendar.TIMEZONE_PATTERN+")?";2128Jsonix.Schema.XSD.Calendar.INSTANCE=new Jsonix.Schema.XSD.Calendar();2129Jsonix.Schema.XSD.Calendar.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Calendar.INSTANCE);2130Jsonix.Schema.XSD.Duration=Jsonix.Class(Jsonix.Schema.XSD.AnySimpleType,{name:"Duration",typeName:Jsonix.Schema.XSD.qname("duration"),isInstance:function(f,e,d){return Jsonix.Util.Type.isObject(f)&&((Jsonix.Util.Type.exists(f.sign)?(f.sign===-1||f.sign===1):true)(Jsonix.Util.NumberUtils.isInteger(f.years)&&f.years>=0)||(Jsonix.Util.NumberUtils.isInteger(f.months)&&f.months>=0)||(Jsonix.Util.NumberUtils.isInteger(f.days)&&f.days>=0)||(Jsonix.Util.NumberUtils.isInteger(f.hours)&&f.hours>=0)||(Jsonix.Util.NumberUtils.isInteger(f.minutes)&&f.minutes>=0)||(Jsonix.Util.Type.isNumber(f.seconds)&&f.seconds>=0))2131},validate:function(h){Jsonix.Util.Ensure.ensureObject(h);2132if(Jsonix.Util.Type.exists(h.sign)){if(!(h.sign===1||h.sign===-1)){throw new Error("Sign of the duration ["+h.sign+"] must be either [1] or [-1].")2133}}var e=true;2134var g=function(b,a){if(Jsonix.Util.Type.exists(b)){if(!(Jsonix.Util.NumberUtils.isInteger(b)&&b>=0)){throw new Error(a.replace("{0}",b))2135}else{return true2136}}else{return false2137}};2138var f=function(b,a){if(Jsonix.Util.Type.exists(b)){if(!(Jsonix.Util.Type.isNumber(b)&&b>=0)){throw new Error(a.replace("{0}",b))2139}else{return true2140}}else{return false2141}};2142e=e&&!g(h.years,"Number of years [{0}] must be an unsigned integer.");2143e=e&&!g(h.months,"Number of months [{0}] must be an unsigned integer.");2144e=e&&!g(h.days,"Number of days [{0}] must be an unsigned integer.");2145e=e&&!g(h.hours,"Number of hours [{0}] must be an unsigned integer.");2146e=e&&!g(h.minutes,"Number of minutes [{0}] must be an unsigned integer.");2147e=e&&!f(h.seconds,"Number of seconds [{0}] must be an unsigned number.");2148if(e){throw new Error("At least one of the components (years, months, days, hours, minutes, seconds) must be set.")2149}},print:function(h,j,f,i){this.validate(h);2150var g="";2151if(h.sign===-1){g+="-"2152}g+="P";2153if(Jsonix.Util.Type.exists(h.years)){g+=(h.years+"Y")2154}if(Jsonix.Util.Type.exists(h.months)){g+=(h.months+"M")2155}if(Jsonix.Util.Type.exists(h.days)){g+=(h.days+"D")2156}if(Jsonix.Util.Type.exists(h.hours)||Jsonix.Util.Type.exists(h.minutes)||Jsonix.Util.Type.exists(h.seconds)){g+="T";2157if(Jsonix.Util.Type.exists(h.hours)){g+=(h.hours+"H")2158}if(Jsonix.Util.Type.exists(h.minutes)){g+=(h.minutes+"M")2159}if(Jsonix.Util.Type.exists(h.seconds)){g+=(h.seconds+"S")2160}}return g2161},parse:function(m,p,j,o){var k=new RegExp("^"+Jsonix.Schema.XSD.Duration.PATTERN+"$");2162var i=m.match(k);2163if(i!==null){var n=true;2164var l={};2165if(i[1]){l.sign=-12166}if(i[3]){l.years=parseInt(i[3],10);2167n=false2168}if(i[5]){l.months=parseInt(i[5],10);2169n=false2170}if(i[7]){l.days=parseInt(i[7],10);2171n=false2172}if(i[10]){l.hours=parseInt(i[10],10);2173n=false2174}if(i[12]){l.minutes=parseInt(i[12],10);2175n=false2176}if(i[14]){l.seconds=Number(i[14]);2177n=false2178}return l2179}else{throw new Error("Value ["+m+"] does not match the duration pattern.")2180}},CLASS_NAME:"Jsonix.Schema.XSD.Duration"});2181Jsonix.Schema.XSD.Duration.PATTERN="(-)?P(([0-9]+)Y)?(([0-9]+)M)?(([0-9]+)D)?(T(([0-9]+)H)?(([0-9]+)M)?(([0-9]+(\\.[0-9]+)?)S)?)?";2182Jsonix.Schema.XSD.Duration.INSTANCE=new Jsonix.Schema.XSD.Duration();2183Jsonix.Schema.XSD.Duration.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Duration.INSTANCE);2184Jsonix.Schema.XSD.DateTime=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"DateTime",typeName:Jsonix.Schema.XSD.qname("dateTime"),parse:function(g,e,f,h){return this.parseDateTime(g)2185},print:function(g,e,f,h){return this.printDateTime(g)2186},CLASS_NAME:"Jsonix.Schema.XSD.DateTime"});2187Jsonix.Schema.XSD.DateTime.INSTANCE=new Jsonix.Schema.XSD.DateTime();2188Jsonix.Schema.XSD.DateTime.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTime.INSTANCE);2189Jsonix.Schema.XSD.DateTimeAsDate=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"DateTimeAsDate",typeName:Jsonix.Schema.XSD.qname("dateTime"),parse:function(n,t,o,l){var q=this.parseDateTime(n);2190var s=new Date();2191s.setFullYear(q.year);2192s.setMonth(q.month-1);2193s.setDate(q.day);2194s.setHours(q.hour);2195s.setMinutes(q.minute);2196s.setSeconds(q.second);2197if(Jsonix.Util.Type.isNumber(q.fractionalSecond)){s.setMilliseconds(Math.floor(1000*q.fractionalSecond))2198}var p;2199var r;2200var m=-s.getTimezoneOffset();2201if(Jsonix.Util.NumberUtils.isInteger(q.timezone)){p=q.timezone;2202r=false2203}else{p=m;2204r=true2205}var k=new Date(s.getTime()+(60000*(-p+m)));2206if(r){k.originalTimezone=null2207}else{k.originalTimezone=q.timezone2208}return k2209},print:function(k,o,i,n){Jsonix.Util.Ensure.ensureDate(k);2210var m;2211var l=-k.getTimezoneOffset();2212var p;2213if(k.originalTimezone===null){return this.printDateTime(new Jsonix.XML.Calendar({year:k.getFullYear(),month:k.getMonth()+1,day:k.getDate(),hour:k.getHours(),minute:k.getMinutes(),second:k.getSeconds(),fractionalSecond:(k.getMilliseconds()/1000)}))2214}else{if(Jsonix.Util.NumberUtils.isInteger(k.originalTimezone)){m=k.originalTimezone;2215p=new Date(k.getTime()-(60000*(-m+l)))2216}else{m=l;2217p=k2218}var j=this.printDateTime(new Jsonix.XML.Calendar({year:p.getFullYear(),month:p.getMonth()+1,day:p.getDate(),hour:p.getHours(),minute:p.getMinutes(),second:p.getSeconds(),fractionalSecond:(p.getMilliseconds()/1000),timezone:m}));2219return j2220}},isInstance:function(f,e,d){return Jsonix.Util.Type.isDate(f)2221},CLASS_NAME:"Jsonix.Schema.XSD.DateTimeAsDate"});2222Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE=new Jsonix.Schema.XSD.DateTimeAsDate();2223Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE);2224Jsonix.Schema.XSD.Time=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"Time",typeName:Jsonix.Schema.XSD.qname("time"),parse:function(g,e,f,h){return this.parseTime(g)2225},print:function(g,e,f,h){return this.printTime(g)2226},CLASS_NAME:"Jsonix.Schema.XSD.Time"});2227Jsonix.Schema.XSD.Time.INSTANCE=new Jsonix.Schema.XSD.Time();2228Jsonix.Schema.XSD.Time.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Time.INSTANCE);2229Jsonix.Schema.XSD.TimeAsDate=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"TimeAsDate",typeName:Jsonix.Schema.XSD.qname("time"),parse:function(n,t,o,l){var q=this.parseTime(n);2230var s=new Date();2231s.setFullYear(1970);2232s.setMonth(0);2233s.setDate(1);2234s.setHours(q.hour);2235s.setMinutes(q.minute);2236s.setSeconds(q.second);2237if(Jsonix.Util.Type.isNumber(q.fractionalSecond)){s.setMilliseconds(Math.floor(1000*q.fractionalSecond))2238}var p;2239var r;2240var m=-s.getTimezoneOffset();2241if(Jsonix.Util.NumberUtils.isInteger(q.timezone)){p=q.timezone;2242r=false2243}else{p=m;2244r=true2245}var k=new Date(s.getTime()+(60000*(-p+m)));2246if(r){k.originalTimezone=null2247}else{k.originalTimezone=p2248}return k2249},print:function(n,u,s,l){Jsonix.Util.Ensure.ensureDate(n);2250var r=n.getTime();2251if(r<=-86400000&&r>=86400000){throw new Error("Invalid time ["+n+"].")2252}if(n.originalTimezone===null){return this.printTime(new Jsonix.XML.Calendar({hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds(),fractionalSecond:(n.getMilliseconds()/1000)}))2253}else{var t;2254var p;2255var m=-n.getTimezoneOffset();2256if(Jsonix.Util.NumberUtils.isInteger(n.originalTimezone)){p=n.originalTimezone;2257t=new Date(n.getTime()-(60000*(-p+m)))2258}else{p=m;2259t=n2260}var o=t.getTime();2261if(o>=(-m*60000)){return this.printTime(new Jsonix.XML.Calendar({hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),fractionalSecond:(t.getMilliseconds()/1000),timezone:p}))2262}else{var q=Math.ceil(-o/3600000);2263var v=t.getSeconds()+t.getMinutes()*60+t.getHours()*3600+q*3600-p*60;2264return this.printTime(new Jsonix.XML.Calendar({hour:v%86400,minute:v%3600,second:v%60,fractionalSecond:(t.getMilliseconds()/1000),timezone:q*60}))2265}}},isInstance:function(f,e,d){return Jsonix.Util.Type.isDate(f)&&f.getTime()>-86400000&&f.getTime()<864000002266},CLASS_NAME:"Jsonix.Schema.XSD.TimeAsDate"});2267Jsonix.Schema.XSD.TimeAsDate.INSTANCE=new Jsonix.Schema.XSD.TimeAsDate();2268Jsonix.Schema.XSD.TimeAsDate.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.TimeAsDate.INSTANCE);2269Jsonix.Schema.XSD.Date=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"Date",typeName:Jsonix.Schema.XSD.qname("date"),parse:function(g,e,f,h){return this.parseDate(g)2270},print:function(g,e,f,h){return this.printDate(g)2271},CLASS_NAME:"Jsonix.Schema.XSD.Date"});2272Jsonix.Schema.XSD.Date.INSTANCE=new Jsonix.Schema.XSD.Date();2273Jsonix.Schema.XSD.Date.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Date.INSTANCE);2274Jsonix.Schema.XSD.DateAsDate=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"DateAsDate",typeName:Jsonix.Schema.XSD.qname("date"),parse:function(n,t,o,l){var q=this.parseDate(n);2275var s=new Date();2276s.setFullYear(q.year);2277s.setMonth(q.month-1);2278s.setDate(q.day);2279s.setHours(0);2280s.setMinutes(0);2281s.setSeconds(0);2282s.setMilliseconds(0);2283if(Jsonix.Util.Type.isNumber(q.fractionalSecond)){s.setMilliseconds(Math.floor(1000*q.fractionalSecond))2284}var p;2285var r;2286var m=-s.getTimezoneOffset();2287if(Jsonix.Util.NumberUtils.isInteger(q.timezone)){p=q.timezone;2288r=false2289}else{p=m;2290r=true2291}var k=new Date(s.getTime()+(60000*(-p+m)));2292if(r){k.originalTimezone=null2293}else{k.originalTimezone=p2294}return k2295},print:function(l,r,p,j){Jsonix.Util.Ensure.ensureDate(l);2296var o=new Date(l.getTime());2297o.setHours(0);2298o.setMinutes(0);2299o.setSeconds(0);2300o.setMilliseconds(0);2301if(l.originalTimezone===null){return this.printDate(new Jsonix.XML.Calendar({year:l.getFullYear(),month:l.getMonth()+1,day:l.getDate()}))2302}else{if(Jsonix.Util.NumberUtils.isInteger(l.originalTimezone)){var q=new Date(l.getTime()-(60000*(-l.originalTimezone-l.getTimezoneOffset())));2303return this.printDate(new Jsonix.XML.Calendar({year:q.getFullYear(),month:q.getMonth()+1,day:q.getDate(),timezone:l.originalTimezone}))2304}else{var k=-l.getTime()+o.getTime();2305if(k===0){return this.printDate(new Jsonix.XML.Calendar({year:l.getFullYear(),month:l.getMonth()+1,day:l.getDate()}))2306}else{var n=k-(60000*l.getTimezoneOffset());2307if(n>=-43200000){return this.printDate(new Jsonix.XML.Calendar({year:l.getFullYear(),month:l.getMonth()+1,day:l.getDate(),timezone:Math.floor(n/60000)}))2308}else{var m=new Date(l.getTime()+86400000);2309return this.printDate(new Jsonix.XML.Calendar({year:m.getFullYear(),month:m.getMonth()+1,day:m.getDate(),timezone:(Math.floor(n/60000)+1440)}))2310}}}}},isInstance:function(f,e,d){return Jsonix.Util.Type.isDate(f)2311},CLASS_NAME:"Jsonix.Schema.XSD.DateAsDate"});2312Jsonix.Schema.XSD.DateAsDate.INSTANCE=new Jsonix.Schema.XSD.DateAsDate();2313Jsonix.Schema.XSD.DateAsDate.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateAsDate.INSTANCE);2314Jsonix.Schema.XSD.GYearMonth=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"GYearMonth",typeName:Jsonix.Schema.XSD.qname("gYearMonth"),CLASS_NAME:"Jsonix.Schema.XSD.GYearMonth",parse:function(g,e,f,h){return this.parseGYearMonth(g,e,f,h)2315},print:function(g,e,f,h){return this.printGYearMonth(g,e,f,h)2316}});2317Jsonix.Schema.XSD.GYearMonth.INSTANCE=new Jsonix.Schema.XSD.GYearMonth();2318Jsonix.Schema.XSD.GYearMonth.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.GYearMonth.INSTANCE);2319Jsonix.Schema.XSD.GYear=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"GYear",typeName:Jsonix.Schema.XSD.qname("gYear"),CLASS_NAME:"Jsonix.Schema.XSD.GYear",parse:function(g,e,f,h){return this.parseGYear(g,e,f,h)2320},print:function(g,e,f,h){return this.printGYear(g,e,f,h)2321}});2322Jsonix.Schema.XSD.GYear.INSTANCE=new Jsonix.Schema.XSD.GYear();2323Jsonix.Schema.XSD.GYear.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.GYear.INSTANCE);2324Jsonix.Schema.XSD.GMonthDay=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"GMonthDay",typeName:Jsonix.Schema.XSD.qname("gMonthDay"),CLASS_NAME:"Jsonix.Schema.XSD.GMonthDay",parse:function(g,e,f,h){return this.parseGMonthDay(g,e,f,h)2325},print:function(g,e,f,h){return this.printGMonthDay(g,e,f,h)2326}});2327Jsonix.Schema.XSD.GMonthDay.INSTANCE=new Jsonix.Schema.XSD.GMonthDay();2328Jsonix.Schema.XSD.GMonthDay.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.GMonthDay.INSTANCE);2329Jsonix.Schema.XSD.GDay=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"GDay",typeName:Jsonix.Schema.XSD.qname("gDay"),CLASS_NAME:"Jsonix.Schema.XSD.GDay",parse:function(g,e,f,h){return this.parseGDay(g,e,f,h)2330},print:function(g,e,f,h){return this.printGDay(g,e,f,h)2331}});2332Jsonix.Schema.XSD.GDay.INSTANCE=new Jsonix.Schema.XSD.GDay();2333Jsonix.Schema.XSD.GDay.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.GDay.INSTANCE);2334Jsonix.Schema.XSD.GMonth=Jsonix.Class(Jsonix.Schema.XSD.Calendar,{name:"GMonth",typeName:Jsonix.Schema.XSD.qname("gMonth"),CLASS_NAME:"Jsonix.Schema.XSD.GMonth",parse:function(g,e,f,h){return this.parseGMonth(g,e,f,h)2335},print:function(g,e,f,h){return this.printGMonth(g,e,f,h)2336}});2337Jsonix.Schema.XSD.GMonth.INSTANCE=new Jsonix.Schema.XSD.GMonth();2338Jsonix.Schema.XSD.GMonth.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.GMonth.INSTANCE);2339Jsonix.Schema.XSD.ID=Jsonix.Class(Jsonix.Schema.XSD.String,{name:"ID",typeName:Jsonix.Schema.XSD.qname("ID"),CLASS_NAME:"Jsonix.Schema.XSD.ID"});2340Jsonix.Schema.XSD.ID.INSTANCE=new Jsonix.Schema.XSD.ID();2341Jsonix.Schema.XSD.ID.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.ID.INSTANCE);2342Jsonix.Schema.XSD.IDREF=Jsonix.Class(Jsonix.Schema.XSD.String,{name:"IDREF",typeName:Jsonix.Schema.XSD.qname("IDREF"),CLASS_NAME:"Jsonix.Schema.XSD.IDREF"});2343Jsonix.Schema.XSD.IDREF.INSTANCE=new Jsonix.Schema.XSD.IDREF();2344Jsonix.Schema.XSD.IDREF.INSTANCE.LIST=new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.IDREF.INSTANCE);2345Jsonix.Schema.XSD.IDREFS=Jsonix.Class(Jsonix.Schema.XSD.List,{name:"IDREFS",initialize:function(){Jsonix.Schema.XSD.List.prototype.initialize.apply(this,[Jsonix.Schema.XSD.IDREF.INSTANCE,Jsonix.Schema.XSD.qname("IDREFS")," "])2346},CLASS_NAME:"Jsonix.Schema.XSD.IDREFS"});2347Jsonix.Schema.XSD.IDREFS.INSTANCE=new Jsonix.Schema.XSD.IDREFS();2348Jsonix.Schema.XSI={};2349Jsonix.Schema.XSI.NAMESPACE_URI="http://www.w3.org/2001/XMLSchema-instance";2350Jsonix.Schema.XSI.PREFIX="xsi";2351Jsonix.Schema.XSI.TYPE="type";2352Jsonix.Schema.XSI.NIL="nil";2353Jsonix.Schema.XSI.qname=function(b){Jsonix.Util.Ensure.ensureString(b);2354return new Jsonix.XML.QName(Jsonix.Schema.XSI.NAMESPACE_URI,b,Jsonix.Schema.XSI.PREFIX)2355};2356Jsonix.Schema.XSI.TYPE_QNAME=Jsonix.Schema.XSI.qname(Jsonix.Schema.XSI.TYPE);2357Jsonix.Context=Jsonix.Class(Jsonix.Mapping.Styled,{modules:[],typeInfos:null,typeNameKeyToTypeInfo:null,elementInfos:null,options:null,substitutionMembersMap:null,scopedElementInfosMap:null,supportXsiType:true,initialize:function(i,l){Jsonix.Mapping.Styled.prototype.initialize.apply(this,[l]);2358this.modules=[];2359this.elementInfos=[];2360this.typeInfos={};2361this.typeNameKeyToTypeInfo={};2362this.registerBuiltinTypeInfos();2363this.namespacePrefixes={};2364this.prefixNamespaces={};2365this.substitutionMembersMap={};2366this.scopedElementInfosMap={};2367if(Jsonix.Util.Type.exists(l)){Jsonix.Util.Ensure.ensureObject(l);2368if(Jsonix.Util.Type.isObject(l.namespacePrefixes)){this.namespacePrefixes=Jsonix.Util.Type.cloneObject(l.namespacePrefixes,{})2369}if(Jsonix.Util.Type.isBoolean(l.supportXsiType)){this.supportXsiType=l.supportXsiType2370}}for(var j in this.namespacePrefixes){if(this.namespacePrefixes.hasOwnProperty(j)){p=this.namespacePrefixes[j];2371this.prefixNamespaces[p]=j2372}}if(Jsonix.Util.Type.exists(i)){Jsonix.Util.Ensure.ensureArray(i);2373var g,h,k;2374for(g=0;2375g<i.length;2376g++){h=i[g];2377k=this.createModule(h);2378this.modules[g]=k2379}}this.processModules()2380},createModule:function(d){var c;2381if(d instanceof this.mappingStyle.module){c=d2382}else{d=Jsonix.Util.Type.cloneObject(d);2383c=new this.mappingStyle.module(d,{mappingStyle:this.mappingStyle})2384}return c2385},registerBuiltinTypeInfos:function(){for(var b=0;2386b<this.builtinTypeInfos.length;2387b++){this.registerTypeInfo(this.builtinTypeInfos[b])2388}},processModules:function(){var d,c;2389for(d=0;2390d<this.modules.length;2391d++){c=this.modules[d];2392c.registerTypeInfos(this)2393}for(d=0;2394d<this.modules.length;2395d++){c=this.modules[d];2396c.registerElementInfos(this)2397}for(d=0;2398d<this.modules.length;2399d++){c=this.modules[d];2400c.buildTypeInfos(this)2401}for(d=0;2402d<this.modules.length;2403d++){c=this.modules[d];2404c.buildElementInfos(this)2405}},registerTypeInfo:function(d){Jsonix.Util.Ensure.ensureObject(d);2406var c=d.name||d.n||null;2407Jsonix.Util.Ensure.ensureString(c);2408this.typeInfos[c]=d;2409if(d.typeName&&d.typeName.key){this.typeNameKeyToTypeInfo[d.typeName.key]=d2410}},resolveTypeInfo:function(f,j){if(!Jsonix.Util.Type.exists(f)){return null2411}else{if(f instanceof Jsonix.Model.TypeInfo){return f2412}else{if(Jsonix.Util.Type.isString(f)){var g;2413if(f.length>0&&f.charAt(0)==="."){var h=j.name||j.n||undefined;2414Jsonix.Util.Ensure.ensureObject(j,"Type info mapping can only be resolved if module is provided.");2415Jsonix.Util.Ensure.ensureString(h,"Type info mapping can only be resolved if module name is provided.");2416g=h+f2417}else{g=f2418}if(!this.typeInfos[g]){throw new Error("Type info ["+g+"] is not known in this context.")2419}else{return this.typeInfos[g]2420}}else{Jsonix.Util.Ensure.ensureObject(j,"Type info mapping can only be resolved if module is provided.");2421var i=j.createTypeInfo(f);2422i.build(this,j);2423return i2424}}}},registerElementInfo:function(k,m){Jsonix.Util.Ensure.ensureObject(k);2425this.elementInfos.push(k);2426if(Jsonix.Util.Type.exists(k.substitutionHead)){var n=k.substitutionHead;2427var l=n.key;2428var h=this.substitutionMembersMap[l];2429if(!Jsonix.Util.Type.isArray(h)){h=[];2430this.substitutionMembersMap[l]=h2431}h.push(k)2432}var i;2433if(Jsonix.Util.Type.exists(k.scope)){i=this.resolveTypeInfo(k.scope,m).name2434}else{i="##global"2435}var j=this.scopedElementInfosMap[i];2436if(!Jsonix.Util.Type.isObject(j)){j={};2437this.scopedElementInfosMap[i]=j2438}j[k.elementName.key]=k2439},getTypeInfoByValue:function(f){if(!Jsonix.Util.Type.exists(f)){return undefined2440}if(Jsonix.Util.Type.isObject(f)){var d=f.TYPE_NAME;2441if(Jsonix.Util.Type.isString(d)){var e=this.getTypeInfoByName(d);2442if(e){return e2443}}}return undefined2444},getTypeInfoByName:function(b){return this.typeInfos[b]2445},getTypeInfoByTypeName:function(c){var d=Jsonix.XML.QName.fromObjectOrString(c,this);2446return this.typeNameKeyToTypeInfo[d.key]2447},getTypeInfoByTypeNameKey:function(b){return this.typeNameKeyToTypeInfo[b]2448},getElementInfo:function(o,m){if(Jsonix.Util.Type.exists(m)){var j=m.name;2449var k=this.scopedElementInfosMap[j];2450if(Jsonix.Util.Type.exists(k)){var n=k[o.key];2451if(Jsonix.Util.Type.exists(n)){return n2452}}}var l="##global";2453var q=this.scopedElementInfosMap[l];2454if(Jsonix.Util.Type.exists(q)){var i=q[o.key];2455if(Jsonix.Util.Type.exists(i)){return i2456}}return null2457},getSubstitutionMembers:function(b){return this.substitutionMembersMap[Jsonix.XML.QName.fromObject(b).key]2458},createMarshaller:function(){return new this.mappingStyle.marshaller(this)2459},createUnmarshaller:function(){return new this.mappingStyle.unmarshaller(this)2460},getNamespaceURI:function(b){Jsonix.Util.Ensure.ensureString(b);2461return this.prefixNamespaces[b]2462},getPrefix:function(e,d){Jsonix.Util.Ensure.ensureString(e);2463var f=this.namespacePrefixes[e];2464if(Jsonix.Util.Type.isString(f)){return f2465}else{return d2466}},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,Jsonix.Schema.XSD.Duration.INSTANCE,Jsonix.Schema.XSD.Float.INSTANCE,Jsonix.Schema.XSD.GDay.INSTANCE,Jsonix.Schema.XSD.GMonth.INSTANCE,Jsonix.Schema.XSD.GMonthDay.INSTANCE,Jsonix.Schema.XSD.GYear.INSTANCE,Jsonix.Schema.XSD.GYearMonth.INSTANCE,Jsonix.Schema.XSD.HexBinary.INSTANCE,Jsonix.Schema.XSD.ID.INSTANCE,Jsonix.Schema.XSD.IDREF.INSTANCE,Jsonix.Schema.XSD.IDREFS.INSTANCE,Jsonix.Schema.XSD.Int.INSTANCE,Jsonix.Schema.XSD.Integer.INSTANCE,Jsonix.Schema.XSD.Language.INSTANCE,Jsonix.Schema.XSD.Long.INSTANCE,Jsonix.Schema.XSD.Name.INSTANCE,Jsonix.Schema.XSD.NCName.INSTANCE,Jsonix.Schema.XSD.NegativeInteger.INSTANCE,Jsonix.Schema.XSD.NMToken.INSTANCE,Jsonix.Schema.XSD.NMTokens.INSTANCE,Jsonix.Schema.XSD.NonNegativeInteger.INSTANCE,Jsonix.Schema.XSD.NonPositiveInteger.INSTANCE,Jsonix.Schema.XSD.NormalizedString.INSTANCE,Jsonix.Schema.XSD.Number.INSTANCE,Jsonix.Schema.XSD.PositiveInteger.INSTANCE,Jsonix.Schema.XSD.QName.INSTANCE,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,Jsonix.Schema.XSD.UnsignedInt.INSTANCE,Jsonix.Schema.XSD.UnsignedLong.INSTANCE,Jsonix.Schema.XSD.UnsignedShort.INSTANCE],CLASS_NAME:"Jsonix.Context"});2467 // Complete Jsonix script is included above2468 return { Jsonix: Jsonix };2469};2470// If the require function exists ...2471if (typeof require === 'function') {2472 // ... but the define function does not exists2473 if (typeof define !== 'function') {2474 // Load the define function via amdefine2475 var define = require('amdefine')(module);2476 // If we're not in browser2477 if (typeof window === 'undefined')2478 {2479 // Require xmldom, xmlhttprequest and fs2480 define(["xmldom", "xmlhttprequest", "fs"], _jsonix_factory);2481 }2482 else2483 {2484 // We're probably in browser, maybe browserify2485 // Do not require xmldom, xmlhttprequest as they'r provided by the browser2486 // Do not require fs since file system is not available anyway2487 define([], _jsonix_factory);2488 }2489 }2490 else {2491 // Otherwise assume we're in the browser/RequireJS environment2492 // Load the module without xmldom and xmlhttprequests dependencies2493 define([], _jsonix_factory);2494 }2495}2496// If the require function does not exists, we're not in Node.js and therefore in browser environment2497else2498{2499 // Just call the factory and set Jsonix as global.2500 var Jsonix = _jsonix_factory().Jsonix;...

Full Screen

Full Screen

testUtil.test.js

Source:testUtil.test.js Github

copy

Full Screen

1"use strict";2const jestEach = require('jest-each').default;3const boxedImmutable = require("boxed-immutable");4const utilTypeFuncs = require('util-type-funcs');5const objEachBreak = require('obj-each-break');6const testUtil = require('./testUtil');7const boxOut = require('boxed-out');8const boxState = require('../index');9const box = boxedImmutable.box;10const _$ = box;11const $_ = boxOut;12const isObjectLike = utilTypeFuncs.isObjectLike;13const isNullOrUndefined = utilTypeFuncs.isNullOrUndefined;14const isArray = utilTypeFuncs.isArray;15const toArrayIndex = utilTypeFuncs.toArrayIndex;16const isArrayIndex = utilTypeFuncs.isArrayIndex;17const isValid = utilTypeFuncs.isValid;18const isFunction = utilTypeFuncs.isFunction;19const isString = utilTypeFuncs.isString;20const isNumeric = utilTypeFuncs.isNumeric;21const toNumber = utilTypeFuncs.toNumber;22const BREAK = objEachBreak.BREAK;23const cloneArrayObject = objEachBreak.cloneArrayObject;24const hasOwnProperties = objEachBreak.hasOwnProperties;25const isBoxedProxy = boxedImmutable.isBoxedProxy;26const isBoxedInProxy = boxedImmutable.isBoxedInProxy;27const isBoxedOutProxy = boxedImmutable.isBoxedOutProxy;28const createTransformedBoxed = testUtil.createTransformedBoxed;29const generateTestParams = testUtil.generateTestParams;30const paramStringException = testUtil.paramStringException;31const createBoxed = testUtil.createBoxed;32const createOnDemandBoxed = testUtil.createBoxedState;33const toTypeString = testUtil.toTypeString;34const stringify = testUtil.stringify;35const createBoxedState = testUtil.createBoxedState;36const array = testUtil.array;37const object = testUtil.object;38jestEach([39 [undefined, 'undefined'],40 [null, 'null'],41 [NaN, 'NaN'],42 ["test", '"test"'],43 [true, 'true'],44 [false, 'false'],45 [0, '0'],46 [5, '5'],47])48 .describe('util.toTypeString', (value, valueText) => {49 test(`toTypeString(${valueText}) === ${valueText}`, () => {50 expect(toTypeString(value)).toBe(valueText);51 });52 test('isBoxedProxy(null) === false', () => {53 expect(!!isBoxedProxy(null)).toBe(false);54 });55 });56jestEach([57 [undefined, false],58 [null, false],59 [NaN, false],60 ["test", false],61 [true, false],62 [false, false],63 [0, false],64 [5, false],65 [[], false],66 [{}, false],67])68 .describe('isBoxedProxy', (value, expected) => {69 test(`isProxy(${toTypeString(value)}) === ${toTypeString(expected)}`, () => {70 expect(!!isBoxedProxy(value) || false).toBe(expected);71 });72 test(`isBoxedProxy(${'_$('}${toTypeString(value)})) === ${toTypeString(true)}`, () => {73 const target = _$(value);74 const box = isBoxedProxy(target);75 expect(!!box).toBe(true);76 });77 test(`isBoxedInProxy(${'_$('}${toTypeString(value)})) === ${toTypeString(true)}`, () => {78 const target = _$(value);79 const box = isBoxedInProxy(target);80 expect(!!box).toBe(true);81 });82 test(`isBoxedOutProxy(${'_$('}${toTypeString(value)})) === ${toTypeString(false)}`, () => {83 const target = _$(value);84 const box = isBoxedOutProxy(target);85 expect(!!box).toBe(false);86 });87 test(`isBoxedOutProxy(${'_$('}${toTypeString(value)}).$_) === ${toTypeString(isObjectLike(value))}`, () => {88 const target = _$(value);89 const proxy = target.$_;90 const box = isBoxedOutProxy(proxy);91 expect(!!box).toBe(!!isObjectLike(value));92 });93 });94test(`keys .$_`, () => {95 const target = _$({});96 const boxedIn = target.$_;97 const keys = Object.keys(boxedIn);98 expect(keys).toEqual([]);...

Full Screen

Full Screen

TypeUtils.js

Source:TypeUtils.js Github

copy

Full Screen

1/*jslint browser: true, plusplus: true, nomen: true */2var mojo;3(function () {4 'use strict';5 var base = mojo.base,6 util = mojo.util;7 util.TypeUtils = function () {8 throw 'mojo.util.TypeUtils is not callable directly!';9 };10 util.TypeUtils.isScalar = function (value) {11 var type = typeof value;12 return (type !== 'undefined' && type !== 'object' && type !== 'function');13 };14 util.TypeUtils.isScalarOrNull = function (value) {15 return value === null || util.TypeUtils.isScalar(value);16 };17 util.TypeUtils.isScalarOrVacant = function (value) {18 var type = typeof value;19 return (type === 'undefined' || value === null || type !== 'object');20 };21 util.TypeUtils.isVacant = function (value) {22 return (value === null || typeof value === 'undefined');23 };24 util.TypeUtils.isArray = function (value) {25 return (value instanceof Array);26 };27 util.TypeUtils.isObject = function (value) {28 return (value !== null && typeof value === 'object');29 };30 util.TypeUtils.getTypeOf = function (value) {31 var ret = typeof value;32 if (value === null) {33 ret = 'null';34 }35 return ret;36 };37 // TODO - tests38 util.TypeUtils.isOfType = function (subj, allowedTypes) {39 var ret = false,40 i,41 type;42 allowedTypes = base.Arrays.asArray(allowedTypes);43 for (i = 0; i < allowedTypes.length; ++i) {44 type = allowedTypes[i];45 if (typeof type === 'undefined') {46 type = 'undefined';47 } else if (type === null) {48 type = 'null';49 }50 if ((typeof type === 'string' && util.TypeUtils.getTypeOf(subj) === type)51 || (typeof type === 'function' && subj instanceof type)52 || (type === 'vacant' && (subj === null || typeof subj === 'undefined'))53 || (type === 'scalar' && util.TypeUtils.isScalar(type))) {54 ret = true;55 break;56 }57 }58 return ret;59 };60 // TODO test61 util.TypeUtils.asBoolean = function (value) {62 return !!value;63 };...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert');2var sinon = require('sinon');3var type = sinon.util.type;4assert(type({}) === "object");5assert(type([]) === "array");6assert(type(/./) === "regexp");7assert(type(new Date()) === "date");8assert(type(new Error()) === "error");9assert(type(sinon) === "function");10assert(type(null) === "null");11assert(type(undefined) === "undefined");12var assert = require('assert');13var sinon = require('sinon');14var functionName = sinon.util.functionName;15function foo() {}16assert(functionName(foo) === "foo");17var bar = { baz: function() {} };18assert(functionName(bar.baz) === "baz");19assert(functionName(function() {}) === "anonymous");20var assert = require('assert');21var sinon = require('sinon');22var valueToString = sinon.util.valueToString;23assert(valueToString("abc") === "\"abc\"");24assert(valueToString(123) === "123");25assert(valueToString(true) === "true");26assert(valueToString(false) === "false");27assert(valueToString(null) === "null");28assert(valueToString(undefined) === "undefined");29assert(valueToString({}) === "{}");30assert(valueToString([]) === "[]");31assert(valueToString(/./) === "/./");32assert(valueToString(new Date()) === new Date().toString());33var assert = require('assert');34var sinon = require('sinon');35var objectKeys = sinon.util.objectKeys;36var obj = {37};38assert.deepEqual(objectKeys(obj), ["foo", "bar", "baz"]);39var assert = require('assert');40var sinon = require('sinon');41var isRestorable = sinon.util.isRestorable;42var obj = {43 "foo": function() {},44 "bar": function() {}45};46var stub = sinon.stub(obj, "foo");47assert(isRestorable(stub));48assert(!isRestorable(obj.foo));49assert(!isRestorable(obj.bar));

Full Screen

Using AI Code Generation

copy

Full Screen

1var sinon = require('sinon');2var n = require('sinon');3var assert = require('assert');4var type = n.util.type;5assert(type({}) === "object");6assert(type([]) === "array");7assert(type(/a/) === "regexp");8assert(type(new Date()) === "date");9assert(type(new Error()) === "error");10assert(type(Object.create(null)) === "object");11assert(type(Object.create({})) === "object");12assert(type(Object.create(Object.prototype)) === "object");13assert(type(Object.create(null)) !== "null");14assert(type(Object.create({})) !== "object");15assert(type(Object.create(Object.prototype)) !== "object");16assert(type(Object.create(null)) !== "undefined");17assert(type(Object.create({})) !== "undefined");18assert(type(Object.create(Object.prototype)) !== "undefined");19assert(type(Object.create(null)) !== "function");20assert(type(Object.create({})) !== "function");21assert(type(Object.create(Object.prototype)) !== "function");22assert(type(Object.create(null)) !== "number");23assert(type(Object.create({})) !== "number");24assert(type(Object.create(Object.prototype)) !== "number");25assert(type(Object.create(null)) !== "string");26assert(type(Object.create({})) !== "string");27assert(type(Object.create(Object.prototype)) !== "string");28assert(type(Object.create(null)) !== "boolean");29assert(type(Object.create({})) !== "boolean");30assert(type(Object.create(Object.prototype)) !== "boolean");31assert(type(Object.create(null)) !== "date");32assert(type(Object.create({})) !== "date");33assert(type(Object.create(Object.prototype)) !== "date");34assert(type(Object.create(null)) !== "regexp");35assert(type(Object.create({})) !== "regexp");36assert(type(Object.create(Object.prototype)) !== "regexp");37assert(type(Object.create(null)) !== "array");38assert(type(Object.create({})) !== "array");39assert(type(Object.create(Object.prototype)) !== "array");40assert(type(Object.create(null)) !== "error");41assert(type(Object.create({})) !== "error");42assert(type(Object.create(Object.prototype)) !== "error");43assert(type(Object.create(null)) !== "symbol");44assert(type(Object.create({})) !== "symbol");45assert(type(Object.create(Object.prototype)) !== "symbol");46assert(type(Object.create(null)) !== "map");47assert(type(Object.create({})) !== "map");48assert(type(Object.create(Object.prototype)) !== "map");49assert(type(Object.create(null)) !== "set");50assert(type(Object.create({})) !== "set");51assert(type

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert');2var sinon = require('sinon');3var n = require('n-util');4var type = n.util.type;5var util = require('util');6describe('type', function() {7 it('should return "function" for a function', function() {8 assert.equal(type(sinon.spy()), 'function');9 });10 it('should return "object" for an object', function() {11 assert.equal(type({}), 'object');12 });13 it('should return "array" for an array', function() {14 assert.equal(type([]), 'array');15 });16 it('should return "string" for a string', function() {17 assert.equal(type(''), 'string');18 });19 it('should return "number" for a number', function() {20 assert.equal(type(123), 'number');21 });22 it('should return "null" for null', function() {23 assert.equal(type(null), 'null');24 });25 it('should return "undefined" for undefined', function() {26 assert.equal(type(undefined), 'undefined');27 });28 it('should return "regexp" for a regexp', function() {29 assert.equal(type(/./), 'regexp');30 });31 it('should return "date" for a date', function() {32 assert.equal(type(new Date()), 'date');33 });34 it('should return "boolean" for a boolean', function() {35 assert.equal(type(true), 'boolean');36 });37 it('should return "arguments" for arguments', function() {38 assert.equal(type(arguments), 'arguments');39 });40 it('should return "error" for an error', function() {41 assert.equal(type(new Error()), 'error');42 });43 it('should return "nan" for NaN', function() {44 assert.equal(type(NaN), 'nan');45 });46 it('should return "symbol" for a symbol', function() {47 if (typeof Symbol === 'function') {48 assert.equal(type(Symbol()), 'symbol');49 }50 });51 it('should return "map" for a map', function() {52 if (typeof Map === 'function') {53 assert.equal(type(new Map()), 'map');54 }55 });56 it('should return "set" for a set', function() {57 if (typeof Set === 'function') {58 assert.equal(type(new Set()), 'set');59 }

Full Screen

Using AI Code Generation

copy

Full Screen

1var n = require('sinon');2var a = n.util.type(3);3console.log(a);4var b = n.util.type("hello");5console.log(b);6var c = n.util.type([1,2]);7console.log(c);8var d = n.util.type({a:1, b:2});9console.log(d);10var e = n.util.type(function() {});11console.log(e);12var f = n.util.type(null);13console.log(f);14var g = n.util.type(undefined);15console.log(g);16var h = n.util.type(true);17console.log(h);18var i = n.util.type(new Date());19console.log(i);20var j = n.util.type(new RegExp());21console.log(j);22var k = n.util.type(new Error());23console.log(k);

Full Screen

Using AI Code Generation

copy

Full Screen

1var assert = require('assert');2var sinon = require('sinon');3var util = require('util');4var myObj = {5 myMethod: function() {6 return 'myMethod';7 }8};9var spy = sinon.spy(myObj, 'myMethod');10assert(myObj.myMethod() === 'myMethod');11assert(spy.called);12assert(spy.calledWith());13assert(spy.calledOn(myObj));14assert(spy.calledOnce);15assert(spy.calledThrice);16assert(spy.calledBefore(someOtherSpy));17assert(spy.calledAfter(someOtherSpy));18assert(spy.alwaysReturned('myMethod'));19assert(spy.alwaysThrew(new Error('my error')));20assert(spy.calledWithNew());21assert(spy.calledWithNew(sinon.match.string));22assert(spy.calledWithNew(myObj));23assert(spy.calledWithNew(sinon.match.string, myObj));24assert(spy.calledWithNew(sinon.match.string, myObj));25assert(spy.alwaysReturned('myMethod'));26assert(spy.alwaysThrew(new Error('my error')));27assert(spy.calledWithNew());28assert(spy.calledWithNew(sinon.match.string));29assert(spy.calledWithNew(myObj));

Full Screen

Using AI Code Generation

copy

Full Screen

1var sinon = require('sinon');2var n = require('n-util');3var obj = { 'a': 1 };4var string = 'string';5var number = 1;6var bool = true;7var array = [1, 2, 3];8var date = new Date();9var regexp = /\d+/;10var func = function () { };11var object = new Object();12var promise = new Promise(function (resolve, reject) { });13var error = new Error();14var map = new Map();15var set = new Set();16var weakmap = new WeakMap();17var weakset = new WeakSet();18var nan = NaN;19var inf = Infinity;20var undef;21var nullval = null;22var args = (function () { return arguments; })();23console.log('obj', n.util.type(obj));24console.log('string', n.util.type(string));25console.log('number', n.util.type(number));26console.log('bool', n.util.type(bool));27console.log('array', n.util.type(array));28console.log('date', n.util.type(date));29console.log('regexp', n.util.type(regexp));30console.log('func', n.util.type(func));31console.log('object', n.util.type(object));32console.log('promise', n.util.type(promise));33console.log('error', n.util.type(error));34console.log('map', n.util.type(map));35console.log('set', n.util.type(set));36console.log('weakmap', n.util.type(weakmap));37console.log('weakset', n.util.type(weakset));38console.log('nan', n.util.type(nan));39console.log('inf', n.util.type(inf));40console.log('undef', n.util.type(undef));41console.log('nullval', n.util.type(nullval));42console.log('args', n.util.type(args));43var sinon = require('sinon');44var n = require('n-util');45var obj = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var n = require('sinon');2var assert = require('chai').assert;3describe('sinon', function() {4 it('should return true if the value is a function', function() {5 var a = function () {};6 assert.equal(n.util.type(a), 'function');7 });8});

Full Screen

Using AI Code Generation

copy

Full Screen

1var n = require('sinon');2var assert = require('assert');3describe('type', function() {4 it('should return "undefined" for undefined', function() {5 assert.equal(type(undefined), 'undefined');6 });7 it('should return "null" for null', function() {8 assert.equal(type(null), 'null');9 });10 it('should return "object" for objects', function() {11 assert.equal(type({}), 'object');12 });13 it('should return "array" for arrays', function() {14 assert.equal(type([]), 'array');15 });16 it('should return "regexp" for regular expressions', function() {17 assert.equal(type(/./), 'regexp');18 });19 it('should return "date" for dates', function() {20 assert.equal(type(new Date()), 'date');21 });22 it('should return "function" for functions', function() {23 assert.equal(type(function() {}), 'function');24 });25 it('should return "boolean" for booleans', function() {26 assert.equal(type(false), 'boolean');27 });28 it('should return "number" for numbers', function() {29 assert.equal(type(1), 'number');30 });31 it('should return "string" for strings', function() {32 assert.equal(type(''), 'string');33 });34});35var n = require('sinon');36var assert = require('assert');37describe('method', function() {38 it('should return a function', function() {39 assert.equal(typeof method(), 'function');40 });41 it('should return a function that calls the method on the first argument', function() {42 var obj = {43 method: function() {44 return 'called';45 }46 };47 var methodStub = n.stub(obj, 'method');48 var fn = method(obj, 'method');49 fn();50 assert(methodStub.called);51 });52 it('should return a function that calls the method on the first argument with the rest of the arguments', function() {53 var obj = {54 method: function() {55 return 'called';56 }57 };

Full Screen

Using AI Code Generation

copy

Full Screen

1var n = require('sinon');2var assert = require('assert');3var func = require('./func.js');4var obj = func();5assert(n.util.type(obj) === 'object');6console.log("Object is of type object");

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run sinon automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful