use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class RowBoundsPlugin method copyAndAddMethod.
/**
* 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);
//$NON-NLS-1$
newMethod.setName(method.getName() + "WithRowbounds");
//$NON-NLS-1$
newMethod.addParameter(new Parameter(rowBounds, "rowBounds"));
interfaze.addMethod(newMethod);
interfaze.addImportedType(rowBounds);
}
use of org.mybatis.generator.api.dom.java.Parameter in project generator by mybatis.
the class JavaBeansUtil method getJavaBeansSetter.
/**
* Gets the java beans setter.
*
* @param introspectedColumn
* the introspected column
* @param context
* the context
* @param introspectedTable
* the introspected table
* @return the java beans setter
*/
public static Method getJavaBeansSetter(IntrospectedColumn introspectedColumn, Context context, IntrospectedTable introspectedTable) {
FullyQualifiedJavaType fqjt = introspectedColumn.getFullyQualifiedJavaType();
String property = introspectedColumn.getJavaProperty();
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setName(getSetterMethodName(property));
method.addParameter(new Parameter(fqjt, property));
context.getCommentGenerator().addSetterComment(method, introspectedTable, introspectedColumn);
StringBuilder sb = new StringBuilder();
if (introspectedColumn.isStringColumn() && isTrimStringsEnabled(introspectedColumn)) {
//$NON-NLS-1$
sb.append("this.");
sb.append(property);
//$NON-NLS-1$
sb.append(" = ");
sb.append(property);
//$NON-NLS-1$
sb.append(" == null ? null : ");
sb.append(property);
//$NON-NLS-1$
sb.append(".trim();");
method.addBodyLine(sb.toString());
} else {
//$NON-NLS-1$
sb.append("this.");
sb.append(property);
//$NON-NLS-1$
sb.append(" = ");
sb.append(property);
sb.append(';');
method.addBodyLine(sb.toString());
}
return method;
}
Aggregations