use of org.mybatis.generator.config.ModelType in project generator by mybatis.
the class IbatorConfigurationParser method parseIbatorContext.
private void parseIbatorContext(Configuration configuration, Node node) {
Properties attributes = parseAttributes(node);
//$NON-NLS-1$
String defaultModelType = attributes.getProperty("defaultModelType");
//$NON-NLS-1$
String targetRuntime = attributes.getProperty("targetRuntime");
String introspectedColumnImpl = attributes.getProperty(//$NON-NLS-1$
"introspectedColumnImpl");
//$NON-NLS-1$
String id = attributes.getProperty("id");
ModelType mt = defaultModelType == null ? null : ModelType.getModelType(defaultModelType);
Context context = new Context(mt);
context.setId(id);
if (stringHasValue(introspectedColumnImpl)) {
context.setIntrospectedColumnImpl(introspectedColumnImpl);
}
if (stringHasValue(targetRuntime)) {
context.setTargetRuntime(targetRuntime);
}
configuration.addContext(context);
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(context, childNode);
} else if ("ibatorPlugin".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseIbatorPlugin(context, childNode);
} else if ("commentGenerator".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseCommentGenerator(context, childNode);
} else if ("jdbcConnection".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseJdbcConnection(context, childNode);
} else if ("javaModelGenerator".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseJavaModelGenerator(context, childNode);
} else if ("javaTypeResolver".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseJavaTypeResolver(context, childNode);
} else if ("sqlMapGenerator".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseSqlMapGenerator(context, childNode);
} else if ("daoGenerator".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseDaoGenerator(context, childNode);
} else if ("table".equals(childNode.getNodeName())) {
//$NON-NLS-1$
parseTable(context, childNode);
}
}
}
use of org.mybatis.generator.config.ModelType in project generator by mybatis.
the class MyBatisGeneratorConfigurationParser method parseContext.
private void parseContext(Configuration configuration, Node node) {
Properties attributes = parseAttributes(node);
// $NON-NLS-1$
String defaultModelType = attributes.getProperty("defaultModelType");
// $NON-NLS-1$
String targetRuntime = attributes.getProperty("targetRuntime");
String introspectedColumnImpl = attributes.getProperty(// $NON-NLS-1$
"introspectedColumnImpl");
// $NON-NLS-1$
String id = attributes.getProperty("id");
ModelType mt = defaultModelType == null ? null : ModelType.getModelType(defaultModelType);
Context context = new Context(mt);
context.setId(id);
if (stringHasValue(introspectedColumnImpl)) {
context.setIntrospectedColumnImpl(introspectedColumnImpl);
}
if (stringHasValue(targetRuntime)) {
context.setTargetRuntime(targetRuntime);
}
configuration.addContext(context);
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(context, childNode);
} else if ("plugin".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parsePlugin(context, childNode);
} else if ("commentGenerator".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseCommentGenerator(context, childNode);
} else if ("jdbcConnection".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseJdbcConnection(context, childNode);
} else if ("connectionFactory".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseConnectionFactory(context, childNode);
} else if ("javaModelGenerator".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseJavaModelGenerator(context, childNode);
} else if ("javaTypeResolver".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseJavaTypeResolver(context, childNode);
} else if ("sqlMapGenerator".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseSqlMapGenerator(context, childNode);
} else if ("javaClientGenerator".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseJavaClientGenerator(context, childNode);
} else if ("table".equals(childNode.getNodeName())) {
// $NON-NLS-1$
parseTable(context, childNode);
}
}
}
Aggregations