本文整理汇总了Java中org.mybatis.generator.api.dom.java.Method类的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于org.mybatis.generator.api.dom.java包,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addImplementationElements
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
StringBuilder sb = new StringBuilder();
sb.append("int rows = "); //$NON-NLS-1$
sb.append(daoTemplate.getDeleteMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getDeleteByExampleStatementId(), "example")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
method.addBodyLine("return rows;"); //$NON-NLS-1$
if (context.getPlugins().clientDeleteByExampleMethodGenerated(
method, topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例2: addImplementationElements
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
method
.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
StringBuilder sb = new StringBuilder();
sb.append("int rows = "); //$NON-NLS-1$
sb.append(daoTemplate.getUpdateMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getUpdateByExampleSelectiveStatementId(), "parms")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
method.addBodyLine("return rows;"); //$NON-NLS-1$
if (context.getPlugins()
.clientUpdateByExampleSelectiveMethodGenerated(method,
topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例3: addImplementationElements
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (generateForJava5) {
method.addSuppressTypeWarningsAnnotation();
}
StringBuilder sb = new StringBuilder();
sb.append(method.getReturnType().getShortName());
sb.append(" list = "); //$NON-NLS-1$
sb.append(daoTemplate.getQueryForListMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getSelectByExampleStatementId(), "example")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
method.addBodyLine("return list;"); //$NON-NLS-1$
if (context.getPlugins()
.clientSelectByExampleWithoutBLOBsMethodGenerated(method,
topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例4: addImplementationElements
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
method
.addBodyLine("UpdateByExampleParms parms = new UpdateByExampleParms(record, example);"); //$NON-NLS-1$
StringBuilder sb = new StringBuilder();
sb.append("int rows = "); //$NON-NLS-1$
sb.append(daoTemplate.getUpdateMethod(introspectedTable
.getIbatis2SqlMapNamespace(), introspectedTable
.getUpdateByExampleStatementId(), "parms")); //$NON-NLS-1$
method.addBodyLine(sb.toString());
method.addBodyLine("return rows;"); //$NON-NLS-1$
if (context.getPlugins()
.clientUpdateByExampleWithoutBLOBsMethodGenerated(method,
topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
示例5: addGeneratedKeyAnnotation
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
protected void addGeneratedKeyAnnotation(Method method, GeneratedKey gk) {
StringBuilder sb = new StringBuilder();
IntrospectedColumn introspectedColumn = introspectedTable.getColumn(gk.getColumn());
if (introspectedColumn != null) {
if (gk.isJdbcStandard()) {
sb.append("@Options(useGeneratedKeys=true,keyProperty=\""); //$NON-NLS-1$
sb.append(introspectedColumn.getJavaProperty());
sb.append("\")"); //$NON-NLS-1$
method.addAnnotation(sb.toString());
} else {
FullyQualifiedJavaType fqjt = introspectedColumn.getFullyQualifiedJavaType();
sb.append("@SelectKey(statement=\""); //$NON-NLS-1$
sb.append(gk.getRuntimeSqlStatement());
sb.append("\", keyProperty=\""); //$NON-NLS-1$
sb.append(introspectedColumn.getJavaProperty());
sb.append("\", before="); //$NON-NLS-1$
sb.append(gk.isIdentity() ? "false" : "true"); //$NON-NLS-1$ //$NON-NLS-2$
sb.append(", resultType="); //$NON-NLS-1$
sb.append(fqjt.getShortName());
sb.append(".class)"); //$NON-NLS-1$
method.addAnnotation(sb.toString());
}
}
}
示例6: addGeneralMethodComment
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
public void addGeneralMethodComment(Method method,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
method.addJavaDocLine("/**"); //$NON-NLS-1$
method
.addJavaDocLine(" * This method was generated by MyBatis Generator."); //$NON-NLS-1$
sb.append(" * This method corresponds to the database table "); //$NON-NLS-1$
sb.append(introspectedTable.getFullyQualifiedTable());
method.addJavaDocLine(sb.toString());
addJavadocTag(method, false);
method.addJavaDocLine(" */"); //$NON-NLS-1$
}
示例7: getMethodShell
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType type = new FullyQualifiedJavaType(
introspectedTable.getExampleType());
importedTypes.add(type);
Method method = new Method();
method.setVisibility(getExampleMethodVisibility());
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(getDAOMethodNameCalculator()
.getDeleteByExampleMethodName(introspectedTable));
method.addParameter(new Parameter(type, "example")); //$NON-NLS-1$
for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
method.addException(fqjt);
importedTypes.add(fqjt);
}
context.getCommentGenerator().addGeneralMethodComment(method,
introspectedTable);
return method;
}
示例8: AbstractDAOTemplate
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
/**
* Instantiates a new abstract dao template.
*/
public AbstractDAOTemplate() {
super();
interfaceImports = new ArrayList<FullyQualifiedJavaType>();
implementationImports = new ArrayList<FullyQualifiedJavaType>();
fields = new ArrayList<Field>();
methods = new ArrayList<Method>();
checkedExceptions = new ArrayList<FullyQualifiedJavaType>();
configured = false;
}
示例9: addInterfaceElements
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (context.getPlugins().clientSelectByPrimaryKeyMethodGenerated(
method, interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:12,代码来源:SelectByPrimaryKeyMethodGenerator.java
示例10: clientUpdateByExampleWithBLOBsMethodGenerated
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public boolean clientUpdateByExampleWithBLOBsMethodGenerated(Method method,
Interface interfaze, IntrospectedTable introspectedTable) {
boolean rc = true;
for (Plugin plugin : plugins) {
if (!plugin.clientUpdateByExampleWithBLOBsMethodGenerated(method,
interfaze, introspectedTable)) {
rc = false;
break;
}
}
return rc;
}
示例11: addDefaultConstructor
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
protected void addDefaultConstructor(TopLevelClass topLevelClass) {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setConstructor(true);
method.setName(topLevelClass.getType().getShortName());
method.addBodyLine("super();"); //$NON-NLS-1$
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
topLevelClass.addMethod(method);
}
示例12: addMapperAnnotations
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public void addMapperAnnotations(Method method) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
StringBuilder sb = new StringBuilder();
sb.append("@UpdateProvider(type="); //$NON-NLS-1$
sb.append(fqjt.getShortName());
sb.append(".class, method=\""); //$NON-NLS-1$
sb.append(introspectedTable.getUpdateByPrimaryKeySelectiveStatementId());
sb.append("\")"); //$NON-NLS-1$
method.addAnnotation(sb.toString());
}
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:13,代码来源:AnnotatedUpdateByPrimaryKeySelectiveMethodGenerator.java
示例13: providerSelectByExampleWithBLOBsMethodGenerated
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
public boolean providerSelectByExampleWithBLOBsMethodGenerated(
Method method, TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
boolean rc = true;
for (Plugin plugin : plugins) {
if (!plugin.providerSelectByExampleWithBLOBsMethodGenerated(method,
topLevelClass, introspectedTable)) {
rc = false;
break;
}
}
return rc;
}
示例14: clientSelectByExampleWithBLOBsMethodGenerated
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
@Override
public boolean clientSelectByExampleWithBLOBsMethodGenerated(Method method,
Interface interfaze, IntrospectedTable introspectedTable) {
boolean rc = true;
for (Plugin plugin : plugins) {
if (!plugin.clientSelectByExampleWithBLOBsMethodGenerated(method,
interfaze, introspectedTable)) {
rc = false;
break;
}
}
return rc;
}
示例15: clientUpdateByExampleSelectiveMethodGenerated
import org.mybatis.generator.api.dom.java.Method; //导入依赖的package包/类
public boolean clientUpdateByExampleSelectiveMethodGenerated(Method method,
Interface interfaze, IntrospectedTable introspectedTable) {
boolean rc = true;
for (Plugin plugin : plugins) {
if (!plugin.clientUpdateByExampleSelectiveMethodGenerated(method,
interfaze, introspectedTable)) {
rc = false;
break;
}
}
return rc;
}