use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class InsertSelectiveMethodGenerator method addInterfaceElements.
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = new Method();
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setVisibility(JavaVisibility.PUBLIC);
method.setName(introspectedTable.getInsertSelectiveStatementId());
FullyQualifiedJavaType parameterType = introspectedTable.getRules().calculateAllFieldsClass();
importedTypes.add(parameterType);
//$NON-NLS-1$
method.addParameter(new Parameter(parameterType, "record"));
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientInsertSelectiveMethodGenerated(method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class SelectByExampleWithBLOBsMethodGenerator method addInterfaceElements.
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
FullyQualifiedJavaType type = new FullyQualifiedJavaType(introspectedTable.getExampleType());
importedTypes.add(type);
importedTypes.add(FullyQualifiedJavaType.getNewListInstance());
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
FullyQualifiedJavaType returnType = FullyQualifiedJavaType.getNewListInstance();
FullyQualifiedJavaType listType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
listType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
// the blob fields must be rolled up into the base class
listType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
importedTypes.add(listType);
returnType.addTypeArgument(listType);
method.setReturnType(returnType);
method.setName(introspectedTable.getSelectByExampleWithBLOBsStatementId());
//$NON-NLS-1$
method.addParameter(new Parameter(type, "example"));
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
addMapperAnnotations(interfaze, method);
if (context.getPlugins().clientSelectByExampleWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class UpdateByExampleSelectiveMethodGenerator method addInterfaceElements.
@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", //$NON-NLS-1$ //$NON-NLS-2$
"@Param(\"record\")"));
importedTypes.add(parameterType);
FullyQualifiedJavaType exampleType = new FullyQualifiedJavaType(introspectedTable.getExampleType());
method.addParameter(new Parameter(exampleType, "example", //$NON-NLS-1$ //$NON-NLS-2$
"@Param(\"example\")"));
importedTypes.add(exampleType);
importedTypes.add(new FullyQualifiedJavaType(//$NON-NLS-1$
"org.apache.ibatis.annotations.Param"));
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientUpdateByExampleSelectiveMethodGenerated(method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class UpdateByExampleWithBLOBsMethodGenerator method addInterfaceElements.
@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.getUpdateByExampleWithBLOBsStatementId());
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
method.addParameter(new Parameter(parameterType, "record", //$NON-NLS-1$ //$NON-NLS-2$
"@Param(\"record\")"));
importedTypes.add(parameterType);
FullyQualifiedJavaType exampleType = new FullyQualifiedJavaType(introspectedTable.getExampleType());
method.addParameter(new Parameter(exampleType, "example", //$NON-NLS-1$ //$NON-NLS-2$
"@Param(\"example\")"));
importedTypes.add(exampleType);
importedTypes.add(new FullyQualifiedJavaType(//$NON-NLS-1$
"org.apache.ibatis.annotations.Param"));
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientUpdateByExampleWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class UpdateByExampleWithoutBLOBsMethodGenerator method addInterfaceElements.
@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.getUpdateByExampleStatementId());
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateBaseRecordClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getPrimaryKeyType());
}
method.addParameter(new Parameter(parameterType, "record", //$NON-NLS-1$ //$NON-NLS-2$
"@Param(\"record\")"));
importedTypes.add(parameterType);
FullyQualifiedJavaType exampleType = new FullyQualifiedJavaType(introspectedTable.getExampleType());
method.addParameter(new Parameter(exampleType, "example", //$NON-NLS-1$ //$NON-NLS-2$
"@Param(\"example\")"));
importedTypes.add(exampleType);
importedTypes.add(new FullyQualifiedJavaType(//$NON-NLS-1$
"org.apache.ibatis.annotations.Param"));
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
addMapperAnnotations(method);
if (context.getPlugins().clientUpdateByExampleWithoutBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
addExtraImports(interfaze);
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
Aggregations