本文整理汇总了Java中org.mybatis.generator.config.JavaModelGeneratorConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java JavaModelGeneratorConfiguration类的具体用法?Java JavaModelGeneratorConfiguration怎么用?Java JavaModelGeneratorConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaModelGeneratorConfiguration类属于org.mybatis.generator.config包,在下文中一共展示了JavaModelGeneratorConfiguration类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseJavaModelGenerator
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
protected void parseJavaModelGenerator(Context context, Node node) {
JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration();
context
.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);
Properties attributes = parseAttributes(node);
String targetPackage = attributes.getProperty("targetPackage"); //$NON-NLS-1$
String targetProject = attributes.getProperty("targetProject"); //$NON-NLS-1$
javaModelGeneratorConfiguration.setTargetPackage(targetPackage);
javaModelGeneratorConfiguration.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(javaModelGeneratorConfiguration, childNode);
}
}
}
示例2: parseJavaModelGenerator
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
private void parseJavaModelGenerator(Context context, Node node) {
JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration();
context
.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);
Properties attributes = parseAttributes(node);
String targetPackage = attributes.getProperty("targetPackage"); //$NON-NLS-1$
String targetProject = attributes.getProperty("targetProject"); //$NON-NLS-1$
javaModelGeneratorConfiguration.setTargetPackage(targetPackage);
javaModelGeneratorConfiguration.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(javaModelGeneratorConfiguration, childNode);
}
}
}
示例3: parseJavaModelGenerator
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
private void parseJavaModelGenerator(Context context, Node node) {
JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration();
context.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);
Properties attributes = parseAttributes(node);
String targetPackage = attributes.getProperty("targetPackage"); //$NON-NLS-1$
String targetProject = attributes.getProperty("targetProject"); //$NON-NLS-1$
javaModelGeneratorConfiguration.setTargetPackage(targetPackage);
javaModelGeneratorConfiguration.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(javaModelGeneratorConfiguration, childNode);
}
}
}
示例4: calculateJavaModelPackage
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
/**
* Calculate java model package.
*
* @return the string
*/
protected String calculateJavaModelPackage() {
JavaModelGeneratorConfiguration config = context
.getJavaModelGeneratorConfiguration();
StringBuilder sb = new StringBuilder();
sb.append(config.getTargetPackage());
sb.append(fullyQualifiedTable.getSubPackageForModel(isSubPackagesEnabled(config)));
return sb.toString();
}
示例5: initialized
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
/**
* 初始化阶段
* 具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html
*
* @param introspectedTable
*/
@Override
public void initialized(IntrospectedTable introspectedTable) {
String exampleType = introspectedTable.getExampleType();
// 修改包名
Context context = getContext();
JavaModelGeneratorConfiguration configuration = context.getJavaModelGeneratorConfiguration();
String targetPackage = configuration.getTargetPackage();
String newExampleType = exampleType.replace(targetPackage, this.targetPackage);
introspectedTable.setExampleType(newExampleType);
logger.debug("itfsw(Example 目标包修改插件):修改"+introspectedTable.getExampleType()+"的包到"+this.targetPackage);
}
示例6: setDomainObjectName
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
/**
* 设置DomainObjectName和MapperName
*
* @param introspectedTable
* @param context
* @param domainObjectName
*/
public static void setDomainObjectName(IntrospectedTable introspectedTable, Context context, String domainObjectName) throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
// 配置信息(没啥用)
introspectedTable.getTableConfiguration().setDomainObjectName(domainObjectName);
// FullyQualifiedTable修正
Field domainObjectNameField = FullyQualifiedTable.class.getDeclaredField("domainObjectName");
domainObjectNameField.setAccessible(true);
domainObjectNameField.set(introspectedTable.getFullyQualifiedTable(), domainObjectName);
// 重新修正introspectedTable属性信息
Method calculateJavaClientAttributes = IntrospectedTable.class.getDeclaredMethod("calculateJavaClientAttributes");
calculateJavaClientAttributes.setAccessible(true);
calculateJavaClientAttributes.invoke(introspectedTable);
Method calculateModelAttributes = IntrospectedTable.class.getDeclaredMethod("calculateModelAttributes");
calculateModelAttributes.setAccessible(true);
calculateModelAttributes.invoke(introspectedTable);
Method calculateXmlAttributes = IntrospectedTable.class.getDeclaredMethod("calculateXmlAttributes");
calculateXmlAttributes.setAccessible(true);
calculateXmlAttributes.invoke(introspectedTable);
// 注意!! 如果配置了ExampleTargetPlugin插件,要修正Example 位置
PluginConfiguration configuration = PluginTools.getPluginConfiguration(context, ExampleTargetPlugin.class);
if (configuration != null && configuration.getProperty(ExampleTargetPlugin.PRO_TARGET_PACKAGE) != null) {
String exampleType = introspectedTable.getExampleType();
// 修改包名
JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = context.getJavaModelGeneratorConfiguration();
String targetPackage = javaModelGeneratorConfiguration.getTargetPackage();
String newExampleType = exampleType.replace(targetPackage, configuration.getProperty(ExampleTargetPlugin.PRO_TARGET_PACKAGE));
introspectedTable.setExampleType(newExampleType);
}
}
示例7: calculateJavaModelPackage
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
/**
* Calculate java model package.
*
* @return the string
*/
protected String calculateJavaModelPackage() {
JavaModelGeneratorConfiguration config = context
.getJavaModelGeneratorConfiguration();
StringBuilder sb = new StringBuilder();
sb.append(config.getTargetPackage());
sb.append(fullyQualifiedTable.getSubPackage(isSubPackagesEnabled(config)));
return sb.toString();
}
示例8: calculateJavaModelPackage
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
protected String calculateJavaModelPackage() {
JavaModelGeneratorConfiguration config = context
.getJavaModelGeneratorConfiguration();
StringBuilder sb = new StringBuilder();
sb.append(config.getTargetPackage());
sb.append(fullyQualifiedTable.getSubPackage(isSubPackagesEnabled(config)));
return sb.toString();
}
示例9: calculateJavaModelPackage
import org.mybatis.generator.config.JavaModelGeneratorConfiguration; //导入依赖的package包/类
protected String calculateJavaModelPackage() {
JavaModelGeneratorConfiguration config = context.getJavaModelGeneratorConfiguration();
StringBuilder sb = new StringBuilder();
sb.append(config.getTargetPackage());
if (isTrue(config.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES))) {
sb.append(fullyQualifiedTable.getSubPackage());
}
return sb.toString();
}