public class

DefaultCommentGenerator

extends Object
implements CommentGenerator
java.lang.Object
   ↳ org.mybatis.generator.internal.DefaultCommentGenerator

Summary

Public Constructors
DefaultCommentGenerator()
Public Methods
void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable)
void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete)
void addComment(XmlElement xmlElement)
Adds a suitable comment to warn users that the element was generated, and when it was generated.
void addConfigurationProperties(Properties properties)
Adds properties for this instance from any properties configured in the CommentGenerator configuration.
void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable)
void addFieldComment(Field field, IntrospectedTable introspectedTable)
void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
This method should add a Javadoc comment to the specified field.
void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable)
void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
void addJavaFileComment(CompilationUnit compilationUnit)
This method is called to add a file level comment to a generated java file.
void addRootComment(XmlElement rootElement)
This method is called to add a comment as the first child of the root element.
void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
Protected Methods
void addJavadocTag(JavaElement javaElement, boolean markAsDoNotDelete)
This method adds the custom javadoc tag for.
String getDateString()
This method returns a formated date string to include in the Javadoc tag and XML comments.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.mybatis.generator.api.CommentGenerator

Public Constructors

public DefaultCommentGenerator ()

Public Methods

public void addClassComment (InnerClass innerClass, IntrospectedTable introspectedTable)

public void addClassComment (InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete)

public void addComment (XmlElement xmlElement)

Adds a suitable comment to warn users that the element was generated, and when it was generated.

public void addConfigurationProperties (Properties properties)

Adds properties for this instance from any properties configured in the CommentGenerator configuration. This method will be called before any of the other methods.

Parameters
properties All properties from the configuration

public void addEnumComment (InnerEnum innerEnum, IntrospectedTable introspectedTable)

public void addFieldComment (Field field, IntrospectedTable introspectedTable)

public void addFieldComment (Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)

This method should add a Javadoc comment to the specified field. The field is related to the specified table and is used to hold the value of the specified column.

Important: This method should add a the nonstandard JavaDoc tag "@mbggenerated" to the comment. Without this tag, the Eclipse based Java merge feature will fail.

public void addGeneralMethodComment (Method method, IntrospectedTable introspectedTable)

public void addGetterComment (Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)

public void addJavaFileComment (CompilationUnit compilationUnit)

This method is called to add a file level comment to a generated java file. This method could be used to add a general file comment (such as a copyright notice). However, note that the Java file merge function in Eclipse does not deal with this comment. If you run the generator repeatedly, you will only retain the comment from the initial run.

The default implementation does nothing.

public void addRootComment (XmlElement rootElement)

This method is called to add a comment as the first child of the root element. This method could be used to add a general file comment (such as a copyright notice). However, note that the XML file merge function does not deal with this comment. If you run the generator repeatedly, you will only retain the comment from the initial run.

The default implementation does nothing.

public void addSetterComment (Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)

Protected Methods

protected void addJavadocTag (JavaElement javaElement, boolean markAsDoNotDelete)

This method adds the custom javadoc tag for. You may do nothing if you do not wish to include the Javadoc tag - however, if you do not include the Javadoc tag then the Java merge capability of the eclipse plugin will break.

Parameters
javaElement the java element

protected String getDateString ()

This method returns a formated date string to include in the Javadoc tag and XML comments. You may return null if you do not want the date in these documentation elements.

Returns
  • a string representing the current timestamp, or null