Java Code Examples for com.jfinal.kit.StrKit#firstCharToUpperCase()
The following examples show how to use
com.jfinal.kit.StrKit#firstCharToUpperCase() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JbootServiceImplGenerator.java From jboot with Apache License 2.0 | 6 votes |
/** * base model 覆盖写入 */ protected void writeToFile(TableMeta tableMeta) throws IOException { File dir = new File(outputDir); if (!dir.exists()) { dir.mkdirs(); } String target =outputDir + File.separator + tableMeta.modelName + "Service" + StrKit.firstCharToUpperCase(implName) + ".java"; File targetFile = new File(target); if (targetFile.exists()) { return; } FileWriter fw = new FileWriter(target); try { fw.write(tableMeta.baseModelContent); } finally { fw.close(); } }
Example 2
Source File: ModuleUIGenerator.java From jpress with GNU Lesser General Public License v3.0 | 5 votes |
public ModuleUIGenerator(String moduleName, String modelPackage, List<TableMeta> tableMetaList) { this.tableMetaList = tableMetaList; this.moduleName = moduleName; this.modelPackage = modelPackage; modulePackage = modelPackage.substring(0, modelPackage.lastIndexOf(".")); basePath = PathKit.getWebRootPath() + "/../module-" + moduleName; webPath = basePath + "/module-" + moduleName + "-web"; String upcasedModuleName = StrKit.firstCharToUpperCase(moduleName); String moduleListenerPakcage = modelPackage.substring(0, modelPackage.lastIndexOf(".")); String controllerPackage = modelPackage.substring(0, modelPackage.lastIndexOf(".")) + ".controller"; moduleListenerOutputDir = webPath + "/src/main/java/" + moduleListenerPakcage.replace(".", "/"); controllerOutputDir = webPath + "/src/main/java/" + controllerPackage.replace(".", "/"); htmlOutputDir = webPath + "/src/main/webapp/WEB-INF/views/admin/" + moduleName; data = Kv.by("moduleName", moduleName);//product data.set("upcasedModuleName", upcasedModuleName);//Product data.set("modulePackage", modulePackage);//io.jpress.module.product data.set("modelPackage", modelPackage);//io.jpress.module.product.model data.set("moduleListenerPakcage", moduleListenerPakcage);//io.jpress.module.product data.set("controllerPackage", controllerPackage);//io.jpress.module.product.controller engine.setSourceFactory(new ClassPathSourceFactory()); engine.addSharedMethod(new StrKit()); }
Example 3
Source File: ModuleUIGenerator.java From jpress with GNU Lesser General Public License v3.0 | 4 votes |
public void generate(int genType) { String targetOutputDir = ""; if (ModuleUIGenerator.UI_MODULELISTENER == genType) { targetTemplate = templatesDir + templates[0]; targetOutputDir = moduleListenerOutputDir; targetOutputDirFile = targetOutputDir + File.separator + StrKit.firstCharToUpperCase(moduleName) + "ModuleInitializer" + ".java"; } for (TableMeta tableMeta : tableMetaList) { data.set("tableMeta", tableMeta); String lowerCaseModelName = StrKit.firstCharToLowerCase(tableMeta.modelName); data.set("lowerCaseModelName", lowerCaseModelName); if (ModuleUIGenerator.UI_CONTROLLER == genType) { targetTemplate = templatesDir + templates[1]; targetOutputDir = controllerOutputDir; targetOutputDirFile = targetOutputDir + File.separator + "_" + tableMeta.modelName + "Controller" + ".java"; } if (ModuleUIGenerator.UI_EDIT == genType) { targetTemplate = templatesDir + templates[2]; targetOutputDir = htmlOutputDir; targetOutputDirFile = targetOutputDir + File.separator + tableMeta.name + "_edit.html"; } if (ModuleUIGenerator.UI_LIST == genType) { targetTemplate = templatesDir + templates[3]; targetOutputDir = htmlOutputDir; targetOutputDirFile = targetOutputDir + File.separator + tableMeta.name + "_list.html"; } // tableMeta.columnMetas.get(0).remarks String content = engine.getTemplate(targetTemplate).renderToString(data); // File dir = new File(targetOutputDir); if (!dir.exists()) { dir.mkdirs(); } File targetFile = new File(targetOutputDirFile); if (targetFile.exists()) { return; } try { FileWriter fw = new FileWriter(targetOutputDirFile); try { fw.write(content); } finally { fw.close(); } } catch (IOException e) { e.printStackTrace(); } } }