net.sf.aguacate.function.spi.impl.FunctionSqlSelectSingle Maven / Gradle / Ivy
package net.sf.aguacate.function.spi.impl;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.sf.aguacate.function.FunctionContext;
import net.sf.aguacate.function.FunctionEvalResult;
import net.sf.aguacate.function.Parameter;
import net.sf.aguacate.function.spi.AbstractFunctionSql;
public class FunctionSqlSelectSingle extends AbstractFunctionSql {
private final String[] outputContext;
private final String outputName;
public FunctionSqlSelectSingle(Collection methods, String name, String message, List parameters,
List outputContext, String outputName, String table, String column) {
super(methods, name, message,
MessageFormat.format("SELECT {0} FROM {1} WHERE {2} = ?", column, table, parameters.get(0).getName()),
new String[] { parameters.get(0).getName() }, new String[] { outputName });
this.outputContext = outputContext.toArray(new String[outputContext.size()]);
this.outputName = outputName;
}
@Override
public FunctionEvalResult evaluate(FunctionContext functionContext, Map context) {
return new FunctionEvalResult(null, selectSingle(functionContext, context));
}
@Override
public String getOutputName() {
return outputName;
}
@Override
public String[] getOutputContext() {
return outputContext;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy