use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class UpdateByPrimaryKeyWithBLOBsMethodGenerator method getMethodShell.
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeyWithBLOBsMethodName(introspectedTable));
//$NON-NLS-1$
method.addParameter(new Parameter(parameterType, "record"));
for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
method.addException(fqjt);
importedTypes.add(fqjt);
}
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
return method;
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class AbstractDAOTemplate method getMethodClones.
/**
* Gets the method clones.
*
* @param commentGenerator
* the comment generator
* @param introspectedTable
* the introspected table
* @return the method clones
*/
public final List<Method> getMethodClones(CommentGenerator commentGenerator, IntrospectedTable introspectedTable) {
configure();
List<Method> answer = new ArrayList<Method>();
for (Method oldMethod : methods) {
Method method = new Method();
for (String bodyLine : oldMethod.getBodyLines()) {
method.addBodyLine(bodyLine);
}
for (FullyQualifiedJavaType fqjt : oldMethod.getExceptions()) {
method.addException(fqjt);
}
for (Parameter parm : oldMethod.getParameters()) {
method.addParameter(parm);
}
method.setConstructor(oldMethod.isConstructor());
method.setFinal(oldMethod.isFinal());
method.setStatic(oldMethod.isStatic());
method.setName(oldMethod.getName());
method.setReturnType(oldMethod.getReturnType());
method.setVisibility(oldMethod.getVisibility());
commentGenerator.addGeneralMethodComment(method, introspectedTable);
answer.add(method);
}
return answer;
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class AbstractDAOTemplate method getConstructorClone.
/**
* Gets the constructor clone.
*
* @param commentGenerator
* the comment generator
* @param type
* the type
* @param introspectedTable
* the introspected table
* @return the constructor clone
*/
public final Method getConstructorClone(CommentGenerator commentGenerator, FullyQualifiedJavaType type, IntrospectedTable introspectedTable) {
configure();
Method answer = new Method();
answer.setConstructor(true);
answer.setName(type.getShortName());
answer.setVisibility(constructorTemplate.getVisibility());
for (Parameter parm : constructorTemplate.getParameters()) {
answer.addParameter(parm);
}
for (String bodyLine : constructorTemplate.getBodyLines()) {
answer.addBodyLine(bodyLine);
}
for (FullyQualifiedJavaType fqjt : constructorTemplate.getExceptions()) {
answer.addException(fqjt);
}
commentGenerator.addGeneralMethodComment(answer, introspectedTable);
return answer;
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class GenericCIDAOTemplate method configureConstructorTemplate.
@Override
protected void configureConstructorTemplate() {
Method constructor = new Method();
constructor.setConstructor(true);
constructor.setVisibility(JavaVisibility.PUBLIC);
constructor.addParameter(//$NON-NLS-1$
new Parameter(sqlMapClientType, "sqlMapClient"));
//$NON-NLS-1$
constructor.addBodyLine("super();");
//$NON-NLS-1$
constructor.addBodyLine("this.sqlMapClient = sqlMapClient;");
setConstructorTemplate(constructor);
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class GenericSIDAOTemplate method configureMethods.
@Override
protected void configureMethods() {
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
//$NON-NLS-1$
method.setName("setSqlMapClient");
//$NON-NLS-1$
method.addParameter(new Parameter(sqlMapClientType, "sqlMapClient"));
//$NON-NLS-1$
method.addBodyLine("this.sqlMapClient = sqlMapClient;");
addMethod(method);
method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
//$NON-NLS-1$
method.setName("getSqlMapClient");
method.setReturnType(sqlMapClientType);
//$NON-NLS-1$
method.addBodyLine("return sqlMapClient;");
addMethod(method);
}
Aggregations