FullyQualifiedTable { public String getDomainObjectName() { if (stringHasValue(domainObjectName)) { return domainObjectName; } String finalDomainObjectName; if (stringHasValue(runtimeTableName)) { finalDomainObjectName = JavaBeansUtil.getCamelCaseString(runtimeTableName, true); } else { finalDomainObjectName = JavaBeansUtil.getCamelCaseString(introspectedTableName, true); } if (domainObjectRenamingRule != null) { Pattern pattern = Pattern.compile(domainObjectRenamingRule.getSearchString()); String replaceString = domainObjectRenamingRule.getReplaceString(); replaceString = replaceString == null ? "" : replaceString; Matcher matcher = pattern.matcher(finalDomainObjectName); finalDomainObjectName = JavaBeansUtil.getFirstCharacterUppercase(matcher.replaceAll(replaceString)); } return finalDomainObjectName; } FullyQualifiedTable(String introspectedCatalog,
            String introspectedSchema, String introspectedTableName,
            String domainObjectName, String alias,
            boolean ignoreQualifiersAtRuntime, String runtimeCatalog,
            String runtimeSchema, String runtimeTableName,
            boolean delimitIdentifiers, DomainObjectRenamingRule domainObjectRenamingRule,
            Context context); String getIntrospectedCatalog(); String getIntrospectedSchema(); String getIntrospectedTableName(); String getFullyQualifiedTableNameAtRuntime(); String getAliasedFullyQualifiedTableNameAtRuntime(); String getDomainObjectName(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); String getAlias(); String getSubPackageForClientOrSqlMap(boolean isSubPackagesEnabled); String getSubPackageForModel(boolean isSubPackagesEnabled); String getDomainObjectSubPackage();  }
@Test public void testNormalCase() { FullyQualifiedTable fqt = new FullyQualifiedTable(null, "myschema", "mytable", null, null, false, null, null, null, false, null, null); assertThat(fqt.getDomainObjectName()).isEqualTo("Mytable"); }
@Test public void testNormalCaseWithPrefix() { FullyQualifiedTable fqt = new FullyQualifiedTable(null, "myschema", "sys_mytable", null, null, false, null, null, null, false, null, null); assertThat(fqt.getDomainObjectName()).isEqualTo("SysMytable"); }
@Test public void testRenamingRule() { DomainObjectRenamingRule renamingRule = new DomainObjectRenamingRule(); renamingRule.setSearchString("^Sys"); renamingRule.setReplaceString(""); FullyQualifiedTable fqt = new FullyQualifiedTable(null, "myschema", "sys_mytable", null, null, false, null, null, null, false, renamingRule, null); assertThat(fqt.getDomainObjectName()).isEqualTo("Mytable"); }
@Test public void testRenamingRule2() { DomainObjectRenamingRule renamingRule = new DomainObjectRenamingRule(); renamingRule.setSearchString("^Sys"); renamingRule.setReplaceString(""); FullyQualifiedTable fqt = new FullyQualifiedTable(null, "myschema", "sys_my_table", null, null, false, null, null, null, false, renamingRule, null); assertThat(fqt.getDomainObjectName()).isEqualTo("MyTable"); }
@Test public void testRenamingRuleNoUnderscore() { DomainObjectRenamingRule renamingRule = new DomainObjectRenamingRule(); renamingRule.setSearchString("^Sys"); renamingRule.setReplaceString(""); FullyQualifiedTable fqt = new FullyQualifiedTable(null, "myschema", "sysmytable", null, null, false, null, null, null, false, renamingRule, null); assertThat(fqt.getDomainObjectName()).isEqualTo("Mytable"); }
@Test public void testRenamingRuleNoUnderscore2() { DomainObjectRenamingRule renamingRule = new DomainObjectRenamingRule(); renamingRule.setSearchString("^Sys"); renamingRule.setReplaceString(""); FullyQualifiedTable fqt = new FullyQualifiedTable(null, "myschema", "sysmy_table", null, null, false, null, null, null, false, renamingRule, null); assertThat(fqt.getDomainObjectName()).isEqualTo("MyTable"); }