List of usage examples for org.apache.commons.lang StringUtils capitalize
public static String capitalize(String str)
Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .
From source file:hydrograph.ui.graph.execution.tracking.preferences.JobRunPreferenceComposite.java
/** * @param selection//from www. ja v a2 s . c o m */ private void createSaveJobPromtGroup(String selection) { HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE); hydroGroup.setHydroGroupText(Messages.SAVE_JOBS_BEFORE_LAUNCHING_MESSAGE); hydroGroup.setLayout(new GridLayout(1, false)); hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false)); hydroGroup.getHydroGroupClientArea().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnRadioButtonAlways = new Button(hydroGroup.getHydroGroupClientArea(), SWT.RADIO); btnRadioButtonAlways.setText(StringUtils.capitalize((MessageDialogWithToggle.ALWAYS))); btnRadioButtonPrompt = new Button(hydroGroup.getHydroGroupClientArea(), SWT.RADIO); btnRadioButtonPrompt.setText(StringUtils.capitalize(MessageDialogWithToggle.PROMPT)); if (StringUtils.equals(selection, MessageDialogWithToggle.ALWAYS)) { btnRadioButtonAlways.setSelection(true); } else { btnRadioButtonPrompt.setSelection(true); } }
From source file:net.sourceforge.fenixedu.util.BundleUtil.java
private static ResourceBundle getResourceBundleByModuleName(String moduleName) { moduleName = StringUtils.capitalize(moduleName); try {//w w w.j ava 2s . c om return getResourceBundleByName(RESOURCES_PREFIX + moduleName + RESOURCES_SUFFIX); } catch (MissingResourceException ex) { return getResourceBundleByName(RESOURCES_PREFIX + moduleName); } }
From source file:hydrograph.ui.engine.ui.converter.OutputUiConverter.java
/** * Returns parameter value or TypeTrueFalse as read from engine xml * @param value//from w ww . j ava 2s . c om * @param propertyName * @return */ public Object convertToTrueFalseValue(TypeTrueFalse value, String propertyName) { LOGGER.debug("Converting Boolean to String - {}", propertyName); Object parsedValue = getValue(PropertyNameConstants.OVER_WRITE.value()); if (parsedValue != null) { return parsedValue; } else { if (value != null && TrueFalse.FALSE.equals(value.getValue())) return StringUtils.capitalize(TrueFalse.FALSE.value()); else { return StringUtils.capitalize(TrueFalse.TRUE.value()); } } }
From source file:com.alibaba.jstorm.ui.model.pages.HomePage.java
public void generateTables() { long start = System.nanoTime(); try {//from w ww .j a v a2s . c o m LOG.info("ClusterPage init..."); Map conf = UIUtils.readUiConfig(); List<Map> uiClusters = ConfigExtension.getUiClusters(conf); if (uiClusters == null) { return; } TableData table = new TableData(); tables.add(table); List<String> headers = table.getHeaders(); List<Map<String, ColumnData>> lines = table.getLines(); table.setName("Cluster List"); headers.add(StringUtils.capitalize(UIDef.CLUSTER)); headers.add(HEADER_ZK_ROOT); headers.add(HEADER_ZK_SERVERS); headers.add(HEADER_ZK_PORT); for (Map cluster : uiClusters) { Map<String, ColumnData> line = new HashMap<String, ColumnData>(); lines.add(line); String clusterName = ConfigExtension.getUiClusterName(cluster); ColumnData clusterColumn = new ColumnData(); LinkData linkData = new LinkData(); linkData.setUrl(UIDef.LINK_TABLE_PAGE); linkData.setText(clusterName); linkData.addParam(UIDef.PAGE_TYPE, UIDef.PAGE_TYPE_CLUSTER); linkData.addParam(UIDef.CLUSTER, clusterName); clusterColumn.addLinkData(linkData); line.put(StringUtils.capitalize(UIDef.CLUSTER), clusterColumn); String zkRoot = ConfigExtension.getUiClusterZkRoot(cluster); ColumnData zkRootColumn = new ColumnData(); zkRootColumn.addText(zkRoot); line.put(HEADER_ZK_ROOT, zkRootColumn); List<String> servers = ConfigExtension.getUiClusterZkServers(cluster); ColumnData zkServerColumn = new ColumnData(); for (String server : servers) { zkServerColumn.addText(server); } line.put(HEADER_ZK_SERVERS, zkServerColumn); String port = String.valueOf(ConfigExtension.getUiClusterZkPort(cluster)); ColumnData zkPortColumn = new ColumnData(); zkPortColumn.addText(port); line.put(HEADER_ZK_PORT, zkPortColumn); } } catch (Exception e) { LOG.error("Failed to get cluster information:", e); throw new RuntimeException(e); } finally { long end = System.nanoTime(); UIMetrics.updateHistorgram(this.getClass().getSimpleName(), (end - start) / 1000000.0d); LOG.info("Finish ClusterPage"); } }
From source file:com.github.geequery.codegen.Junit4Generator.java
private void addTestMethod(JavaUnit unit, String name) { JavaMethod m = new JavaMethod("test" + StringUtils.capitalize(name)); m.setAnnotations("@Test"); m.addContent("fail(\"Not yet implemented\");"); unit.addMethod(m);// ww w. j ava 2 s. c o m }
From source file:de.anhquan.config4j.internal.ConfigHandler.java
private Object invokeGetter(Object proxy, Method method) { @SuppressWarnings("unchecked") Class clsReturnType = method.getReturnType(); String strReturnType = StringUtils.capitalize(ClassUtils.getShortClassName(clsReturnType)); String configMethodName = "get" + strReturnType; String propName = findPropertyName(method); try {//from w w w . j a v a 2 s. c o m Method getter = Configuration.class.getMethod(configMethodName, String.class); //String.class is for propName return getter.invoke(configuration, propName); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { return findDefaultValue(method, clsReturnType); } return null; }
From source file:com.github.jdot.file.builder.BeanBuilder.java
private String getSetterMethod(String propertyName, String type) { return "set" + StringUtils.capitalize(propertyName); }
From source file:jp.codic.plugins.netbeans.utils.CodicUtils.java
/** * Convert from default case to camel case. * * @param text//from w w w .jav a2s . c om * @return camel case text */ public static String toCamelCase(String text) { if (StringUtils.isEmpty(text)) { return text; } StringBuilder sb = new StringBuilder(); String[] words = toWords(text); boolean first = true; for (String word : words) { sb.append(first ? word.toLowerCase() : StringUtils.capitalize(word)); if (first) { first = false; } } return sb.toString(); }
From source file:com.github.pfmiles.minvelocity.biztest.ApiCodeGenUtilTest.java
private static List<JavaSourceFile> genParamPojos(List<NsInfo> infos, Site site) { List<JavaSourceFile> ret = new ArrayList<JavaSourceFile>(); for (NsInfo ns : infos) { for (ApiInfo api : ns.getApiInfos()) { Map<String, Object> ctxPojo = getCtxMap(); ctxPojo.put("site", site); ctxPojo.put("api", api); ctxPojo.put("ns", ns); JavaSourceFile paramFile = new JavaSourceFile( StringUtils.capitalize(api.getMethodName()) + "Param.java", site.getBasePkgName() + ".param." + ns.getNsName(), TemplateUtil.render("sdkTemp/code/apiParam.vm", ctxPojo)); // JavaCodeFormattingUtil.tryFormat(paramFile); ret.add(paramFile);//w w w .j a v a 2 s .c om } } return ret; }
From source file:ch.caleb.scaffolding.grid.column.IColumnFactory.java
private IModel<String> getHeaderModel(GridMetaData data, String key) { if (StringUtils.isNotEmpty(data.headerKey())) { return new ResourceModel(key); } else {/*from w w w . j ava2s. c o m*/ return new Model<String>(StringUtils.capitalize(key)); } }