setLimit.setVisibility(JavaVisibility.PUBLIC); setLimit.setName("setLimit"); setLimit.addParameter(new Parameter(integerWrapper, "limit")); setLimit.addBodyLine("this.limit = limit;"); topLevelClass.addMethod(setLimit); setOffset.setVisibility(JavaVisibility.PUBLIC); setOffset.setName("setOffset"); setOffset.addParameter(new Parameter(integerWrapper, "offset")); setOffset.addBodyLine("this.offset = offset;"); topLevelClass.addMethod(setOffset);
setLimit.setVisibility(JavaVisibility.PUBLIC); setLimit.setName("setLimit"); setLimit.addParameter(new Parameter(integerWrapper, "limit")); setLimit.addBodyLine("this.limit = limit;"); topLevelClass.addMethod(setLimit); setOffset.setVisibility(JavaVisibility.PUBLIC); setOffset.setName("setOffset"); setOffset.addParameter(new Parameter(integerWrapper, "offset")); setOffset.addBodyLine("this.offset = offset;"); topLevelClass.addMethod(setOffset);
setLimit.setVisibility(JavaVisibility.PUBLIC); setLimit.setName("setLimit"); setLimit.addParameter(new Parameter(integerWrapper, "limit")); setLimit.addBodyLine("this.limit = limit;"); topLevelClass.addMethod(setLimit); setOffset.setVisibility(JavaVisibility.PUBLIC); setOffset.setName("setOffset"); setOffset.addParameter(new Parameter(integerWrapper, "offset")); setOffset.addBodyLine("this.offset = offset;"); topLevelClass.addMethod(setOffset);
topLevelClazz.addImportedType(t); if ("RowBounds".equals(t.getShortNameWithoutTypeArguments())) { m.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "pageIndex")); m.addParameter(new Parameter(FullyQualifiedJavaType.getIntInstance(), "pageSize")); paramTxt.add("new RowBounds((pageIndex - 1) * pageSize, pageSize)"); } else { Parameter tmp = new Parameter(t, p.getName()); m.addParameter(tmp); paramTxt.add(tmp.getName()); topLevelClazz.addImportedType(t); Parameter tmp = new Parameter(t, p.getName()); m.addParameter(tmp); paramTxt.add(tmp.getName());
public static Method makeSetterStringMethod(Context context, String fieldName, FullyQualifiedJavaType fieldType, String tableName) { String methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length()); Method method = new Method(); method.setName(methodName); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fieldType, fieldName)); method.addBodyLine("this." + fieldName + " = " + fieldName + ";"); addDoc(context, method, tableName); return method; }
private Method makePartitionMethod(FullyQualifiedJavaType paramType, FullyQualifiedJavaType returnType, String fieldName, String tableName, String[] exp) { String methodName = PARTITION_FACTOR + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length()); Method method = new Method(); method.setName(methodName); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(returnType); method.addBodyLines(Arrays.asList(exp)); method.addParameter(new Parameter(paramType, fieldName)); PluginUtils.addDoc(this.getContext(), method, tableName); return method; }
@Override public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { Method method = topLevelClass.getMethods().get(0); addAnnotation(topLevelClass, method); method.addParameter(new Parameter(sqlMapClient, "sqlMapClient")); method.removeBodyLine(0); method.addBodyLine("super.setSqlMapClient(sqlMapClient);"); return true; }
@Override protected void configureConstructorTemplate() { Method method = new Method(); method.setConstructor(true); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$ method.addBodyLine("super(daoManager);"); //$NON-NLS-1$ setConstructorTemplate(method); }
@Override protected void configureConstructorTemplate() { Method method = new Method(); method.setConstructor(true); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$ method.addBodyLine("super(daoManager);"); //$NON-NLS-1$ setConstructorTemplate(method); }
@Override protected void configureConstructorTemplate() { Method method = new Method(); method.setConstructor(true); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$ method.addBodyLine("super(daoManager);"); //$NON-NLS-1$ setConstructorTemplate(method); }
@Override protected void configureConstructorTemplate() { Method method = new Method(); method.setConstructor(true); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$ method.addBodyLine("super(daoManager);"); //$NON-NLS-1$ setConstructorTemplate(method); }
protected void acceptParts(MethodAndImports.Builder builder, Method method, MethodParts methodParts) { for (Parameter parameter : methodParts.getParameters()) { method.addParameter(parameter); } for (String annotation : methodParts.getAnnotations()) { method.addAnnotation(annotation); } method.addBodyLines(methodParts.getBodyLines()); builder.withImports(methodParts.getImports()); }
@Override protected void configureConstructorTemplate() { Method constructor = new Method(); constructor.setConstructor(true); constructor.setVisibility(JavaVisibility.PUBLIC); constructor .addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$ constructor.addBodyLine("super();"); //$NON-NLS-1$ constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$ setConstructorTemplate(constructor); }
@Override protected void configureConstructorTemplate() { Method constructor = new Method(); constructor.setConstructor(true); constructor.setVisibility(JavaVisibility.PUBLIC); constructor .addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$ constructor.addBodyLine("super();"); //$NON-NLS-1$ constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$ setConstructorTemplate(constructor); }
@Override protected void configureConstructorTemplate() { Method constructor = new Method(); constructor.setConstructor(true); constructor.setVisibility(JavaVisibility.PUBLIC); constructor .addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$ constructor.addBodyLine("super();"); //$NON-NLS-1$ constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$ setConstructorTemplate(constructor); }
protected void generateSetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setName("set" + capitalize(field)); method.addParameter(new Parameter(type, field)); method.addBodyLine("this." + field + " = " + field + ";"); innerClass.addMethod(method); }
@Override protected void configureConstructorTemplate() { Method constructor = new Method(); constructor.setConstructor(true); constructor.setVisibility(JavaVisibility.PUBLIC); constructor.addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$ constructor.addBodyLine("super();"); //$NON-NLS-1$ constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$ setConstructorTemplate(constructor); }
@Override public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { String objectName = introspectedTable.getTableConfiguration().getDomainObjectName(); Method method = new Method(BATCH_INSERT); FullyQualifiedJavaType type = new FullyQualifiedJavaType("java.util.List<" + objectName + ">"); method.addParameter(new Parameter(type, "list")); method.setReturnType(FullyQualifiedJavaType.getIntInstance()); interfaze.addMethod(method); return true; }
protected void generateFluentSetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setName(field); method.addParameter(new Parameter(type, field)); method.addBodyLine("this." + field + " = " + field + ";"); method.addBodyLine("return this;"); method.setReturnType(innerClass.getType()); innerClass.addMethod(method); }
private void addNewComposedFunction(Interface interfaze, IntrospectedTable introspectedTable, FullyQualifiedJavaType baseMethodReturnType) { interfaze.addImportedType(new FullyQualifiedJavaType("java.util.function.Function")); //$NON-NLS-1$ FullyQualifiedJavaType returnType = new FullyQualifiedJavaType("Function<SelectStatementProvider, " //$NON-NLS-1$ + baseMethodReturnType.getShortName() + ">"); //$NON-NLS-1$ Method method = new Method("selectManyWithRowbounds"); //$NON-NLS-1$ method.setDefault(true); method.setReturnType(returnType); method.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$ method.addBodyLine("return selectStatement -> selectManyWithRowbounds(selectStatement, rowBounds);"); //$NON-NLS-1$ context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, interfaze.getImportedTypes()); interfaze.addMethod(method); }