📄 field.java
字号:
package com.tanghan.db;import java.io.Serializable;import com.tanghan.db.util.*;public class Field implements Serializable{ //字段名称 private String fieldName = ""; //字段在java.sql.Types中的类型 private int fieldType = 0; //字段类型 private String fieldTypeName = ""; //字段长度 private int fieldLength = 0; // private int precision = 0; // private int scale = 0; //表名称 private String tableName = ""; //是否为空 private boolean nullable = false; //是否为关键字 private boolean primaryKey = false; //是否为外键 private boolean foreignKey = false; //该表字段相对应得java类型 private String javaFieldType = "String"; public Field(String tableName ,String fieldName,int fieldType, String fieldTypeName, int fieldLength, int precision, int scale,boolean nullable) { this.tableName = tableName; this.fieldName = fieldName; this.fieldType = fieldType; this.fieldTypeName = fieldTypeName; this.fieldLength = fieldLength; this.precision = precision; this.scale = scale; this.nullable = nullable; javaFieldType = JavaFieldTypes.getJavaType(this); } /** * Gets the fieldName * @return Returns a String */ public String getFieldName() { return fieldName; } /** * Sets the fieldName * @param fieldName The fieldName to set */ public void setFieldName(String fieldName) { this.fieldName = fieldName.toLowerCase(); } /** * Gets the fieldType * @return Returns a String */ public int getFieldType() { return fieldType; } /** * Sets the fieldType * @param fieldType The fieldType to set */ public void setFieldType(int fieldType) { this.fieldType = fieldType; javaFieldType = JavaFieldTypes.getJavaType(this); } /** * Gets the fieldLength * @return Returns a int */ public int getFieldLength() { return fieldLength; } /** * Sets the fieldLength * @param fieldLength The fieldLength to set */ public void setFieldLength(int fieldLength) { this.fieldLength = fieldLength; } /** * Gets the precision * @return Returns a int */ public int getPrecision() { return precision; } /** * Sets the precision * @param precision The precision to set */ public void setPrecision(int precision) { this.precision = precision; } /** * Gets the scale * @return Returns a int */ public int getScale() { return scale; } /** * Sets the scale * @param scale The scale to set */ public void setScale(int scale) { this.scale = scale; } /** * Gets the tableName * @return Returns a String */ public String getTableName() { return tableName; } /** * Sets the tableName * @param tableName The tableName to set */ public void setTableName(String tableName) { this.tableName = tableName; } /** * Gets the nullable * @return Returns a boolean */ public boolean isNullable() { return nullable; } /** * Sets the nullable * @param nullable The nullable to set */ public void setNullable(boolean nullable) { this.nullable = nullable; } /** * Gets the fieldTypeName * @return Returns a String */ public String getFieldTypeName() { return fieldTypeName; } /** * Sets the fieldTypeName * @param fieldTypeName The fieldTypeName to set */ public void setFieldTypeName(String fieldTypeName) { this.fieldTypeName = fieldTypeName; } /** * Gets the javaFieldType * @return Returns a String */ public String getJavaFieldType() { return javaFieldType; } /** * Sets the javaFieldType * @param javaFieldType The javaFieldType to set */ public void setJavaFieldType(String javaFieldType) { this.javaFieldType = javaFieldType; } /** * @return */ public boolean isForeignKey() { return foreignKey; } /** * @return */ public boolean isPrimaryKey() { return primaryKey; } /** * @param b */ public void setForeignKey(boolean b) { foreignKey = b; } /** * @param b */ public void setPrimaryKey(boolean b) { primaryKey = b; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -