com.jfplugin.xsql.statement.TextStatement Maven / Gradle / Ivy
The newest version!
package com.jfplugin.xsql.statement;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.w3c.dom.Node;
import com.jfplugin.xsql.core.Context;
import com.jfplugin.xsql.core.VarParser;
/**
* 文本节点
* @author farmer
*
*/
public class TextStatement extends Statement{
static class Var{
int start;
int end;
String text;
}
/**变量正则*/
private static final String VAR_REG = "#\\{([^\\{\\}])+\\}";
/**常量正则*/
private static final String CONST_REG = "\\$\\{([^\\\\{\\\\}])+\\}";
private static final Pattern VAR_PATTERN = Pattern.compile(VAR_REG);
private static final Pattern CONST_PATTERN = Pattern.compile(CONST_REG);
public TextStatement(Node node) {
super(node);
}
@Override
public void execute(Context ctx, Object localVar) {
List vars = new ArrayList();
List