Search in sources :

Example 1 with GenericTokenParser

use of org.apache.ibatis.parsing.GenericTokenParser in project mybatis-3 by mybatis.

the class SqlSourceBuilder method parse.

public SqlSource parse(String originalSql, Class<?> parameterType, Map<String, Object> additionalParameters) {
    ParameterMappingTokenHandler handler = new ParameterMappingTokenHandler(configuration, parameterType, additionalParameters);
    GenericTokenParser parser = new GenericTokenParser("#{", "}", handler);
    String sql = parser.parse(originalSql);
    return new StaticSqlSource(configuration, sql, handler.getParameterMappings());
}
Also used : GenericTokenParser(org.apache.ibatis.parsing.GenericTokenParser)

Example 2 with GenericTokenParser

use of org.apache.ibatis.parsing.GenericTokenParser in project mybatis-3 by mybatis.

the class TextSqlNode method apply.

@Override
public boolean apply(DynamicContext context) {
    GenericTokenParser parser = createParser(new BindingTokenParser(context, injectionFilter));
    context.appendSql(parser.parse(text));
    return true;
}
Also used : GenericTokenParser(org.apache.ibatis.parsing.GenericTokenParser)

Example 3 with GenericTokenParser

use of org.apache.ibatis.parsing.GenericTokenParser in project mybatis-3 by mybatis.

the class VelocitySqlSourceBuilder method parse.

public SqlSource parse(String originalSql, Class<?> parameterType) {
    ParameterMappingTokenHandler handler = new ParameterMappingTokenHandler(configuration, parameterType);
    GenericTokenParser parser = new GenericTokenParser("@{", "}", handler);
    String sql = parser.parse(originalSql);
    return new StaticSqlSource(configuration, sql, handler.getParameterMappings());
}
Also used : StaticSqlSource(org.apache.ibatis.builder.StaticSqlSource) GenericTokenParser(org.apache.ibatis.parsing.GenericTokenParser)

Example 4 with GenericTokenParser

use of org.apache.ibatis.parsing.GenericTokenParser in project mybatis-3 by mybatis.

the class TextSqlNode method isDynamic.

public boolean isDynamic() {
    DynamicCheckerTokenParser checker = new DynamicCheckerTokenParser();
    GenericTokenParser parser = createParser(checker);
    parser.parse(text);
    return checker.isDynamic();
}
Also used : GenericTokenParser(org.apache.ibatis.parsing.GenericTokenParser)

Aggregations

GenericTokenParser (org.apache.ibatis.parsing.GenericTokenParser)4 StaticSqlSource (org.apache.ibatis.builder.StaticSqlSource)1