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

cn.bran.japid.template.JapidModelMap Maven / Gradle / Ivy

package cn.bran.japid.template;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

import cn.bran.japid.util.StringUtils;

/**
 * 
 * @author Bing Ran
 * @deprecated not used
 */
public class JapidModelMap {
	Map map = new HashMap();
	
	public JapidModelMap put(String key, Object val) {
		map.put(key, val);
		return this;
	}


	public Object[] buildArgs(String[] argNames) {
		Object[] ret = new Object[argNames.length];
		
		for (int i = 0; i < argNames.length; i++) {
			ret[i] = map.remove(argNames[i]);
		}
		if (map.size() > 0) {
			Set keys = map.keySet();
			String sep = ", ";
			String ks = "[" + StringUtils.join(keys, sep) + "]";
			String vs = "[" + StringUtils.join(argNames, sep) + "]";
			throw new RuntimeException("One or more argument names are not valid: " + ks + ". Valid argument names are: " + vs);
		}
		return ret;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy