@Override
    public boolean modelBuilderClassGenerated(TopLevelClass topLevelClass, InnerClass builderClass, List<IntrospectedColumn> columns, IntrospectedTable introspectedTable) {
    """
	Model builder class 生成
	@param topLevelClass
	@param builderClass
	@param columns
	@param introspectedTable
	@return
    """
        if (this.support()) {
            if (this.incEnum == null) {
                this.incEnum = this.generatedIncEnum(introspectedTable);
                this.incEnumBuilder = builderClass;
                // 增加枚举
                builderClass.addInnerEnum(this.incEnum);
                // topLevel class 添加必要的操作方法
                this.addIncMethodToTopLevelClass(topLevelClass, builderClass, introspectedTable, false);
            }


            // Builder 中 添加字段支持
            for (IntrospectedColumn column : columns) {
                if (this.supportColumn(column)) {
                    Field field = JavaBeansUtil.getJavaBeansField(column, context, introspectedTable);
                    // 增加方法
                    Method mIncrements = JavaElementGeneratorTools.generateMethod(
                            field.getName(),
                            JavaVisibility.PUBLIC,
                            builderClass.getType(),
                            new Parameter(field.getType(), field.getName()),
                            new Parameter(this.getIncEnum(builderClass, introspectedTable), "inc")
                    );
                    commentGenerator.addSetterComment(mIncrements, introspectedTable, column);

                    Method setterMethod = JavaBeansUtil.getJavaBeansSetter(column, context, introspectedTable);
                    mIncrements.addBodyLine("obj." + IncrementsPlugin.FIELD_INC_MAP + ".put(\"" + column.getActualColumnName() + "\", inc);");
                    mIncrements.addBodyLine("obj." + setterMethod.getName() + "(" + field.getName() + ");");
                    mIncrements.addBodyLine("return this;");

                    FormatTools.addMethodWithBestPosition(builderClass, mIncrements);
                }
            }
        }
        return true;
    }
@Override
    public boolean modelBuilderClassGenerated(TopLevelClass topLevelClass, InnerClass builderClass, List<IntrospectedColumn> columns, IntrospectedTable introspectedTable) {
        if (this.support()) {
            if (this.incEnum == null) {
                this.incEnum = this.generatedIncEnum(introspectedTable);
                this.incEnumBuilder = builderClass;
                // 增加枚举
                builderClass.addInnerEnum(this.incEnum);
                // topLevel class 添加必要的操作方法
                this.addIncMethodToTopLevelClass(topLevelClass, builderClass, introspectedTable, false);
            }


            // Builder 中 添加字段支持
            for (IntrospectedColumn column : columns) {
                if (this.supportColumn(column)) {
                    Field field = JavaBeansUtil.getJavaBeansField(column, context, introspectedTable);
                    // 增加方法
                    Method mIncrements = JavaElementGeneratorTools.generateMethod(
                            field.getName(),
                            JavaVisibility.PUBLIC,
                            builderClass.getType(),
                            new Parameter(field.getType(), field.getName()),
                            new Parameter(this.getIncEnum(builderClass, introspectedTable), "inc")
                    );
                    commentGenerator.addSetterComment(mIncrements, introspectedTable, column);

                    Method setterMethod = JavaBeansUtil.getJavaBeansSetter(column, context, introspectedTable);
                    mIncrements.addBodyLine("obj." + IncrementsPlugin.FIELD_INC_MAP + ".put(\"" + column.getActualColumnName() + "\", inc);");
                    mIncrements.addBodyLine("obj." + setterMethod.getName() + "(" + field.getName() + ");");
                    mIncrements.addBodyLine("return this;");

                    FormatTools.addMethodWithBestPosition(builderClass, mIncrements);
                }
            }
        }
        return true;
    }
@ Override public boolean modelBuilderClassGenerated ( TopLevelClass topLevelClass , InnerClass builderClass , List < IntrospectedColumn > columns , IntrospectedTable introspectedTable ) { if ( this . support ( ) ) { if ( this . incEnum == null ) { this . incEnum = this . generatedIncEnum ( introspectedTable ) ; this . incEnumBuilder = builderClass ; // 增加枚举 builderClass . addInnerEnum ( this . incEnum ) ; // topLevel class 添加必要的操作方法 this . addIncMethodToTopLevelClass ( topLevelClass , builderClass , introspectedTable , false ) ; } // Builder 中 添加字段支持 for ( IntrospectedColumn column : columns ) { if ( this . supportColumn ( column ) ) { Field field = JavaBeansUtil . getJavaBeansField ( column , context , introspectedTable ) ; // 增加方法 Method mIncrements = JavaElementGeneratorTools . generateMethod ( field . getName ( ) , JavaVisibility . PUBLIC , builderClass . getType ( ) , new Parameter ( field . getType ( ) , field . getName ( ) ) , new Parameter ( this . getIncEnum ( builderClass , introspectedTable ) , "inc" ) ) ; commentGenerator . addSetterComment ( mIncrements , introspectedTable , column ) ; Method setterMethod = JavaBeansUtil . getJavaBeansSetter ( column , context , introspectedTable ) ; mIncrements . addBodyLine ( "obj." + IncrementsPlugin . FIELD_INC_MAP + ".put(\"" + column . getActualColumnName ( ) + "\", inc);" ) ; mIncrements . addBodyLine ( "obj." + setterMethod . getName ( ) + "(" + field . getName ( ) + ");" ) ; mIncrements . addBodyLine ( "return this;" ) ; FormatTools . addMethodWithBestPosition ( builderClass , mIncrements ) ; } } } return true ; }
Model builder class 生成
@param topLevelClass
@param builderClass
@param columns
@param introspectedTable
@return
Model builder class 生成