The <commentGenerator> Element

The <commentGenerator> element is used to define properties of the Comment Generator. The Comment Generator is used to generate comments for the various elements generated by Ibator (Java fields, Java methods, XML elements, etc.). The default Comment Generator adds JavaDoc comments to all generated Java elements to enable the Java merge functionality in the Eclipse plugin. Also, comments are added to each generated XML element. The purpose of the comments is also to inform users that the elements are generated and are subject to regeneration (i.e. - they shouldn't be altered). This element is an optional child element of the <ibatorContext> element.

The default implementation is org.apache.ibatis.ibator.internal.DefaultCommentGenerator. The default implementation is designed for extensibility if you only want to modify certain behaviors.

Required Attributes

None

Optional Attributes

Attribute Description
type This may be used to specify the type of the user provided Comment Generator. The class must implement the interface org.apache.ibatis.ibator.api.CommentGenerator and must have a public default constructor. The attribute also accepts the special value DEFAULT in which case the default implementation will be used (this has the same effect as not specifying the type).

Child Elements

Supported Properties

This table lists the properties of the default comment generator that can be specified with the <property> child element:

Property Name Property Values
suppressDate This property is used to specify whether Ibator will include the generation timestamp in the generated comments. The property supports these values:
false This is the default value
When the property is false or unspecified, all generated comments will include the timestamp when the element was generated.
true When the property is true, no timestamp will be added to the generated comments.

Example

This element specifies that we do not want the timestamp added to any generated comment:

<commentGenerator>
  <property name="suppressDate" value="true" />
</commentGenerator>