org.apache.ibatis.ibator.generator.ibatis2.dao.templates
Class AbstractDAOTemplate

java.lang.Object
  extended by org.apache.ibatis.ibator.generator.ibatis2.dao.templates.AbstractDAOTemplate
Direct Known Subclasses:
GenericCIDAOTemplate, GenericSIDAOTemplate, IbatisDAOTemplate, SpringDAOTemplate

public abstract class AbstractDAOTemplate
extends java.lang.Object

Base class for DAO templates. Subclasses should override any of the configureXXX methods to specify the unique properties of the desired DAO objects.

Author:
Jeff Butler

Constructor Summary
AbstractDAOTemplate()
           
 
Method Summary
protected  void addCheckedException(FullyQualifiedJavaType type)
           
protected  void addField(Field field)
           
protected  void addImplementationImport(FullyQualifiedJavaType type)
           
protected  void addInterfaceImport(FullyQualifiedJavaType type)
           
protected  void addMethod(Method method)
           
protected  void configureCheckedExceptions()
          Override this method to add checked exceptions to the throws clause of any generated DAO method.
protected abstract  void configureConstructorTemplate()
          Override this method to configure a constructor for generated DAO implementation classes.
protected abstract  void configureDeleteMethodTemplate()
          Override this method to configure a delete method template.
protected  void configureFields()
          Override this method to add fields to any generated DAO implementation class.
protected  void configureImplementationImports()
          Override this method to add imports to generated DAO implementation classes.
protected abstract  void configureInsertMethodTemplate()
          Override this method to configure an insert method template.
protected  void configureInterfaceImports()
          Override this method to add imports to generated DAO interface classes.
protected  void configureMethods()
          Override this method to add methods to generated DAO implementation classes.
protected abstract  void configureQueryForListMethodTemplate()
          Override this method to configure a queryForList method template.
protected abstract  void configureQueryForObjectMethodTemplate()
          Override this method to configure a queryForObject method template.
protected  void configureSuperClass()
          Override this method to set the superclass for any generated DAO implementation class.
protected abstract  void configureUpdateMethodTemplate()
          Override this method to configure an update method template.
 java.util.List<FullyQualifiedJavaType> getCheckedExceptions()
           
 Method getConstructorClone(CommentGenerator commentGenerator, FullyQualifiedJavaType type, FullyQualifiedTable table)
           
 java.lang.String getDeleteMethod(java.lang.String sqlMapNamespace, java.lang.String statementId, java.lang.String parameter)
           
 java.util.List<Field> getFieldClones(CommentGenerator commentGenerator, FullyQualifiedTable table)
           
 java.util.List<FullyQualifiedJavaType> getImplementationImports()
           
 java.lang.String getInsertMethod(java.lang.String sqlMapNamespace, java.lang.String statementId, java.lang.String parameter)
           
 java.util.List<FullyQualifiedJavaType> getInterfaceImports()
           
 java.util.List<Method> getMethodClones(CommentGenerator commentGenerator, FullyQualifiedTable table)
           
 java.lang.String getQueryForListMethod(java.lang.String sqlMapNamespace, java.lang.String statementId, java.lang.String parameter)
           
 java.lang.String getQueryForObjectMethod(java.lang.String sqlMapNamespace, java.lang.String statementId, java.lang.String parameter)
           
 FullyQualifiedJavaType getSuperClass()
           
 java.lang.String getUpdateMethod(java.lang.String sqlMapNamespace, java.lang.String statementId, java.lang.String parameter)
           
protected  void setConstructorTemplate(Method constructorTemplate)
           
protected  void setDeleteMethodTemplate(java.lang.String deleteMethodTemplate)
           
protected  void setInsertMethodTemplate(java.lang.String insertMethodTemplate)
           
protected  void setQueryForListMethodTemplate(java.lang.String queryForListMethodTemplate)
           
protected  void setQueryForObjectMethodTemplate(java.lang.String queryForObjectMethodTemplate)
           
protected  void setSuperClass(FullyQualifiedJavaType superClass)
           
protected  void setUpdateMethodTemplate(java.lang.String updateMethodTemplate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDAOTemplate

public AbstractDAOTemplate()
Method Detail

getConstructorClone

public final Method getConstructorClone(CommentGenerator commentGenerator,
                                        FullyQualifiedJavaType type,
                                        FullyQualifiedTable table)

getDeleteMethod

public final java.lang.String getDeleteMethod(java.lang.String sqlMapNamespace,
                                              java.lang.String statementId,
                                              java.lang.String parameter)

getInterfaceImports

public final java.util.List<FullyQualifiedJavaType> getInterfaceImports()

getImplementationImports

public final java.util.List<FullyQualifiedJavaType> getImplementationImports()

getInsertMethod

public final java.lang.String getInsertMethod(java.lang.String sqlMapNamespace,
                                              java.lang.String statementId,
                                              java.lang.String parameter)

getQueryForListMethod

public final java.lang.String getQueryForListMethod(java.lang.String sqlMapNamespace,
                                                    java.lang.String statementId,
                                                    java.lang.String parameter)

getQueryForObjectMethod

public final java.lang.String getQueryForObjectMethod(java.lang.String sqlMapNamespace,
                                                      java.lang.String statementId,
                                                      java.lang.String parameter)

getSuperClass

public final FullyQualifiedJavaType getSuperClass()

getUpdateMethod

public final java.lang.String getUpdateMethod(java.lang.String sqlMapNamespace,
                                              java.lang.String statementId,
                                              java.lang.String parameter)

getCheckedExceptions

public final java.util.List<FullyQualifiedJavaType> getCheckedExceptions()

getFieldClones

public final java.util.List<Field> getFieldClones(CommentGenerator commentGenerator,
                                                  FullyQualifiedTable table)

getMethodClones

public final java.util.List<Method> getMethodClones(CommentGenerator commentGenerator,
                                                    FullyQualifiedTable table)

setConstructorTemplate

protected void setConstructorTemplate(Method constructorTemplate)

setDeleteMethodTemplate

protected void setDeleteMethodTemplate(java.lang.String deleteMethodTemplate)

addField

protected void addField(Field field)

setInsertMethodTemplate

protected void setInsertMethodTemplate(java.lang.String insertMethodTemplate)

addMethod

protected void addMethod(Method method)

setQueryForListMethodTemplate

protected void setQueryForListMethodTemplate(java.lang.String queryForListMethodTemplate)

setQueryForObjectMethodTemplate

protected void setQueryForObjectMethodTemplate(java.lang.String queryForObjectMethodTemplate)

setSuperClass

protected void setSuperClass(FullyQualifiedJavaType superClass)

setUpdateMethodTemplate

protected void setUpdateMethodTemplate(java.lang.String updateMethodTemplate)

addInterfaceImport

protected void addInterfaceImport(FullyQualifiedJavaType type)

addImplementationImport

protected void addImplementationImport(FullyQualifiedJavaType type)

addCheckedException

protected void addCheckedException(FullyQualifiedJavaType type)

configureCheckedExceptions

protected void configureCheckedExceptions()
Override this method to add checked exceptions to the throws clause of any generated DAO method. When overriding this method, call addCheckedException(FullyQualifiedJavaType) one or more times to add checked exception(s) to all generated DAO methods.


configureFields

protected void configureFields()
Override this method to add fields to any generated DAO implementation class. When overriding this method, call addField(Field) one or more times to add field(s) to the generated DAO implementation class.


configureImplementationImports

protected void configureImplementationImports()
Override this method to add imports to generated DAO implementation classes. When overriding this method, call addImplementationImport(FullyQualifiedJavaType) one or more times to add import(s) to generated DAO implementation classes.


configureInterfaceImports

protected void configureInterfaceImports()
Override this method to add imports to generated DAO interface classes. When overriding this method, call addInterfaceImport(FullyQualifiedJavaType) one or more times to add import(s) to generated DAO interface classes.


configureMethods

protected void configureMethods()
Override this method to add methods to generated DAO implementation classes. When overriding this method, call addMethod(Method) one or more times to add method(s) to generated DAO implementation classes.


configureSuperClass

protected void configureSuperClass()
Override this method to set the superclass for any generated DAO implementation class. When overriding this method call setSuperClass(FullyQualifiedJavaType) to set the superclass for generated DAO implementation classes.


configureConstructorTemplate

protected abstract void configureConstructorTemplate()
Override this method to configure a constructor for generated DAO implementation classes. During code generation, ibator will build a new constructor using the visibility, parameters, body lines, and exceptions set on the constructor template. When overriding this method, call setConstructorTemplate(Method) to set the constructor template.


configureInsertMethodTemplate

protected abstract void configureInsertMethodTemplate()
Override this method to configure an insert method template. A method template is a string with three substitution markers that ibator will fill in when generating code. The substitution markers will be: For example, when calling methods in the SqlMapClient interface, the template would be: sqlMapClient.insert(\"{0}.{1}\", {2}); Overriding methods should call the setInsertMethodTemplate(String)

configureQueryForListMethodTemplate

protected abstract void configureQueryForListMethodTemplate()
Override this method to configure a queryForList method template. A method template is a string with three substitution markers that ibator will fill in when generating code. The substitution markers will be: For example, when calling methods in the SqlMapClient interface, the template would be: sqlMapClient.queryForList(\"{0}.{1}\", {2}); Overriding methods should call the setQueryForListMethodTemplate(String)

configureQueryForObjectMethodTemplate

protected abstract void configureQueryForObjectMethodTemplate()
Override this method to configure a queryForObject method template. A method template is a string with three substitution markers that ibator will fill in when generating code. The substitution markers will be: For example, when calling methods in the SqlMapClient interface, the template would be: sqlMapClient.queryForObject(\"{0}.{1}\", {2}); Overriding methods should call the setQueryForObjectMethodTemplate(String)

configureUpdateMethodTemplate

protected abstract void configureUpdateMethodTemplate()
Override this method to configure an update method template. A method template is a string with three substitution markers that ibator will fill in when generating code. The substitution markers will be: For example, when calling methods in the SqlMapClient interface, the template would be: sqlMapClient.update(\"{0}.{1}\", {2}); Overriding methods should call the setUpdateMethodTemplate(String)

configureDeleteMethodTemplate

protected abstract void configureDeleteMethodTemplate()
Override this method to configure a delete method template. A method template is a string with three substitution markers that ibator will fill in when generating code. The substitution markers will be: For example, when calling methods in the SqlMapClient interface, the template would be: sqlMapClient.delete(\"{0}.{1}\", {2}); Overriding methods should call the setDeleteMethodTemplate(String)