📄 cell.java
字号:
/*
* Created on 2004-3-22
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.zosatapo.xls.core;
/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public class Cell
{
public final static Cell NULL_CELL=new Cell(null,-1,-1,null);
/**
* 导入数据类型列值保存类型对应:
* (1) VARCHAR,INTEGER,FLOAT -->java.lang.String
* (2) DATE -->java.sql.Date
* (3) TIME -->java.sql.Time
* (4) TIMESTAMP -->java.sql.Timestamp
*/
private Object value;
private Schema schema;
private int rowNum;
private int colNum;
public Cell( Schema schema,int rowNum,int colNum,Object value)
{
this.schema=schema;
this.value=value;
this.rowNum=rowNum;
this.colNum=colNum;
}
public boolean validate()
{
Column col=schema.getColumn(colNum);
Type colType=col.getType();
if(Type.VARCHAR.equals(colType))
{
if(value!=null && value.toString().length()>col.getLength())
{
return false;
}
}
return true;
}
public Schema getSchema()
{
return schema;
}
public int getRowIndex()
{
return rowNum;
}
public int getColumnIndex()
{
return colNum;
}
public Object getValue()
{
return value;
}
public boolean isNull()
{
return schema==null;
}
public String toString()
{
if(isNull())
{
return "[Cell] <null>";
}
String string="[Cell] row="+rowNum
+",column="+colNum
+",value="+value;
return string;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -