public abstract class

AbstractDAOTemplate

extends Object
java.lang.Object
   ↳ org.mybatis.generator.codegen.ibatis2.dao.templates.AbstractDAOTemplate
Known Direct Subclasses

Class Overview

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

Summary

Public Constructors
AbstractDAOTemplate()
Public Methods
final List<FullyQualifiedJavaType> getCheckedExceptions()
final Method getConstructorClone(CommentGenerator commentGenerator, FullyQualifiedJavaType type, IntrospectedTable introspectedTable)
final String getDeleteMethod(String sqlMapNamespace, String statementId, String parameter)
final List<Field> getFieldClones(CommentGenerator commentGenerator, IntrospectedTable introspectedTable)
final List<FullyQualifiedJavaType> getImplementationImports()
final String getInsertMethod(String sqlMapNamespace, String statementId, String parameter)
final List<FullyQualifiedJavaType> getInterfaceImports()
final List<Method> getMethodClones(CommentGenerator commentGenerator, IntrospectedTable introspectedTable)
final String getQueryForListMethod(String sqlMapNamespace, String statementId, String parameter)
final String getQueryForObjectMethod(String sqlMapNamespace, String statementId, String parameter)
final FullyQualifiedJavaType getSuperClass()
final String getUpdateMethod(String sqlMapNamespace, String statementId, String parameter)
Protected Methods
void addCheckedException(FullyQualifiedJavaType type)
void addField(Field field)
void addImplementationImport(FullyQualifiedJavaType type)
void addInterfaceImport(FullyQualifiedJavaType type)
void addMethod(Method method)
void configureCheckedExceptions()
Override this method to add checked exceptions to the throws clause of any generated DAO method.
abstract void configureConstructorTemplate()
Override this method to configure a constructor for generated DAO implementation classes.
abstract void configureDeleteMethodTemplate()
Override this method to configure a delete method template.
void configureFields()
Override this method to add fields to any generated DAO implementation class.
void configureImplementationImports()
Override this method to add imports to generated DAO implementation classes.
abstract void configureInsertMethodTemplate()
Override this method to configure an insert method template.
void configureInterfaceImports()
Override this method to add imports to generated DAO interface classes.
void configureMethods()
Override this method to add methods to generated DAO implementation classes.
abstract void configureQueryForListMethodTemplate()
Override this method to configure a queryForList method template.
abstract void configureQueryForObjectMethodTemplate()
Override this method to configure a queryForObject method template.
void configureSuperClass()
Override this method to set the superclass for any generated DAO implementation class.
abstract void configureUpdateMethodTemplate()
Override this method to configure an update method template.
void setConstructorTemplate(Method constructorTemplate)
void setDeleteMethodTemplate(String deleteMethodTemplate)
void setInsertMethodTemplate(String insertMethodTemplate)
void setQueryForListMethodTemplate(String queryForListMethodTemplate)
void setQueryForObjectMethodTemplate(String queryForObjectMethodTemplate)
void setSuperClass(FullyQualifiedJavaType superClass)
void setUpdateMethodTemplate(String updateMethodTemplate)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public AbstractDAOTemplate ()

Public Methods

public final List<FullyQualifiedJavaType> getCheckedExceptions ()

public final Method getConstructorClone (CommentGenerator commentGenerator, FullyQualifiedJavaType type, IntrospectedTable introspectedTable)

public final String getDeleteMethod (String sqlMapNamespace, String statementId, String parameter)

public final List<Field> getFieldClones (CommentGenerator commentGenerator, IntrospectedTable introspectedTable)

public final List<FullyQualifiedJavaType> getImplementationImports ()

public final String getInsertMethod (String sqlMapNamespace, String statementId, String parameter)

public final List<FullyQualifiedJavaType> getInterfaceImports ()

public final List<Method> getMethodClones (CommentGenerator commentGenerator, IntrospectedTable introspectedTable)

public final String getQueryForListMethod (String sqlMapNamespace, String statementId, String parameter)

public final String getQueryForObjectMethod (String sqlMapNamespace, String statementId, String parameter)

public final FullyQualifiedJavaType getSuperClass ()

public final String getUpdateMethod (String sqlMapNamespace, String statementId, String parameter)

Protected Methods

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. When overriding this method, call addCheckedException(FullyQualifiedJavaType) one or more times to add checked exception(s) to all generated DAO methods.

protected abstract void configureConstructorTemplate ()

Override this method to configure a constructor for generated DAO implementation classes. During code generation, we 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.

protected abstract void configureDeleteMethodTemplate ()

Override this method to configure a delete method template. A method template is a string with three substitution markers that we will fill in when generating code. The substitution markers will be:

  • {0} - The SqlMap namespace
  • {1} - The SqlMap statement id
  • {2} - The parameter object
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)

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.

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.

protected abstract void configureInsertMethodTemplate ()

Override this method to configure an insert method template. A method template is a string with three substitution markers that we will fill in when generating code. The substitution markers will be:

  • {0} - The SqlMap namespace
  • {1} - The SqlMap statement id
  • {2} - The parameter object
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)

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.

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.

protected abstract void configureQueryForListMethodTemplate ()

Override this method to configure a queryForList method template. A method template is a string with three substitution markers that we will fill in when generating code. The substitution markers will be:

  • {0} - The SqlMap namespace
  • {1} - The SqlMap statement id
  • {2} - The parameter object
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)

protected abstract void configureQueryForObjectMethodTemplate ()

Override this method to configure a queryForObject method template. A method template is a string with three substitution markers that we will fill in when generating code. The substitution markers will be:

  • {0} - The SqlMap namespace
  • {1} - The SqlMap statement id
  • {2} - The parameter object
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)

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.

protected abstract void configureUpdateMethodTemplate ()

Override this method to configure an update method template. A method template is a string with three substitution markers that we will fill in when generating code. The substitution markers will be:

  • {0} - The SqlMap namespace
  • {1} - The SqlMap statement id
  • {2} - The parameter object
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)

protected void setConstructorTemplate (Method constructorTemplate)

protected void setDeleteMethodTemplate (String deleteMethodTemplate)

protected void setInsertMethodTemplate (String insertMethodTemplate)

protected void setQueryForListMethodTemplate (String queryForListMethodTemplate)

protected void setQueryForObjectMethodTemplate (String queryForObjectMethodTemplate)

protected void setSuperClass (FullyQualifiedJavaType superClass)

protected void setUpdateMethodTemplate (String updateMethodTemplate)