本文整理汇总了Java中org.mybatis.generator.api.dom.DefaultJavaFormatter类的典型用法代码示例。如果您正苦于以下问题:Java DefaultJavaFormatter类的具体用法?Java DefaultJavaFormatter怎么用?Java DefaultJavaFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultJavaFormatter类属于org.mybatis.generator.api.dom包,在下文中一共展示了DefaultJavaFormatter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateService
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
private GeneratedJavaFile generateService(IntrospectedTable table) {
// 获取实体类型
FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(table.getBaseRecordType());
// 获取主键类型
FullyQualifiedJavaType primaryType = table.getPrimaryKeyColumns().get(0).getFullyQualifiedJavaType();
// 生成 Service 名称
String service = targetPackage + "." + table.getFullyQualifiedTable().getDomainObjectName() + "Service";
// 构造 Service 文件
Interface interfaze = new Interface(new FullyQualifiedJavaType(service));
// 设置作用域
interfaze.setVisibility(JavaVisibility.PUBLIC);
// import
interfaze.addImportedType(new FullyQualifiedJavaType(baseService));
interfaze.addImportedType(entityType);
interfaze.addSuperInterface(new FullyQualifiedJavaType(
baseService + "<" + entityType.getShortName() + "," + primaryType.getShortName() + ">"));
ElementHelper.addAuthorTag(interfaze, false);
return new GeneratedJavaFile(interfaze, targetProject, new DefaultJavaFormatter());
}
开发者ID:drtrang,项目名称:mybatis-generator-extension,代码行数:20,代码来源:ServicePlugin.java
示例2: generateServiceImpl
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
private GeneratedJavaFile generateServiceImpl(IntrospectedTable table) {
FullyQualifiedJavaType entityType = new FullyQualifiedJavaType(table.getBaseRecordType());
FullyQualifiedJavaType primaryType = table.getPrimaryKeyColumns().get(0).getFullyQualifiedJavaType();
String domainObjectName = table.getFullyQualifiedTable().getDomainObjectName();
String service = targetPackage + "." + domainObjectName + "Service";
String serviceImpl = targetPackage + ".impl." + domainObjectName + "ServiceImpl";
TopLevelClass clazz = new TopLevelClass(new FullyQualifiedJavaType(serviceImpl));
clazz.addImportedType(new FullyQualifiedJavaType(baseServiceImpl));
clazz.addImportedType(entityType);
clazz.addImportedType(new FullyQualifiedJavaType(service));
clazz.addImportedType(new FullyQualifiedJavaType("org.springframework.stereotype.Service"));
clazz.addAnnotation("@Service(\"" + firstLetterLowerCase(domainObjectName + "Service") + "\")");
clazz.setVisibility(JavaVisibility.PUBLIC);
clazz.setSuperClass(new FullyQualifiedJavaType(
baseServiceImpl + "<" + entityType.getShortName() + "," + primaryType.getShortName() + ">"));
clazz.addSuperInterface(new FullyQualifiedJavaType(service));
ElementHelper.addAuthorTag(clazz, false);
return new GeneratedJavaFile(clazz, targetProject, new DefaultJavaFormatter());
}
开发者ID:drtrang,项目名称:mybatis-generator-extension,代码行数:20,代码来源:ServicePlugin.java
示例3: createJavaFormatter
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
/**
* Creates a new Object object.
*
* @param context
* the context
* @return the java formatter
*/
public static JavaFormatter createJavaFormatter(Context context) {
String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER);
if (!stringHasValue(type)) {
type = DefaultJavaFormatter.class.getName();
}
JavaFormatter answer = (JavaFormatter) createInternalObject(type);
answer.setContext(context);
return answer;
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:20,代码来源:ObjectFactory.java
示例4: testReqularInterface
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
@Test
public void testReqularInterface() {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("org.mybatis.test.TestInterface");
Interface ifc = new Interface(fqjt);
JavaFormatter jf = new DefaultJavaFormatter();
GeneratedJavaFile gjf = new GeneratedJavaFile(ifc, "src", jf);
assertEquals("TestInterface.java", gjf.getFileName());
assertEquals("org.mybatis.test", gjf.getTargetPackage());
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:11,代码来源:GeneratedJavaFileTest.java
示例5: testGenericInterface
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
@Test
public void testGenericInterface() {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("org.mybatis.test.TestInterface");
fqjt.addTypeArgument(new FullyQualifiedJavaType("T"));
Interface ifc = new Interface(fqjt);
JavaFormatter jf = new DefaultJavaFormatter();
GeneratedJavaFile gjf = new GeneratedJavaFile(ifc, "src", jf);
assertEquals("TestInterface.java", gjf.getFileName());
assertEquals("org.mybatis.test", gjf.getTargetPackage());
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:12,代码来源:GeneratedJavaFileTest.java
示例6: createJavaFormatter
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
/**
* Creates a new Object object.
*
* @param context
* the context
* @return the java formatter
*/
public static JavaFormatter createJavaFormatter(Context context) {
String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER);
if (!StringUtility.stringHasValue(type)) {
type = DefaultJavaFormatter.class.getName();
}
JavaFormatter answer = (JavaFormatter) createInternalObject(type);
answer.setContext(context);
return answer;
}
开发者ID:backkoms,项目名称:mybatis-generator-comments,代码行数:20,代码来源:ObjectFactory.java
示例7: createJavaFormatter
import org.mybatis.generator.api.dom.DefaultJavaFormatter; //导入依赖的package包/类
public static JavaFormatter createJavaFormatter(Context context) {
String type = context.getProperty(PropertyRegistry.CONTEXT_JAVA_FORMATTER);
if (!StringUtility.stringHasValue(type)) {
type = DefaultJavaFormatter.class.getName();
}
JavaFormatter answer = (JavaFormatter) createInternalObject(type);
answer.setContext(context);
return answer;
}
开发者ID:funny5258,项目名称:autocode,代码行数:13,代码来源:ObjectFactory.java
注:本文中的org.mybatis.generator.api.dom.DefaultJavaFormatter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论