本文整理汇总了Java中org.mybatis.generator.api.dom.java.Interface类的典型用法代码示例。如果您正苦于以下问题:Java Interface类的具体用法?Java Interface怎么用?Java Interface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Interface类属于org.mybatis.generator.api.dom.java包,在下文中一共展示了Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInterfaceElements
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
importedTypes.add(fqjt);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
method.setName(introspectedTable.getCountByExampleStatementId());
method.addParameter(new Parameter(fqjt, "example")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientCountByExampleMethodGenerated(method,
interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例2: addInterfaceElements
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType parameterType = new FullyQualifiedJavaType(
introspectedTable.getBaseRecordType());
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable.getUpdateByPrimaryKeyStatementId());
method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(interfaze, method);
if (context.getPlugins()
.clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method,
interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例3: addInterfaceElements
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType type = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
importedTypes.add(type);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable.getDeleteByExampleStatementId());
method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientDeleteByExampleMethodGenerated(
method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例4: addExtraImports
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addExtraImports(Interface interfaze) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.type.JdbcType")); //$NON-NLS-1$
if (introspectedTable.isConstructorBased()) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Arg")); //$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.ConstructorArgs")); //$NON-NLS-1$
} else {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Result")); //$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Results")); //$NON-NLS-1$
}
}
示例5: clientInsertSelectiveMethodGenerated
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
public boolean clientInsertSelectiveMethodGenerated(Method method,
Interface interfaze, IntrospectedTable introspectedTable) {
boolean rc = true;
for (Plugin plugin : plugins) {
if (!plugin.clientInsertSelectiveMethodGenerated(method, interfaze,
introspectedTable)) {
rc = false;
break;
}
}
return rc;
}
示例6: clientSelectByExampleWithoutBLOBsMethodGenerated
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public boolean clientSelectByExampleWithoutBLOBsMethodGenerated(
Method method, Interface interfaze,
IntrospectedTable introspectedTable) {
if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) {
copyAndAddMethod(method, interfaze);
}
return true;
}
示例7: addExtraImports
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addExtraImports(Interface interfaze) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.SelectProvider")); //$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.type.JdbcType")); //$NON-NLS-1$
if (introspectedTable.isConstructorBased()) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Arg")); //$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.ConstructorArgs")); //$NON-NLS-1$
} else {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Result")); //$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Results")); //$NON-NLS-1$
}
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:14,代码来源:AnnotatedSelectByExampleWithBLOBsMethodGenerator.java
示例8: initializeAndExecuteGenerator
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
protected void initializeAndExecuteGenerator(
AbstractDAOElementGenerator methodGenerator,
TopLevelClass topLevelClass, Interface interfaze) {
methodGenerator.setDAOTemplate(daoTemplate);
methodGenerator.setContext(context);
methodGenerator.setIntrospectedTable(introspectedTable);
methodGenerator.setProgressCallback(progressCallback);
methodGenerator.setWarnings(warnings);
methodGenerator.addImplementationElements(topLevelClass);
methodGenerator.addInterfaceElements(interfaze);
}
示例9: addSelectByExampleWithoutBLOBsMethod
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
protected void addSelectByExampleWithoutBLOBsMethod(Interface interfaze) {
if (introspectedTable.getRules().generateSelectByExampleWithoutBLOBs()) {
AbstractJavaMapperMethodGenerator methodGenerator = new AnnotatedSelectByExampleWithoutBLOBsMethodGenerator();
initializeAndExecuteGenerator(methodGenerator, interfaze);
}
}
示例10: addInterfaceElements
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(introspectedTable
.getUpdateByExampleSelectiveStatementId());
FullyQualifiedJavaType parameterType =
introspectedTable.getRules().calculateAllFieldsClass();
method.addParameter(new Parameter(parameterType,
"record", "@Param(\"record\")")); //$NON-NLS-1$ //$NON-NLS-2$
importedTypes.add(parameterType);
FullyQualifiedJavaType exampleType = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
method.addParameter(new Parameter(exampleType,
"example", "@Param(\"example\")")); //$NON-NLS-1$ //$NON-NLS-2$
importedTypes.add(exampleType);
importedTypes.add(new FullyQualifiedJavaType(
"org.apache.ibatis.annotations.Param")); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
addMapperAnnotations(interfaze, method);
if (context.getPlugins()
.clientUpdateByExampleSelectiveMethodGenerated(method, interfaze,
introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
示例11: addUpdateByPrimaryKeyWithoutBLOBsMethod
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
protected void addUpdateByPrimaryKeyWithoutBLOBsMethod(Interface interfaze) {
if (introspectedTable.getRules()
.generateUpdateByPrimaryKeyWithoutBLOBs()) {
AbstractJavaMapperMethodGenerator methodGenerator = new AnnotatedUpdateByPrimaryKeyWithoutBLOBsMethodGenerator(false);
initializeAndExecuteGenerator(methodGenerator, interfaze);
}
}
示例12: addExtraImports
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
@Override
public void addExtraImports(Interface interfaze) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Select")); //$NON-NLS-1$
if (useResultMapIfAvailable) {
if (introspectedTable.getRules().generateBaseResultMap()
|| introspectedTable.getRules().generateResultMapWithBLOBs()) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.ResultMap")); //$NON-NLS-1$
} else {
addAnnotationImports(interfaze);
}
} else {
addAnnotationImports(interfaze);
}
}
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:16,代码来源:AnnotatedSelectByPrimaryKeyMethodGenerator.java
示例13: addUpdateByExampleWithoutBLOBsMethod
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
protected void addUpdateByExampleWithoutBLOBsMethod(
TopLevelClass topLevelClass, Interface interfaze) {
if (introspectedTable.getRules().generateUpdateByExampleWithoutBLOBs()) {
AbstractDAOElementGenerator methodGenerator = new UpdateByExampleWithoutBLOBsMethodGenerator();
initializeAndExecuteGenerator(methodGenerator, topLevelClass,
interfaze);
}
}
示例14: copyAndAddMethod
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的package包/类
/**
* Use the method copy constructor to create a new method, then
* add the rowBounds parameter.
*
* @param fullyQualifiedTable
* @param method
*/
private void copyAndAddMethod(Method method, Interface interfaze) {
Method newMethod = new Method(method);
newMethod.setName(method.getName() + "WithRowbounds"); //$NON-NLS-1$
newMethod.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
interfaze.addMethod(newMethod);
interfaze.addImportedType(rowBounds);
}
示例15: testGenericInterface
import org.mybatis.generator.api.dom.java.Interface; //导入依赖的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());
}