Interface CommentGenerator

All Known Implementing Classes:
DefaultCommentGenerator

public interface CommentGenerator
Implementations of this interface are used to generate comments for the various artifacts.
Author:
Jeff Butler
  • Method Details

    • addConfigurationProperties

      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
    • addFieldComment

      default 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 "@mbg.generated" to the comment. Without this tag, the Eclipse based Java merge feature will fail.

      Parameters:
      field - the field
      introspectedTable - the introspected table
      introspectedColumn - the introspected column
    • addFieldComment

      default void addFieldComment(Field field, IntrospectedTable introspectedTable)
      Adds the field comment.
      Parameters:
      field - the field
      introspectedTable - the introspected table
    • addModelClassComment

      default void addModelClassComment(TopLevelClass topLevelClass, IntrospectedTable introspectedTable)
      Adds a comment for a model class. The Java code merger should be notified not to delete the entire class in case any manual changes have been made. So this method will always use the "do not delete" annotation.

      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).

      Parameters:
      topLevelClass - the top level class
      introspectedTable - the introspected table
    • addModelClassComment

      default void addModelClassComment(KotlinType modelClass, IntrospectedTable introspectedTable)
      Adds a comment for a model class.
      Parameters:
      modelClass - the generated KotlinType for the model
      introspectedTable - the introspected table
    • addClassComment

      default void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable)
      Adds the inner class comment.
      Parameters:
      innerClass - the inner class
      introspectedTable - the introspected table
    • addClassComment

      default void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete)
      Adds the inner class comment.
      Parameters:
      innerClass - the inner class
      introspectedTable - the introspected table
      markAsDoNotDelete - the mark as do not delete
    • addEnumComment

      default void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable)
      Adds the enum comment.
      Parameters:
      innerEnum - the inner enum
      introspectedTable - the introspected table
    • addGetterComment

      default void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
      Adds the getter comment.
      Parameters:
      method - the method
      introspectedTable - the introspected table
      introspectedColumn - the introspected column
    • addSetterComment

      default void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
      Adds the setter comment.
      Parameters:
      method - the method
      introspectedTable - the introspected table
      introspectedColumn - the introspected column
    • addGeneralMethodComment

      default void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable)
      Adds the general method comment.
      Parameters:
      method - the method
      introspectedTable - the introspected table
    • addJavaFileComment

      default 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.

      Parameters:
      compilationUnit - the compilation unit
    • addComment

      default void addComment(XmlElement xmlElement)
      This method should add a suitable comment as a child element of the specified xmlElement to warn users that the element was generated and is subject to regeneration.
      Parameters:
      xmlElement - the xml element
    • addRootComment

      default 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.

      Parameters:
      rootElement - the root element
    • addGeneralMethodAnnotation

      default void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable, Set<FullyQualifiedJavaType> imports)
      Adds a @Generated annotation to a method.
      Parameters:
      method - the method
      introspectedTable - the introspected table
      imports - the comment generator may add a required imported type to this list
      Since:
      1.3.6
    • addGeneralMethodAnnotation

      default void addGeneralMethodAnnotation(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports)
      Adds a @Generated annotation to a method.
      Parameters:
      method - the method
      introspectedTable - the introspected table
      introspectedColumn - thr introspected column
      imports - the comment generator may add a required imported type to this list
      Since:
      1.3.6
    • addFieldAnnotation

      default void addFieldAnnotation(Field field, IntrospectedTable introspectedTable, Set<FullyQualifiedJavaType> imports)
      Adds a @Generated annotation to a field.
      Parameters:
      field - the field
      introspectedTable - the introspected table
      imports - the comment generator may add a required imported type to this list
      Since:
      1.3.6
    • addFieldAnnotation

      default void addFieldAnnotation(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn, Set<FullyQualifiedJavaType> imports)
      Adds a @Generated annotation to a field.
      Parameters:
      field - the field
      introspectedTable - the introspected table
      introspectedColumn - the introspected column
      imports - the comment generator may add a required imported type to this list
      Since:
      1.3.6
    • addClassAnnotation

      default void addClassAnnotation(InnerClass innerClass, IntrospectedTable introspectedTable, Set<FullyQualifiedJavaType> imports)
      Adds a @Generated annotation to a class.
      Parameters:
      innerClass - the class
      introspectedTable - the introspected table
      imports - the comment generator may add a required imported type to this list
      Since:
      1.3.6
    • addFileComment

      default void addFileComment(KotlinFile kotlinFile)
      This method is called to add a file level comment to a generated Kotlin file. This method could be used to add a general file comment (such as a copyright notice).

      The default implementation does nothing.

      Parameters:
      kotlinFile - the Kotlin file
    • addGeneralFunctionComment

      default void addGeneralFunctionComment(KotlinFunction kf, IntrospectedTable introspectedTable, Set<String> imports)
    • addGeneralPropertyComment

      default void addGeneralPropertyComment(KotlinProperty property, IntrospectedTable introspectedTable, Set<String> imports)