org.apache.ibatis.abator.internal
Class DefaultCommentGenerator

java.lang.Object
  extended byorg.apache.ibatis.abator.internal.DefaultCommentGenerator
All Implemented Interfaces:
CommentGenerator

public class DefaultCommentGenerator
extends java.lang.Object
implements CommentGenerator

Author:
Jeff Butler

Constructor Summary
DefaultCommentGenerator()
           
 
Method Summary
protected  void addAbatorJavadocTag(JavaElement javaElement)
          This method adds the custom javadoc tag for Abator.
 void addClassComment(InnerClass innerClass, FullyQualifiedTable table)
           
 void addComment(XmlElement xmlElement)
          Adds a suitable comment to warn users that the element was generated, and when it was generated.
 void addConfigurationProperties(java.util.Properties properties)
          Adds properties for this instance from any properties configured in the CommentGenerator configuration.
 void addEnumComment(InnerEnum innerEnum, FullyQualifiedTable table)
           
 void addFieldComment(Field field, FullyQualifiedTable table)
           
 void addFieldComment(Field field, FullyQualifiedTable table, java.lang.String columnName)
          This method should add a Javadoc comment to the specified field.
 void addGeneralMethodComment(Method method, FullyQualifiedTable table)
           
 void addGetterComment(Method method, FullyQualifiedTable table, java.lang.String columnName)
           
 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, FullyQualifiedTable table, java.lang.String columnName)
           
protected  java.lang.String getDateString()
          This method returns a formated date string to include in the Javadoc tag and XML comments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCommentGenerator

public DefaultCommentGenerator()
Method Detail

addFieldComment

public void addFieldComment(Field field,
                            FullyQualifiedTable table,
                            java.lang.String columnName)
Description copied from interface: CommentGenerator
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 "@abatorgenerated" to the comment. Without this tag, the Eclipse based Java merge feature will fail.

Specified by:
addFieldComment in interface CommentGenerator
Parameters:
field -
table -
columnName -

addFieldComment

public void addFieldComment(Field field,
                            FullyQualifiedTable table)
Specified by:
addFieldComment in interface CommentGenerator

addClassComment

public void addClassComment(InnerClass innerClass,
                            FullyQualifiedTable table)
Specified by:
addClassComment in interface CommentGenerator

addEnumComment

public void addEnumComment(InnerEnum innerEnum,
                           FullyQualifiedTable table)
Specified by:
addEnumComment in interface CommentGenerator

addGetterComment

public void addGetterComment(Method method,
                             FullyQualifiedTable table,
                             java.lang.String columnName)
Specified by:
addGetterComment in interface CommentGenerator

addSetterComment

public void addSetterComment(Method method,
                             FullyQualifiedTable table,
                             java.lang.String columnName)
Specified by:
addSetterComment in interface CommentGenerator

addGeneralMethodComment

public void addGeneralMethodComment(Method method,
                                    FullyQualifiedTable table)
Specified by:
addGeneralMethodComment in interface CommentGenerator

addJavaFileComment

public void addJavaFileComment(CompilationUnit compilationUnit)
Description copied from interface: CommentGenerator
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 Abator repeatedly, you will only retain the comment from the initial run.

The default implementation does nothing.

Specified by:
addJavaFileComment in interface CommentGenerator
Parameters:
compilationUnit -

addComment

public void addComment(XmlElement xmlElement)
Adds a suitable comment to warn users that the element was generated, and when it was generated.

Specified by:
addComment in interface CommentGenerator

addRootComment

public void addRootComment(XmlElement rootElement)
Description copied from interface: CommentGenerator
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 Abator repeatedly, you will only retain the comment from the initial run.

The default implementation does nothing.

Specified by:
addRootComment in interface CommentGenerator
Parameters:
rootElement -

addConfigurationProperties

public void addConfigurationProperties(java.util.Properties properties)
Description copied from interface: CommentGenerator
Adds properties for this instance from any properties configured in the CommentGenerator configuration. This method will be called before any of the other methods.

Specified by:
addConfigurationProperties in interface CommentGenerator
Parameters:
properties - All properties from the configuration

addAbatorJavadocTag

protected void addAbatorJavadocTag(JavaElement javaElement)
This method adds the custom javadoc tag for Abator. 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 -

getDateString

protected java.lang.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: