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

org.onetwo.common.db.filequery.SqlAndValues Maven / Gradle / Ivy

The newest version!
package org.onetwo.common.db.filequery;

import java.util.List;
import java.util.Map;

import org.onetwo.common.db.ParsedSqlContext;

public class SqlAndValues implements ParsedSqlContext {
	private String parsedSql;
	final private Object values;
	final private boolean namedValue;
	
	public SqlAndValues(boolean namedValue, String parsedSql, Object values) {
		super();
		this.namedValue = namedValue;
		this.parsedSql = parsedSql;
		this.values = values;
	}
	

	@Override
	public Map asMap() {
		return getValues();
	}

	@Override
	public List asList() {
		return getValues();
	}
	
	@Override
	public boolean isListValue(){
		return !this.namedValue;
	}
	
	@Override
	public boolean isMapValue(){
		return this.namedValue;
	}
	
	/*********
	 * List Or Map
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@Override
	public  T getValues(){
		return (T) values;
	}

	@Override
	public String getParsedSql() {
		return parsedSql;
	}

	public void setParsedSql(String parsedSql) {
		this.parsedSql = parsedSql;
	}

	/*@Override
	public QueryConfigData getQueryConfig() {
		return queryConfig==null?ParsedSqlUtils.EMPTY_CONFIG:queryConfig;
	}
	*/
}