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

com.reinaldoarrosi.android.querybuilder.sqlite.projection.ConstantProjection Maven / Gradle / Ivy

The newest version!
package com.reinaldoarrosi.android.querybuilder.sqlite.projection;

import java.util.ArrayList;
import java.util.List;

import com.reinaldoarrosi.android.querybuilder.Utils;

public class ConstantProjection extends Projection {
	private Object constant;
	
	public ConstantProjection(Object constant) {
		this.constant = constant;
	}

	@Override
	public String build() {
		if(constant != null)
			return "?";
		else
			return "NULL";
	}

	@Override
	public List buildParameters() {
		if(constant != null) {
			List ret = new ArrayList();
			ret.add(constant);
			
			return ret;
		} else {
			return Utils.EMPTY_LIST;
		}
	}
}