Search in sources :

Example 1 with XMLMapperEntityResolver

use of org.apache.ibatis.builder.xml.XMLMapperEntityResolver in project mybatis-3 by mybatis.

the class XMLLanguageDriver method createSqlSource.

@Override
public SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterType) {
    // issue #3
    if (script.startsWith("<script>")) {
        XPathParser parser = new XPathParser(script, false, configuration.getVariables(), new XMLMapperEntityResolver());
        return createSqlSource(configuration, parser.evalNode("/script"), parameterType);
    } else {
        // issue #127
        script = PropertyParser.parse(script, configuration.getVariables());
        TextSqlNode textSqlNode = new TextSqlNode(script);
        if (textSqlNode.isDynamic()) {
            return new DynamicSqlSource(configuration, textSqlNode);
        } else {
            return new RawSqlSource(configuration, script, parameterType);
        }
    }
}
Also used : XMLMapperEntityResolver(org.apache.ibatis.builder.xml.XMLMapperEntityResolver) XPathParser(org.apache.ibatis.parsing.XPathParser) RawSqlSource(org.apache.ibatis.scripting.defaults.RawSqlSource)

Aggregations

XMLMapperEntityResolver (org.apache.ibatis.builder.xml.XMLMapperEntityResolver)1 XPathParser (org.apache.ibatis.parsing.XPathParser)1 RawSqlSource (org.apache.ibatis.scripting.defaults.RawSqlSource)1