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();
}
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);
}
}
}
Aggregations