package com.sysmodel.datamodel.xmlmodel.impl; import com.sysmodel.datamodel.xmlmodel.able.Property; import com.sysmodel.xformmodel.able.Validate; import com.sysmodel.xformmodel.impl.ValidateImpl; public class PropertyImpl implements Property, Cloneable{ private String name; private String description; private String dataType; private int length; private String scale; private String referenceParentName; private boolean unique; private boolean display; private String refConstant; private Validate Validate = new ValidateImpl(); public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public boolean isDisplay() { return display; } public void setDisplay(boolean display) { this.display = display; } public boolean isUnique() { return unique; } public void setUnique(boolean unique) { this.unique = unique; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getReferenceParentName() { return referenceParentName; } public void setReferenceParentName(String referenceParentName) { this.referenceParentName = referenceParentName; } public String getScale() { return scale; } public void setScale(String scale) { this.scale = scale; } public String getDataType() { return dataType; } public void setDataType(String dataType) { this.dataType = dataType; } public int getLength() { return length; } public void setLength(int length) { this.length = length; } public String toString() { return name; } public boolean equals(Object obj) { if (obj instanceof PropertyImpl) { if (((PropertyImpl) obj).name.equals(this.name)) return true; } return false; } public String getRefConstant() { return refConstant; } public void setRefConstant(String refConstant) { this.refConstant = refConstant; } public Validate getValidate() { return Validate; } public void setValidate(Validate validate) { Validate = validate; } public Object clone() { PropertyImpl o = null; try { o = (PropertyImpl) super.clone(); o.Validate = (Validate) Validate.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } return o; } public String getFieldDefine() { StringBuffer sb = new StringBuffer(); sb.append("XML中定义 中文名:" + this.description + " 英文名:" + this.name + " "); if (this.getDataType().equals("date")) { sb.append("数据类型: date" + " 日期格式:" + this.getScale()); } else if (this.getDataType().equals("string")) { sb.append("数据类型: string" + " 最大长度: " + this.getLength()); } else if (this.getDataType().equals("number")) { sb.append("数据类型: number" + " 最大长度: " + this.getLength() + " 小数位: " + this.getScale()); } else if (this.getDataType().equals("blob")) { sb.append("数据类型: blob"); } else if (this.getDataType().equals("clob")) { sb.append("数据类型: clob"); } if (!this.getRefConstant().equals("")) { sb.append("引用常量: " + this.getRefConstant()); } return sb.toString(); } }