Search in sources :

Example 1 with SqlMapGeneratorConfiguration

use of org.mybatis.generator.config.SqlMapGeneratorConfiguration in project generator by mybatis.

the class IntrospectedTable method calculateSqlMapPackage.

/**
     * Calculate sql map package.
     *
     * @return the string
     */
protected String calculateSqlMapPackage() {
    StringBuilder sb = new StringBuilder();
    SqlMapGeneratorConfiguration config = context.getSqlMapGeneratorConfiguration();
    // config can be null if the Java client does not require XML
    if (config != null) {
        sb.append(config.getTargetPackage());
        sb.append(fullyQualifiedTable.getSubPackageForClientOrSqlMap(isSubPackagesEnabled(config)));
        if (stringHasValue(tableConfiguration.getMapperName())) {
            String mapperName = tableConfiguration.getMapperName();
            int ind = mapperName.lastIndexOf('.');
            if (ind != -1) {
                sb.append('.').append(mapperName.substring(0, ind));
            }
        }
    }
    return sb.toString();
}
Also used : SqlMapGeneratorConfiguration(org.mybatis.generator.config.SqlMapGeneratorConfiguration)

Example 2 with SqlMapGeneratorConfiguration

use of org.mybatis.generator.config.SqlMapGeneratorConfiguration in project generator by mybatis.

the class MyBatisGeneratorConfigurationParser method parseSqlMapGenerator.

protected void parseSqlMapGenerator(Context context, Node node) {
    SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration = new SqlMapGeneratorConfiguration();
    context.setSqlMapGeneratorConfiguration(sqlMapGeneratorConfiguration);
    Properties attributes = parseAttributes(node);
    //$NON-NLS-1$
    String targetPackage = attributes.getProperty("targetPackage");
    //$NON-NLS-1$
    String targetProject = attributes.getProperty("targetProject");
    sqlMapGeneratorConfiguration.setTargetPackage(targetPackage);
    sqlMapGeneratorConfiguration.setTargetProject(targetProject);
    NodeList nodeList = node.getChildNodes();
    for (int i = 0; i < nodeList.getLength(); i++) {
        Node childNode = nodeList.item(i);
        if (childNode.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }
        if ("property".equals(childNode.getNodeName())) {
            //$NON-NLS-1$
            parseProperty(sqlMapGeneratorConfiguration, childNode);
        }
    }
}
Also used : SqlMapGeneratorConfiguration(org.mybatis.generator.config.SqlMapGeneratorConfiguration) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Messages.getString(org.mybatis.generator.internal.util.messages.Messages.getString) Properties(java.util.Properties)

Aggregations

SqlMapGeneratorConfiguration (org.mybatis.generator.config.SqlMapGeneratorConfiguration)2 Properties (java.util.Properties)1 Messages.getString (org.mybatis.generator.internal.util.messages.Messages.getString)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1