Class DomainObjectRenamingRule

java.lang.Object
org.mybatis.generator.config.DomainObjectRenamingRule

public class DomainObjectRenamingRule extends Object
This class is used to specify a renaming rule for table's domain object name. If domainObjectName is not configured, we'll build the domain object named based on the tableName or runtimeTableName. And then we use the domain object renaming rule to generate the final domain object name.

For example, if some tables are named:

  • SYS_USER
  • SYS_ROLE
  • SYS_FUNCTIONS

it might be annoying to have the generated domain name all containing the SYS prefix. This class can be used to remove the prefix by specifying

  • searchString="^Sys"
  • replaceString=""

Note that internally, the generator uses the java.util.regex.Matcher.replaceAll method for this function. See the documentation of that method for example of the regular expression language used in Java.

Author:
liuzh
  • Constructor Details

    • DomainObjectRenamingRule

      public DomainObjectRenamingRule()
  • Method Details

    • getReplaceString

      public String getReplaceString()
    • setReplaceString

      public void setReplaceString(String replaceString)
    • getSearchString

      public String getSearchString()
    • setSearchString

      public void setSearchString(String searchString)
    • validate

      public void validate(List<String> errors, String tableName)