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

com.jaregu.database.queries.compiling.expr.VariableImpl Maven / Gradle / Ivy

Go to download

Java based SQL templating project. Store your queries in *.sql files and build queries for execution. Supports simple expressions and conditional clauses and interface proxying for java-sql bridge.

There is a newer version: 1.4.1
Show newest version
package com.jaregu.database.queries.compiling.expr;

import java.util.Collections;
import java.util.List;

public final class VariableImpl extends EvaluableOperand implements Variable {

	final private String name;
	private List variableNames;

	public VariableImpl(String name) {
		this.name = name;
		this.variableNames = Collections.singletonList(name);
	}

	@Override
	public Object getValue() {
		EvaluationContext context = EvaluationContext.getCurrent();
		return context.getVariableResolver().toNamed().getValue(name);
	}

	@Override
	public String toString() {
		return "${" + name + "}";
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public List getVariableNames() {
		return variableNames;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy