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

org.unlaxer.tinyexpression.evaluator.javacode.NakedVariableBuilder Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
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(")");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy