⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultformat.java

📁 具备多表组合查询组件功能。通过将表字段与表间关系映射到对象关系及属性
💻 JAVA
字号:
package cn.edu.buaa.ieguam.logmanage;

import java.util.ArrayList;
import java.util.List;


/**
 * 定义数据查询结果的格式,与查询Sql语句的“Select”部分一致
 * @author tongxiaodong
 * Creation time:Apr 23, 2007 10:10:54 PM
 */

public class ResultFormat {
	
	private List colList = new ArrayList();//存放ColBean
	//private Map colMap = new HashMap();
	private int index = -1;//colList中的索引号
	private int size = 0;
	
	/**
	 * Getting and setting methods.
	 * @return
	 */
	public List getColList()
	{
		return this.colList;
	}
	public void setColList(List colList)
	{
		this.colList = colList;
	}
	
	/**
	 * 判断是否存在ColBean元素
	 * @return
	 */
	public boolean hasNextCol()
	{
		boolean flag = false;	
		this.index++;	
		if(index<this.colList.size())
		{
			flag = true;
		}
		return flag;
	}
	/**
	 * 取出一个ColBean元素
	 * @return
	 */
	public ResultFormat.ColBean nextCol()
	{
		if(this.index<this.colList.size())
		{
			//return (ResultFormat.ColBean)colMap.get(new Integer(this.index+1));
			return (ResultFormat.ColBean)colList.get(index);
		}
		return null;
	}
	
	/**
	 * 按照索引号取得colBean
	 * @param index
	 * @return
	 */
	public ResultFormat.ColBean getCol(int index)
	{
		if(index >= this.colList.size())
		{
			return null;
		}
		else
		{
			return (ResultFormat.ColBean)this.colList.get(index);
		}
	}
	/**
	 * 添加一个ColBean元素
	 *
	 */
	public void addOneCol(ResultFormat.ColBean colBean)
	{
			
		if(colBean == null)
		{
			return;
		}
		
		//Integer key = new Integer(this.colMap.size()+1);	
		//this.colMap.put(key,colBean);
		
		this.colList.add(colBean);
	}
	
	/**
	 * 刷新Index的值
	 *
	 */
	public void refreshIndex()
	{
		this.index = -1;
	}
	
	/**
	 * 返回包含元素的个数
	 * @return
	 */
	public int getSize()
	{
		return this.colList.size();
	}
		
	/**
	 * 存储字段信息的内置类
	 * @author tongxiaodong
	 * Creation time:Nov 29, 2006 4:30:38 PM
	 */
	public class ColBean
	{
		private String pojoName = null;
		private String pojoCol = null;//pojo属性名
		private String tableCol = null;//table表字段名
		private String title = null;//显示标题名称
		private int key = 0;//显示字段的序号
		
		//private String colDataType = null;//标识该字段的数据类型
		
		/**
		 * Getting and setting methods
		 * @return
		 */
		
		public String getPojoName()
		{
			return this.pojoName;
		}
		public void setPojoName(String pojoName)
		{
			this.pojoName = pojoName;
		}
		
		
		public String getPojoCol()
		{
			return this.pojoCol;
		}
		public void setPojoCol(String pojoCol)
		{
			this.pojoCol = pojoCol;
		}
		
		public String getTableCol()
		{
			return this.tableCol;
		}
		public void setTableCol(String tableCol)
		{
			this.tableCol = tableCol;
		}
		
		public String getTitle()
		{
			return this.title;
		}
		public void setTitle(String title)
		{
			this.title = title;
		}
		
		public int getKey()
		{
			return this.key;
		}
		public void setKey(int key)
		{
			this.key = key;
		}
	/**
		public String getColDataType()
		{
			return this.colDataType;
		}
		public void setColDataType(String colDataType)
		{
			this.colDataType = colDataType;
		}
	*/
		
		/**
		 * 鉴别数据类型,并返回类型名称
		 * @param value
		 */
	/**
		public String checkDataType(Object value)
		{
			
			if(value instanceof String)
			{
				return "String";
			}
			if(value instanceof Integer)
			{
				return "Integer";
			}
			if(value instanceof java.sql.Date)
			{
				return "java.sql.Date";
			}
			if(value instanceof java.util.Date)
			{
				return "java.util.Date";
			}
			return "Object";
		}
    */
	}
	
	
		
	

}

⌨️ 快捷键说明

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