.
This commit is contained in:
@@ -189,4 +189,36 @@ public class RunTest<T> {
|
||||
System.out.println(metaTables.size());
|
||||
}
|
||||
|
||||
TplKit tplKit = TplKit.use();
|
||||
|
||||
@Test
|
||||
public void buildMethod() {
|
||||
tplKit.addTpl("/tpl/_t.tpl");
|
||||
|
||||
buildMethod("table_link_list", "实体表,包含link信息的列表");
|
||||
}
|
||||
|
||||
private void buildMethod(String url, String comment) {
|
||||
|
||||
String[] arr = url.split("_");
|
||||
String methodName = "";
|
||||
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (i == 0) {
|
||||
methodName = arr[i].toLowerCase();
|
||||
} else {
|
||||
methodName += toUpperCaseFirst(arr[i].toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
Kv kv = Kv.of("url", url).set("comment", comment).set("methodName", methodName);
|
||||
String tpl = tplKit.getTpl("service.method", kv, false);
|
||||
System.out.println(tpl);
|
||||
}
|
||||
private String toUpperCaseFirst(String str){
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user