@Test public void test() throws Exception { SqlFileConstantNamingRuleImpl namingRule = new SqlFileConstantNamingRuleImpl(); assertEquals("AAA", namingRule.fromPathToConstantName("aaa")); assertEquals("AAA", namingRule.fromPathToConstantName("aaa.sql")); assertEquals("AAA_BBB", namingRule .fromPathToConstantName("aaa/bbb.sql")); assertEquals("BBB_CCC", namingRule .fromPathToConstantName("aaa/bbb/ccc.sql")); }
public String fromPathToConstantName(String path) { if (path == null) { throw new NullPointerException("path"); } if (path.endsWith(".sql")) { path = path.substring(0, path.length() - 4); } String[] segments = path.split("/"); if (segments.length >= 2) { String directoryName = segments[segments.length - 2]; String fileName = segments[segments.length - 1]; return StringUtil.decamelize(directoryName) + "_" + StringUtil.decamelize(fileName); } return path.toUpperCase(); }
SqlFileConstantNamingRuleImpl implements SqlFileConstantNamingRule { public String fromPathToConstantName(String path) { if (path == null) { throw new NullPointerException("path"); } if (path.endsWith(".sql")) { path = path.substring(0, path.length() - 4); } String[] segments = path.split("/"); if (segments.length >= 2) { String directoryName = segments[segments.length - 2]; String fileName = segments[segments.length - 1]; return StringUtil.decamelize(directoryName) + "_" + StringUtil.decamelize(fileName); } return path.toUpperCase(); } }
SqlFileConstantNamingRuleImpl implements SqlFileConstantNamingRule { public String fromPathToConstantName(String path) { if (path == null) { throw new NullPointerException("path"); } if (path.endsWith(".sql")) { path = path.substring(0, path.length() - 4); } String[] segments = path.split("/"); if (segments.length >= 2) { String directoryName = segments[segments.length - 2]; String fileName = segments[segments.length - 1]; return StringUtil.decamelize(directoryName) + "_" + StringUtil.decamelize(fileName); } return path.toUpperCase(); }  }
SqlFileConstantNamingRuleImpl implements SqlFileConstantNamingRule { public String fromPathToConstantName(String path) { if (path == null) { throw new NullPointerException("path"); } if (path.endsWith(".sql")) { path = path.substring(0, path.length() - 4); } String[] segments = path.split("/"); if (segments.length >= 2) { String directoryName = segments[segments.length - 2]; String fileName = segments[segments.length - 1]; return StringUtil.decamelize(directoryName) + "_" + StringUtil.decamelize(fileName); } return path.toUpperCase(); }  String fromPathToConstantName(String path); }
SqlFileConstantNamingRuleImpl implements SqlFileConstantNamingRule { public String fromPathToConstantName(String path) { if (path == null) { throw new NullPointerException("path"); } if (path.endsWith(".sql")) { path = path.substring(0, path.length() - 4); } String[] segments = path.split("/"); if (segments.length >= 2) { String directoryName = segments[segments.length - 2]; String fileName = segments[segments.length - 1]; return StringUtil.decamelize(directoryName) + "_" + StringUtil.decamelize(fileName); } return path.toUpperCase(); }  String fromPathToConstantName(String path);  }