org.unlaxer.tinyexpression.evaluator.javacode.NakedVariableBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tinyExpression Show documentation
Show all versions of tinyExpression Show documentation
TinyExpression implemented with Unlaxer
package org.unlaxer.tinyexpression.evaluator.javacode;
import org.unlaxer.Token;
import org.unlaxer.TypedToken;
import org.unlaxer.tinyexpression.parser.VariableParser;
public class NakedVariableBuilder implements TokenCodeBuilder{
public static NakedVariableBuilder SINGLETON = new NakedVariableBuilder();
@Override
public void build(SimpleJavaCodeBuilder builder, Token token ,
TinyExpressionTokens tinyExpressionTokens) {
TypedToken typed = token.typed(VariableParser.class);
VariableParser parser = typed.getParser();
String variableName = parser.getVariableName(typed);
builder.append("calculateContext.getFromNumberOrStringOrBoolean(").w(variableName).append(")");
}
}