cn.tenmg.dsl.macro.ElseIf Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl Show documentation
Show all versions of dsl Show documentation
动态脚本语言(DSL,Dynamic Script Language)解析框架。可广泛用于动态 SQL(即
DSQL)等场景的解析,DSQL 也是目前 DSL 最成功的应用领域,具体包括 Flink SQL(如 Clink)、Spark SQL(如
sparktool)和 JDBC(如 sqltool)。
package cn.tenmg.dsl.macro;
import java.util.Map;
import cn.tenmg.dsl.DSLContext;
import cn.tenmg.dsl.EvalEngine;
/**
* else if判断宏
*
* @author June [email protected]
*
* @since 1.0.0
*/
public class ElseIf extends If {
@Override
boolean excute(EvalEngine evalEngine, DSLContext context, Map attributes, String logic,
StringBuilder dslf) throws Exception {
if (Boolean.TRUE.equals(attributes.get("if"))) {// if成立,则else if不成立
dslf.setLength(0);
return false;
} else {// 否则,继续当做if处理
return super.excute(evalEngine, context, attributes, logic, dslf);
}
}
}