/*!
 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['sap/ui/model/FormatException','sap/ui/model/odata/type/ODataType','sap/ui/model/ParseException','sap/ui/model/ValidateException','sap/ui/model/type/String'],function(F,O,P,V,S){"use strict";function s(t,c){var m,n;t.oConstraints=undefined;if(c){m=c.maxLength;if(typeof m==="string"){m=parseInt(m,10);}if(typeof m==="number"&&!isNaN(m)&&m>0){t.oConstraints={maxLength:m};}else if(m!==undefined){jQuery.sap.log.warning("Illegal maxLength: "+c.maxLength,null,t.getName());}n=c.nullable;if(n===false||n==="false"){t.oConstraints=t.oConstraints||{};t.oConstraints.nullable=false;}else if(n!==undefined&&n!==true&&n!=="true"){jQuery.sap.log.warning("Illegal nullable: "+n,null,t.getName());}}}var E=O.extend("sap.ui.model.odata.type.String",{constructor:function(f,c){O.apply(this,arguments);s(this,c);}});E.prototype.formatValue=S.prototype.formatValue;E.prototype.parseValue=function(v,a){return v===""?null:S.prototype.parseValue.apply(this,arguments);};E.prototype.validateValue=function(v){var c=this.oConstraints||{},m=c.maxLength;if(v===null){if(c.nullable!==false){return;}}else if(typeof v!=="string"){throw new V("Illegal "+this.getName()+" value: "+v);}else if(!m||v.length<=m){return;}throw new V(sap.ui.getCore().getLibraryResourceBundle().getText(m?"EnterTextMaxLength":"EnterText",[m]));};E.prototype.getName=function(){return"sap.ui.model.odata.type.String";};return E;});
