queryparameters.java

来自「用Java实现的23个常用设计模式源代码」· Java 代码 · 共 115 行

JAVA
115
字号
//$Id: QueryParameters.java,v 1.1.2.3 2003/11/02 08:56:48 oneovthafew Exp $package net.sf.hibernate.engine;import java.util.Map;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import net.sf.hibernate.HibernateException;import net.sf.hibernate.impl.Printer;import net.sf.hibernate.type.Type;/** * @author Gavin King */public final class QueryParameters {		private static final Log log = LogFactory.getLog(QueryParameters.class);		private Type[] positionalParameterTypes;	private Object[] positionalParameterValues;	private Map namedParameters;	private Map lockModes;	private RowSelection rowSelection;	private boolean cacheable;	private String cacheRegion;		public QueryParameters(Type[] positionalParameterTypes, Object[] postionalParameterValues) {		this(positionalParameterTypes, postionalParameterValues, null, null, null);	}	public QueryParameters(		Type[] positionalParameterTypes, 		Object[] postionalParameterValues, 		Map namedParameters, Map lockModes, 		RowSelection rowSelection	) {		this.positionalParameterTypes = positionalParameterTypes;		this.positionalParameterValues = postionalParameterValues;		this.namedParameters = namedParameters;		this.lockModes = lockModes;		this.rowSelection = rowSelection;	}		public boolean hasRowSelection() {		return rowSelection!=null;	}		public Map getNamedParameters() {		return namedParameters;	}		public Type[] getPositionalParameterTypes() {		return positionalParameterTypes;	}	public Object[] getPositionalParameterValues() {		return positionalParameterValues;	}	public RowSelection getRowSelection() {		return rowSelection;	}	public void setNamedParameters(Map map) {		namedParameters = map;	}	public void setPositionalParameterTypes(Type[] types) {		positionalParameterTypes = types;	}	public void setPositionalParameterValues(Object[] objects) {		positionalParameterValues = objects;	}	public void setRowSelection(RowSelection selection) {		rowSelection = selection;	}	public Map getLockModes() {		return lockModes;	}	public void setLockModes(Map map) {		lockModes = map;	}		public void traceParameters(SessionFactoryImplementor factory) throws HibernateException {		Printer print = new Printer(factory);		if (positionalParameterValues.length!=0) log.trace( 			"parameters: " + print.toString(positionalParameterTypes, positionalParameterValues) 		);		if (namedParameters!=null) log.trace(			"named parameters: " + print.toString(namedParameters)		);	}	public boolean isCacheable() {		return cacheable;	}	public void setCacheable(boolean b) {		cacheable = b;	}	public String getCacheRegion() {		return cacheRegion;	}	public void setCacheRegion(String cacheRegion) {		this.cacheRegion = cacheRegion;	}}

⌨️ 快捷键说明

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