本文整理汇总了Java中org.mybatis.generator.api.dom.java.TopLevelClass.addSuperInterface方法的典型用法代码示例。如果您正苦于以下问题:Java TopLevelClass.addSuperInterface方法的具体用法?Java TopLevelClass.addSuperInterface怎么用?Java TopLevelClass.addSuperInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mybatis.generator.api.dom.java.TopLevelClass
的用法示例。
在下文中一共展示了TopLevelClass.addSuperInterface方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeSerializable
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的package包/类
protected void makeSerializable(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
if (addGWTInterface) {
topLevelClass.addImportedType(gwtSerializable);
topLevelClass.addSuperInterface(gwtSerializable);
}
if (!suppressJavaInterface) {
topLevelClass.addImportedType(serializable);
topLevelClass.addSuperInterface(serializable);
Field field = new Field();
field.setFinal(true);
field.setInitializationString("1L"); //$NON-NLS-1$
field.setName("serialVersionUID"); //$NON-NLS-1$
field.setStatic(true);
field.setType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
field.setVisibility(JavaVisibility.PRIVATE);
context.getCommentGenerator().addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
}
}
示例2: makeSerializable
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的package包/类
protected void makeSerializable(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
if (addGWTInterface) {
topLevelClass.addImportedType(gwtSerializable);
topLevelClass.addSuperInterface(gwtSerializable);
}
if (!suppressJavaInterface) {
topLevelClass.addImportedType(serializable);
topLevelClass.addSuperInterface(serializable);
Field field = new Field();
field.setFinal(true);
field.setInitializationString("1L");
field.setName(SERIAL_VERSION_UID);
field.setStatic(true);
field.setType(new FullyQualifiedJavaType("long"));
field.setVisibility(JavaVisibility.PRIVATE);
context.getCommentGenerator().addFieldComment(field, introspectedTable);
topLevelClass.addField(field);
}
}
示例3: generateServiceImpl
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的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());
}
示例4: getTopLevelClassShell
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的package包/类
protected TopLevelClass getTopLevelClassShell() {
FullyQualifiedJavaType interfaceType = new FullyQualifiedJavaType(
introspectedTable.getDAOInterfaceType());
FullyQualifiedJavaType implementationType = new FullyQualifiedJavaType(
introspectedTable.getDAOImplementationType());
CommentGenerator commentGenerator = context.getCommentGenerator();
TopLevelClass answer = new TopLevelClass(implementationType);
answer.setVisibility(JavaVisibility.PUBLIC);
answer.setSuperClass(daoTemplate.getSuperClass());
answer.addImportedType(daoTemplate.getSuperClass());
answer.addSuperInterface(interfaceType);
answer.addImportedType(interfaceType);
for (FullyQualifiedJavaType fqjt : daoTemplate
.getImplementationImports()) {
answer.addImportedType(fqjt);
}
commentGenerator.addJavaFileComment(answer);
// add constructor from the template
answer.addMethod(daoTemplate.getConstructorClone(commentGenerator,
implementationType, introspectedTable));
// add any fields from the template
for (Field field : daoTemplate.getFieldClones(commentGenerator,
introspectedTable)) {
answer.addField(field);
}
// add any methods from the template
for (Method method : daoTemplate.getMethodClones(commentGenerator,
introspectedTable)) {
answer.addMethod(method);
}
return answer;
}