public class

SerializablePlugin

extends PluginAdapter
java.lang.Object
   ↳ org.mybatis.generator.api.PluginAdapter
     ↳ org.mybatis.generator.plugins.SerializablePlugin

Class Overview

This plugin adds the java.io.Serializable marker interface to all generated model objects.

This plugin demonstrates adding capabilities to generated Java artifacts, and shows the proper way to add imports to a compilation unit.

Important: This is a simplistic implementation of serializable and does not attempt to do any versioning of classes.

Summary

[Expand]
Inherited Fields
From class org.mybatis.generator.api.PluginAdapter
Public Constructors
SerializablePlugin()
Public Methods
boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable)
This method is called after the base record class is generated by the JavaModelGenerator.
boolean modelPrimaryKeyClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable)
This method is called after the primary key class is generated by the JavaModelGenerator.
boolean modelRecordWithBLOBsClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable)
This method is called after the record with BLOBs class is generated by the JavaModelGenerator.
boolean validate(List<String> warnings)
Protected Methods
void makeSerializable(TopLevelClass topLevelClass, IntrospectedTable introspectedTable)
[Expand]
Inherited Methods
From class org.mybatis.generator.api.PluginAdapter
From class java.lang.Object
From interface org.mybatis.generator.api.Plugin

Public Constructors

public SerializablePlugin ()

Public Methods

public boolean modelBaseRecordClassGenerated (TopLevelClass topLevelClass, IntrospectedTable introspectedTable)

This method is called after the base record class is generated by the JavaModelGenerator. This method will only be called if the table rules call for generation of a base record class.

This method is only guaranteed to be called by the default Java model generators. Other user supplied generators may, or may not, call this method.

Parameters
topLevelClass the generated base record class
introspectedTable The class containing information about the table as introspected from the database
Returns
  • true if the class should be generated, false if the generated class should be ignored. In the case of multiple plugins, the first plugin returning false will disable the calling of further plugins.

public boolean modelPrimaryKeyClassGenerated (TopLevelClass topLevelClass, IntrospectedTable introspectedTable)

This method is called after the primary key class is generated by the JavaModelGenerator. This method will only be called if the table rules call for generation of a primary key class.

This method is only guaranteed to be called by the Java model generators. Other user supplied generators may, or may not, call this method.

Parameters
topLevelClass the generated primary key class
introspectedTable The class containing information about the table as introspected from the database
Returns
  • true if the class should be generated, false if the generated class should be ignored. In the case of multiple plugins, the first plugin returning false will disable the calling of further plugins.

public boolean modelRecordWithBLOBsClassGenerated (TopLevelClass topLevelClass, IntrospectedTable introspectedTable)

This method is called after the record with BLOBs class is generated by the JavaModelGenerator. This method will only be called if the table rules call for generation of a record with BLOBs class.

This method is only guaranteed to be called by the default Java model generators. Other user supplied generators may, or may not, call this method.

Parameters
topLevelClass the generated record with BLOBs class
introspectedTable The class containing information about the table as introspected from the database
Returns
  • true if the class should be generated, false if the generated class should be ignored. In the case of multiple plugins, the first plugin returning false will disable the calling of further plugins.

public boolean validate (List<String> warnings)

Protected Methods

protected void makeSerializable (TopLevelClass topLevelClass, IntrospectedTable introspectedTable)