public class DefaultCommentGenerator extends Object implements CommentGenerator
Constructor and Description |
---|
DefaultCommentGenerator() |
Modifier and Type | Method and Description |
---|---|
void |
addClassAnnotation(InnerClass innerClass,
IntrospectedTable introspectedTable,
Set<FullyQualifiedJavaType> imports)
Adds a @Generated annotation to a class.
|
void |
addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable)
Adds the inner class comment.
|
void |
addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable,
boolean markAsDoNotDelete)
Adds the inner class comment.
|
void |
addComment(XmlElement xmlElement)
Adds a suitable comment to warn users that the element was generated, and
when it was generated.
|
void |
addConfigurationProperties(Properties props)
Adds properties for this instance from any properties configured in the
CommentGenerator configuration.
|
void |
addEnumComment(InnerEnum innerEnum,
IntrospectedTable introspectedTable)
Adds the enum comment.
|
void |
addFieldAnnotation(Field field,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn,
Set<FullyQualifiedJavaType> imports)
Adds a @Generated annotation to a field.
|
void |
addFieldAnnotation(Field field,
IntrospectedTable introspectedTable,
Set<FullyQualifiedJavaType> imports)
Adds a @Generated annotation to a field.
|
void |
addFieldComment(Field field,
IntrospectedTable introspectedTable)
Adds the field comment.
|
void |
addFieldComment(Field field,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn)
This method should add a Javadoc comment to the specified field.
|
void |
addFileComment(KotlinFile kotlinFile)
This method is called to add a file level comment to a generated Kotlin file.
|
void |
addGeneralMethodAnnotation(Method method,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn,
Set<FullyQualifiedJavaType> imports)
Adds a @Generated annotation to a method.
|
void |
addGeneralMethodAnnotation(Method method,
IntrospectedTable introspectedTable,
Set<FullyQualifiedJavaType> imports)
Adds a @Generated annotation to a method.
|
void |
addGeneralMethodComment(Method method,
IntrospectedTable introspectedTable)
Adds the general method comment.
|
void |
addGetterComment(Method method,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn)
Adds the getter comment.
|
protected void |
addJavadocTag(JavaElement javaElement,
boolean markAsDoNotDelete)
This method adds the custom javadoc tag for.
|
void |
addModelClassComment(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable)
Adds a comment for a model class.
|
void |
addSetterComment(Method method,
IntrospectedTable introspectedTable,
IntrospectedColumn introspectedColumn)
Adds the setter comment.
|
protected String |
getDateString()
Returns a formated date string to include in the Javadoc tag and XML
comments.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addGeneralFunctionComment, addGeneralPropertyComment, addJavaFileComment, addModelClassComment, addRootComment
public void addComment(XmlElement xmlElement)
addComment
in interface CommentGenerator
xmlElement
- the xml elementpublic void addConfigurationProperties(Properties props)
CommentGenerator
This method will be called before any of the other methods.
addConfigurationProperties
in interface CommentGenerator
props
- All properties from the configurationprotected void addJavadocTag(JavaElement javaElement, boolean markAsDoNotDelete)
javaElement
- the java elementmarkAsDoNotDelete
- the mark as do not deleteprotected String getDateString()
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable)
CommentGenerator
addClassComment
in interface CommentGenerator
innerClass
- the inner classintrospectedTable
- the introspected tablepublic void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete)
CommentGenerator
addClassComment
in interface CommentGenerator
innerClass
- the inner classintrospectedTable
- the introspected tablemarkAsDoNotDelete
- the mark as do not deletepublic void addModelClassComment(TopLevelClass topLevelClass, IntrospectedTable introspectedTable)
CommentGenerator
Because of difficulties with the Java file merger, the default implementation of this method should NOT add comments. Comments should only be added if specifically requested by the user (for example, by enabling table remark comments).
addModelClassComment
in interface CommentGenerator
topLevelClass
- the top level classintrospectedTable
- the introspected tablepublic void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable)
CommentGenerator
addEnumComment
in interface CommentGenerator
innerEnum
- the inner enumintrospectedTable
- the introspected tablepublic void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
CommentGenerator
Important: This method should add a the nonstandard JavaDoc tag "@mbg.generated" to the comment. Without this tag, the Eclipse based Java merge feature will fail.
addFieldComment
in interface CommentGenerator
field
- the fieldintrospectedTable
- the introspected tableintrospectedColumn
- the introspected columnpublic void addFieldComment(Field field, IntrospectedTable introspectedTable)
CommentGenerator
addFieldComment
in interface CommentGenerator
field
- the fieldintrospectedTable
- the introspected tablepublic void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable)
CommentGenerator
addGeneralMethodComment
in interface CommentGenerator
method
- the methodintrospectedTable
- the introspected tablepublic void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
CommentGenerator
addGetterComment
in interface CommentGenerator
method
- the methodintrospectedTable
- the introspected tableintrospectedColumn
- the introspected columnpublic void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
CommentGenerator
addSetterComment
in interface CommentGenerator
method
- the methodintrospectedTable
- the introspected tableintrospectedColumn
- the introspected columnpublic void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable, Set<FullyQualifiedJavaType> imports)
CommentGenerator
addGeneralMethodAnnotation
in interface CommentGenerator
method
- the methodintrospectedTable
- the introspected tableimports
- the comment generator may add a required imported type to this listpublic void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports)
CommentGenerator
addGeneralMethodAnnotation
in interface CommentGenerator
method
- the methodintrospectedTable
- the introspected tableintrospectedColumn
- thr introspected columnimports
- the comment generator may add a required imported type to this listpublic void addFieldAnnotation(Field field, IntrospectedTable introspectedTable, Set<FullyQualifiedJavaType> imports)
CommentGenerator
addFieldAnnotation
in interface CommentGenerator
field
- the fieldintrospectedTable
- the introspected tableimports
- the comment generator may add a required imported type to this listpublic void addFieldAnnotation(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports)
CommentGenerator
addFieldAnnotation
in interface CommentGenerator
field
- the fieldintrospectedTable
- the introspected tableintrospectedColumn
- the introspected columnimports
- the comment generator may add a required imported type to this listpublic void addClassAnnotation(InnerClass innerClass, IntrospectedTable introspectedTable, Set<FullyQualifiedJavaType> imports)
CommentGenerator
addClassAnnotation
in interface CommentGenerator
innerClass
- the classintrospectedTable
- the introspected tableimports
- the comment generator may add a required imported type to this listpublic void addFileComment(KotlinFile kotlinFile)
CommentGenerator
The default implementation does nothing.
addFileComment
in interface CommentGenerator
kotlinFile
- the Kotlin fileCopyright © 2006–2024 MyBatis.org. All rights reserved.