List of usage examples for org.apache.commons.lang3 StringUtils lowerCase
public static String lowerCase(final String str)
Converts a String to lower case as per String#toLowerCase() .
A null input String returns null .
StringUtils.lowerCase(null) = null StringUtils.lowerCase("") = "" StringUtils.lowerCase("aBc") = "abc"
Note: As described in the documentation for String#toLowerCase() , the result of this method is affected by the current locale.
From source file:com.hesine.manager.generate.Generate.java
public static void execute(File curProjectPath, String packageName, String moduleName, Map<String, String> table, List<Map<String, String>> fileds) { // ========== ?? ==================== // ??????/* w w w . j a v a 2s. c o m*/ // ?{packageName}/{moduleName}/{dao,entity,service,web}/{subModuleName}/{className} // packageName ????applicationContext.xmlsrping-mvc.xml?base-package?packagesToScan?4? // String packageName = "com.hesine.manager"; // String moduleName = "function"; // ???sys // String moduleName = ""; // ???sys // String tableName = "tb_product"; // ???sys // String subModuleName = ""; // ????? // String className = "product"; // ??product // String classAuthor = "Jason"; // ThinkGem // String functionName = "?"; // ?? String tableName = table.get("tableName"); // ???sys String subModuleName = ""; // ????? String className = table.get("className"); // ??product String classAuthor = "Jason"; // ThinkGem String functionName = table.get("comment"); // ?? // ??? Boolean isEnable = true; // ========== ?? ==================== if (!isEnable) { logger.error("????isEnable = true"); return; } // StringUtils.isBlank(moduleName) || if (StringUtils.isBlank(packageName) || StringUtils.isBlank(className) || StringUtils.isBlank(functionName)) { logger.error("??????????????"); return; } // ? String separator = File.separator; // ? File projectPath = curProjectPath; // while(!new File(projectPath.getPath()+separator+"src"+separator+"main").exists()){ // projectPath = projectPath.getParentFile(); // } logger.info("Project Path: {}", projectPath); // ? String tmpProjectPath = "/Users/zhanghongbing/Workspaces/Projects/hesine-projects/github-framework/hesine-demo/hesine-portal"; String tplPath = StringUtils.replace(tmpProjectPath + "/src/main/java/com/hesine/manager/generate/template", "/", separator); // String tplPath = StringUtils.replace(projectPath+"/src/main/java/com/hesine/manager/generate/template", "/", separator); logger.info("Template Path: {}", tplPath); // Java String javaPath = StringUtils.replaceEach( projectPath + "/src/main/java/" + StringUtils.lowerCase(packageName), new String[] { "/", "." }, new String[] { separator, separator }); logger.info("Java Path: {}", javaPath); // Xml String xmlPath = StringUtils.replace(projectPath + "/src/main/resources/mybatis", "/", separator); logger.info("Xml Path: {}", xmlPath); // String viewPath = StringUtils.replace(projectPath + "/src/main/webapp/WEB-INF/views", "/", separator); logger.info("View Path: {}", viewPath); // ??? Map<String, Object> model = Maps.newHashMap(); model.put("packageName", StringUtils.lowerCase(packageName)); model.put("moduleName", StringUtils.lowerCase(moduleName)); model.put("subModuleName", StringUtils.isNotBlank(subModuleName) ? "." + StringUtils.lowerCase(subModuleName) : ""); model.put("className", StringUtils.uncapitalize(className)); model.put("ClassName", StringUtils.capitalize(className)); model.put("classAuthor", StringUtils.isNotBlank(classAuthor) ? classAuthor : "Generate Tools"); model.put("classVersion", DateUtils.getDate()); model.put("functionName", functionName); // model.put("tableName", model.get("moduleName")+(StringUtils.isNotBlank(subModuleName) // ?"_"+StringUtils.lowerCase(subModuleName):"")+"_"+model.get("className")); model.put("tableName", tableName); model.put("urlPrefix", model.get("moduleName") + (StringUtils.isNotBlank(subModuleName) ? "/" + StringUtils.lowerCase(subModuleName) : "") + "/" + model.get("className")); model.put("viewPrefix", //StringUtils.substringAfterLast(model.get("packageName"),".")+"/"+ model.get("urlPrefix")); model.put("permissionPrefix", model.get("moduleName") + (StringUtils.isNotBlank(subModuleName) ? ":" + StringUtils.lowerCase(subModuleName) : "") + ":" + model.get("className")); model.put("fileds", fileds); // ? Entity FileGenUtils.generateEntity(tplPath, javaPath, model); // ? sqlMap FileGenUtils.generateSqlMap(tplPath, xmlPath, model); // ? Model FileGenUtils.generateModel(tplPath, javaPath, model); // ? Dao FileGenUtils.generateDao(tplPath, javaPath, model); // ? Service FileGenUtils.generateService(tplPath, javaPath, model); // ? ServiceImpl FileGenUtils.generateServiceImpl(tplPath, javaPath, model); // ? Controller FileGenUtils.generateController(tplPath, javaPath, model); // // // ? add.ftl // FileGenUtils.generateAddFtl(tplPath, viewPath, model); // // // ? edit.ftl // FileGenUtils.generateEditFtl(tplPath, viewPath, model); // // ? list.ftl // FileGenUtils.generateListFtl(tplPath, viewPath, model); logger.info("Generate Success."); }
From source file:com.threewks.thundr.bigmetrics.service.BigMetricsServiceImpl.java
/** * Determines a (probably) unique id for an event table. * In this case, we hash the ordered columns of the data set and convert it to hex * /*from w ww .j a va2s. c o m*/ * @param eventName * @param columns * @return */ protected String determineTableId(String eventName, Map<String, BigQueryType> columns) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, BigQueryType> entry : columns.entrySet()) { sb.append(":"); sb.append(StringUtils.lowerCase(entry.getKey())); sb.append("="); sb.append(StringUtils.upperCase(entry.getValue().type())); } return eventName + "_" + Integer.toHexString(sb.toString().hashCode()); }
From source file:com.ottogroup.bi.asap.pipeline.MicroPipeline.java
/** * Submits the provided {@link OperatorExecutor} to the pipeline instance * @param operatorExecutor/*w w w. j a va2 s . com*/ * @throws RequiredInputMissingException * @throws ComponentAlreadySubmittedException */ public void submitOperatorExecutor(final OperatorExecutor operatorExecutor) throws RequiredInputMissingException, ComponentAlreadySubmittedException { /////////////////////////////////////////////////////////////////// // validate input if (operatorExecutor == null) throw new RequiredInputMissingException("Missing required input for 'operatorExecutor'"); if (StringUtils.isBlank(operatorExecutor.getOperatorId())) throw new RequiredInputMissingException("Missing required input for operator identifier"); // /////////////////////////////////////////////////////////////////// // normalize identifier to lower case String oid = StringUtils.lowerCase(StringUtils.trim(operatorExecutor.getOperatorId())); if (this.operatorExecutors.containsKey(oid)) throw new ComponentAlreadySubmittedException("Component '" + operatorExecutor.getOperatorId() + "' already submitted to pipeline '" + id + "'"); // add operator executor to internal map and submit it to executor service this.operatorExecutors.put(oid, operatorExecutor); this.executorService.submit(operatorExecutor); if (logger.isDebugEnabled()) logger.debug("operator executor submitted [pid=" + id + ", oid=" + oid + ", mb=" + operatorExecutor.getMailbox() + "]"); }
From source file:com.ottogroup.bi.spqr.pipeline.MicroPipelineManagerTest.java
/** * Test case for {@link MicroPipelineManager#hasPipeline(String)} with existing identifier *///from w w w . j a v a2 s . c o m @Test public void testHasPipeline_withExistingId() throws Exception { MicroPipelineConfiguration cfg = new MicroPipelineConfiguration(); cfg.setId("testExecutePipeline_withValidConfiguration"); MicroPipeline pipeline = Mockito.mock(MicroPipeline.class); Mockito.when(pipeline.getId()).thenReturn(cfg.getId()); MicroPipelineFactory factory = Mockito.mock(MicroPipelineFactory.class); Mockito.when(factory.instantiatePipeline(cfg, executorService)).thenReturn(pipeline); MicroPipelineManager manager = new MicroPipelineManager("id", factory, executorService); Assert.assertEquals("Values must be equal", StringUtils.lowerCase(StringUtils.trim(cfg.getId())), manager.executePipeline(cfg)); Assert.assertEquals("Values must be equal", 1, manager.getNumOfRegisteredPipelines()); Mockito.verify(factory).instantiatePipeline(cfg, executorService); Assert.assertTrue("Pipeline exists", manager.hasPipeline(cfg.getId())); }
From source file:com.hubrick.vertx.s3.signature.AWS4SignatureBuilder.java
public String buildSignature() { Preconditions.checkNotNull(signingKey, "SigningKey must be set to create a valid signature, awsSecretKey not set"); return StringUtils.lowerCase(BaseEncoding.base16().encode(hmacSha256(signingKey, makeSignatureString()))); }
From source file:com.ottogroup.bi.asap.resman.node.ProcessingNodeManager.java
/** * Generates an unique node identifier//from w w w . j av a 2 s. c o m * @param host * @param servicePort * @return * @throws RequiredInputMissingException thrown in case either the host or service port is missing */ protected String createNodeIdentifier(final String host, final int servicePort) throws RequiredInputMissingException { return new StringBuffer(StringUtils.lowerCase(StringUtils.trim(host))).append("#").append(servicePort) .toString(); }
From source file:com.ottogroup.bi.asap.pipeline.MicroPipeline.java
/** * Submits the provided {@link EmitterExecutor} to the pipeline instance * @param emitterExecutor/*www.j av a2 s . c om*/ * @throws RequiredInputMissingException * @throws ComponentAlreadySubmittedException */ public void submitEmitterExecutor(final EmitterExecutor emitterExecutor) throws RequiredInputMissingException, ComponentAlreadySubmittedException { /////////////////////////////////////////////////////////////////// // validate input if (emitterExecutor == null) throw new RequiredInputMissingException("Missing required input for 'emitterExecutor'"); if (StringUtils.isBlank(emitterExecutor.getEmitterId())) throw new RequiredInputMissingException("Missing required input for emitter identifier"); // /////////////////////////////////////////////////////////////////// // normalize identifier to lower case String eid = StringUtils.lowerCase(StringUtils.trim(emitterExecutor.getEmitterId())); if (this.emitterExecutors.containsKey(eid)) throw new ComponentAlreadySubmittedException("Component '" + emitterExecutor.getEmitterId() + "' already submitted to pipeline '" + id + "'"); // add emitter executor to internal map and submit it to executor service this.emitterExecutors.put(eid, emitterExecutor); this.executorService.submit(emitterExecutor); if (logger.isDebugEnabled()) logger.debug("emitter executor submitted [pid=" + id + ", eid=" + eid + ", mb=" + emitterExecutor.getMailbox() + "]"); }
From source file:ch.cyberduck.core.Local.java
@Override public int hashCode() { return path != null ? StringUtils.lowerCase(path).hashCode() : 0; }
From source file:com.adguard.commons.web.UrlUtils.java
/** * Extracts domain name from the url. Also crops www. * * @param url url//from w ww. jav a2 s. c om * @return domain name */ public static String getDomainName(URL url) { String host = url.getHost(); if (host == null) { return null; } int dotIndex = host.lastIndexOf('.'); if (dotIndex <= 0 || dotIndex == (host.length() - 1)) { // Check that dot is not the first or last char return null; } return StringUtils.lowerCase(cropWww(host)); }
From source file:com.ottogroup.bi.spqr.pipeline.MicroPipelineManagerTest.java
/** * Test case for {@link MicroPipelineManager#shutdownPipeline(String)} being provided * null as input which must not change the number of registered pipelines *//*from w ww .j a va 2 s. c o m*/ @Test public void testShutdownPipeline_withNullInput() throws Exception { MicroPipelineConfiguration cfg = new MicroPipelineConfiguration(); cfg.setId("testExecutePipeline_withValidConfiguration"); MicroPipeline pipeline = Mockito.mock(MicroPipeline.class); Mockito.when(pipeline.getId()).thenReturn(cfg.getId()); MicroPipelineFactory factory = Mockito.mock(MicroPipelineFactory.class); Mockito.when(factory.instantiatePipeline(cfg, executorService)).thenReturn(pipeline); MicroPipelineManager manager = new MicroPipelineManager("id", factory, executorService); Assert.assertEquals("Values must be equal", StringUtils.lowerCase(StringUtils.trim(cfg.getId())), manager.executePipeline(cfg)); Assert.assertEquals("Values must be equal", 1, manager.getNumOfRegisteredPipelines()); Mockito.verify(factory).instantiatePipeline(cfg, executorService); manager.shutdownPipeline(null); Assert.assertEquals("Values must be equal", 1, manager.getNumOfRegisteredPipelines()); }