org.unlaxer.tinyexpression.evaluator.javacode.StringInBooleanExpressionBuilder 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 java.util.Iterator;
import java.util.List;
import org.unlaxer.Token;
public class StringInBooleanExpressionBuilder implements TokenCodeBuilder {
public static final StringInBooleanExpressionBuilder SINGLETON = new StringInBooleanExpressionBuilder();
@Override
public void build(SimpleJavaCodeBuilder builder, Token token ,
TinyExpressionTokens tinyExpressionTokens) {
builder.append("org.unlaxer.util.StringIn.match(");
List filteredChildren = token.filteredChildren;
Iterator iterator = filteredChildren.stream()
.map(_token-> StringClauseBuilder.SINGLETON.build(_token, tinyExpressionTokens))
.iterator();
while (iterator.hasNext()) {
ExpressionOrLiteral expressionOrLiteral = iterator.next();
builder.append(expressionOrLiteral.toString());
if(iterator.hasNext()) {
builder.append(",");
}
}
builder.append(")");
}
}