Class FluentBuilderMethodsPlugin

java.lang.Object
org.mybatis.generator.api.PluginAdapter
org.mybatis.generator.plugins.FluentBuilderMethodsPlugin
All Implemented Interfaces:
Plugin

public class FluentBuilderMethodsPlugin extends PluginAdapter
This plugin adds fluent builder methods to the generated model classes.

Example:

Given the domain class MyDomainClass with setter-method setValue(Object v)

The plugin will create the additional Method public MyDomainClass withValue(Object v)

Author:
Stefan Lack
  • Constructor Details

    • FluentBuilderMethodsPlugin

      public FluentBuilderMethodsPlugin()
  • Method Details

    • validate

      public boolean validate(List<String> warnings)
      Description copied from interface: Plugin
      This method is called after all the setXXX methods are called, but before any other method is called. This allows the plugin to determine whether it can run or not. For example, if the plugin requires certain properties to be set, and the properties are not set, then the plugin is invalid and will not run.
      Parameters:
      warnings - add strings to this list to specify warnings. For example, if the plugin is invalid, you should specify why. Warnings are reported to users after the completion of the run.
      Returns:
      true if the plugin is in a valid state. Invalid plugins will not be called
    • modelSetterMethodGenerated

      public boolean modelSetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, Plugin.ModelClassType modelClassType)
      Description copied from interface: Plugin
      This method is called after the setter, or mutator, method is generated for a specific column in a table.
      Parameters:
      method - the setter, or mutator, method generated for the specified column
      topLevelClass - the partially implemented model class. You can add additional imported classes to the implementation class if necessary.
      introspectedColumn - The class containing information about the column related to this field as introspected from the database
      introspectedTable - The class containing information about the table as introspected from the database
      modelClassType - the type of class that the field is generated for
      Returns:
      true if the method should be generated, false if the generated method should be ignored. In the case of multiple plugins, the first plugin returning false will disable the calling of further plugins.