property.js

来自「一个javascript写的自动生成代码的东东」· JavaScript 代码 · 共 52 行

JS
52
字号

	
	function Property(name,type,doGet,doSet,defaultValue,unique,nullable,emptyAvailable){
		this.name=name;
		this.type=type;
		this.doGet=doGet;
		this.doSet=doSet;
		this.defaultValue=defaultValue;
		this.description="";
		this.stringLength=50;

		if(unique=='true'){
			this.unique='true';
		}else{
			this.unique='false';
		}

		if(nullable=='true'){
			this.nullable='true';
		}else{
			this.nullable='false';
		}

		if(emptyAvailable=='true'){
			this.emptyAvailable='true';
		}else{
			this.emptyAvailable='false';
		}
	}
	Property.prototype.toXmlElement=function(){
		var xmldoc = new ActiveXObject("Microsoft.XMLDOM");
		xmldoc.async = false;
		var element_property=xmldoc.createElement("property");
		element_property.setAttribute("name",this.name);
		element_property.setAttribute("upCaseName",firstCharToUp(this.name));
		element_property.setAttribute("lowCaseName",firstCharToLow(this.name));
		element_property.setAttribute("type",this.type);
		element_property.setAttribute("doGet",this.doGet);
		element_property.setAttribute("doSet",this.doSet);
		element_property.setAttribute("unique",this.unique);
		element_property.setAttribute("nullable",this.nullable);
		element_property.setAttribute("emptyAvailable",this.emptyAvailable);
		element_property.setAttribute("description",this.description);
		var sl=0;
		if(!isNaN(this.stringLength)){
			sl=this.stringLength;
		}
		element_property.setAttribute("stringLength",sl);
		element_property.text=this.defaultValue;
//		alert(element_property.xml);
		return element_property;
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?