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

holmos.webtest.junitextentions.parameters.ParameterDataInfo Maven / Gradle / Ivy

There is a newer version: 1.0.2u10
Show newest version
package holmos.webtest.junitextentions.parameters;

import holmos.webtest.junitextentions.parameters.getter.DataGetter;

import java.util.ArrayList;
import java.util.HashMap;
/**
 * 一组参数的参数信息
 * 
 * @author 吴银龙([email protected])
 * */
public class ParameterDataInfo {
	/**数据获取器*/
	private DataGetter dataGetter;
	public DataGetter getDataGetter() {
		return dataGetter;
	}
	/**参数数据信息缓冲池*/
	private HashMap>parameters;
	public ParameterDataInfo(DataGetter dataGetter){
		this.dataGetter=dataGetter;
		parameters=new HashMap>();
	}
	/**根据批量id信息获取参数*/
	public ArrayList getParameters(int[]ids){
		ArrayList result=new ArrayList();
		for(int id:ids){
			result.addAll(getParameters(id));
		}return result;
	}
	/**根据id信息获取参数*/
	public ArrayList getParameters(int id){
		ArrayList result=new ArrayList();
		if(parameters.get(id)==null){
			ArrayList parameter=dataGetter.getParameterByID(id);
			parameters.put(id,parameter);
			result.addAll(parameter);
		}else{
			result.addAll(parameters.get(id));
		}return result;
	}
	/**获取此数据源的全部参数列表信息*/
	public ArrayList getAllParameters(){
		if(parameters.get(-1)==null)
			parameters.put(-1, dataGetter.getAllParameter());
		return dataGetter.getAllParameter();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy