use of com.yahoo.document.DataType in project vespa by vespa-engine.
the class GetVarExpression method doVerify.
@Override
protected void doVerify(VerificationContext context) {
DataType input = context.getVariable(varName);
if (input == null) {
throw new VerificationException(this, "Variable '" + varName + "' not found.");
}
context.setValue(input);
}
use of com.yahoo.document.DataType in project vespa by vespa-engine.
the class SwitchExpression method doVerify.
@Override
protected void doVerify(VerificationContext context) {
DataType input = context.getValue();
if (input == null) {
throw new VerificationException(this, "Expected " + DataType.STRING.getName() + " input, got null.");
}
if (input != DataType.STRING) {
throw new VerificationException(this, "Expected " + DataType.STRING.getName() + " input, got " + input.getName() + ".");
}
for (Expression exp : cases.values()) {
context.setValue(input).execute(exp);
}
context.setValue(input).execute(defaultExp);
context.setValue(input);
}
use of com.yahoo.document.DataType in project vespa by vespa-engine.
the class InputExpression method doVerify.
@Override
protected void doVerify(VerificationContext context) {
DataType val = context.getInputType(this, fieldName);
if (val == null) {
throw new VerificationException(this, "Field '" + fieldName + "' not found.");
}
context.setValue(val);
}
use of com.yahoo.document.DataType in project vespa by vespa-engine.
the class SelectInputExpression method doVerify.
@Override
protected void doVerify(VerificationContext context) {
DataType input = context.getValue();
for (Pair<String, Expression> entry : cases) {
DataType val = context.getInputType(this, entry.getFirst());
if (val == null) {
throw new VerificationException(this, "Field '" + entry.getFirst() + "' not found.");
}
context.setValue(val).execute(entry.getSecond());
}
context.setValue(input);
}
use of com.yahoo.document.DataType in project vespa by vespa-engine.
the class StatementExpression method requiredInputType.
@Override
public DataType requiredInputType() {
for (Expression exp : this) {
DataType type = exp.requiredInputType();
if (type != null) {
return type;
}
type = exp.createdOutputType();
if (type != null) {
return null;
}
}
return null;
}
Aggregations