All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xiaoleilu.hutool.db.handler.BeanListHandler Maven / Gradle / Ivy

package com.xiaoleilu.hutool.db.handler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * 结果集处理类 ,处理出的结果为Bean列表
 * 
 * @param  处理对象类型
 * @author loolly
 * @since 3.1.0
 */
public class BeanListHandler implements RsHandler> {

	private Class elementBeanType;

	/**
	 * 创建一个 BeanListHandler对象
	 * 
	 * @param  处理对象类型
	 * @param beanType Bean类型
	 * @return BeanListHandler对象
	 */
	public static  BeanListHandler create(Class beanType) {
		return new BeanListHandler(beanType);
	}

	/**
	 * 构造
	 * @param beanType Bean类型
	 */
	public BeanListHandler(Class beanType) {
		this.elementBeanType = beanType;
	}

	@Override
	public List handle(ResultSet rs) throws SQLException {
		return HandleHelper.handleRsToBeanList(rs, new ArrayList(), elementBeanType);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy