Java Code Examples for org.apache.commons.lang.StringUtils#uncapitalize()
The following examples show how to use
org.apache.commons.lang.StringUtils#uncapitalize() .
These examples are extracted from open source projects.
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 Project: fenixedu-academic File: OperatorValidatePartyContactsDA.java License: GNU Lesser General Public License v3.0 | 6 votes |
@Atomic private void sendPhysicalAddressValidationEmail(PhysicalAddressValidation physicalAddressValidation) { final Person person = (Person) physicalAddressValidation.getPartyContact().getParty(); final String subject = BundleUtil.getString(Bundle.MANAGER, "label.contacts.validation.operator.email.subject", Unit.getInstitutionAcronym()); final String state = StringUtils.uncapitalize(physicalAddressValidation.getState().getPresentationName()); String body = BundleUtil.getString(Bundle.MANAGER, "label.contacts.validation.operator.email.body", physicalAddressValidation .getPartyContact().getPresentationValue(), state); final String description = physicalAddressValidation.getDescription(); if (!StringUtils.isEmpty(description)) { body += "\n" + description; } final String sendingEmail = person.getEmailForSendingEmails(); if (!StringUtils.isEmpty(sendingEmail)) { Message.fromSystem() .singleBcc(sendingEmail) .subject(subject) .textBody(body) .send(); } }
Example 2
Source Project: projectforge-webapp File: ScriptDao.java License: GNU General Public License v3.0 | 6 votes |
/** * Adds all registered dao's and other variables, such as appId, appVersion and task-tree. These variables are available in Groovy scripts * @param scriptVariables */ public void addScriptVariables(final Map<String, Object> scriptVariables) { scriptVariables.put("appId", AppVersion.APP_ID); scriptVariables.put("appVersion", AppVersion.NUMBER); scriptVariables.put("appRelease", AppVersion.RELEASE_DATE); scriptVariables.put("reportList", null); scriptVariables.put("taskTree", new ScriptingTaskTree(taskTree)); for (final RegistryEntry entry : Registry.instance().getOrderedList()) { final ScriptingDao< ? > scriptingDao = entry.getScriptingDao(); if (scriptingDao != null) { final String varName = StringUtils.uncapitalize(entry.getId()); scriptVariables.put(varName + "Dao", scriptingDao); } } }
Example 3
Source Project: sep4j File: SepStringHelper.java License: Apache License 2.0 | 5 votes |
/** * First Name => firstName * @param words * @return */ public static String wordsToUncapitalizedCamelCase(String words) { if (StringUtils.isBlank(words)) { return words; } String[] wordArray = StringUtils.split(words); List<String> capitalizedList = Arrays.stream(wordArray).map(w -> StringUtils.capitalize(w)) .collect(Collectors.toList()); String camel = StringUtils.join(capitalizedList, ""); return StringUtils.uncapitalize(camel); }
Example 4
Source Project: raml-java-client-generator File: NameHelper.java License: Apache License 2.0 | 5 votes |
public static String toCamelCase(String name, boolean startWithLowerCase) { char[] wordDelimiters = new char[]{'_', ' ', '-'}; if (containsAny(name, wordDelimiters)) { String capitalizedNodeName = WordUtils.capitalize(name, wordDelimiters); name = name.charAt(0) + capitalizedNodeName.substring(1); for (char c : wordDelimiters) { name = remove(name, c); } } return startWithLowerCase ? StringUtils.uncapitalize(name) : StringUtils.capitalize(name); }
Example 5
Source Project: pushfish-android File: AnnotationProcessingTaskFactory.java License: BSD 2-Clause "Simplified" License | 5 votes |
public void attachActions(PropertyInfo parent, Class<?> type) { Class<?> superclass = type.getSuperclass(); if (!(superclass == null // Avoid reflecting on classes we know we don't need to look at || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class) || superclass.equals(AbstractTask.class) || superclass.equals(Object.class) )) { attachActions(parent, superclass); } for (Method method : type.getDeclaredMethods()) { if (!isGetter(method)) { continue; } String name = method.getName(); int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'. String fieldName = StringUtils.uncapitalize(name.substring(prefixLength)); String propertyName = fieldName; if (parent != null) { propertyName = parent.getName() + '.' + propertyName; } PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method); attachValidationActions(propertyInfo, fieldName); if (propertyInfo.required) { properties.add(propertyInfo); } } }
Example 6
Source Project: big-c File: MutableQuantiles.java License: Apache License 2.0 | 5 votes |
/** * Instantiates a new {@link MutableQuantiles} for a metric that rolls itself * over on the specified time interval. * * @param name * of the metric * @param description * long-form textual description of the metric * @param sampleName * type of items in the stream (e.g., "Ops") * @param valueName * type of the values * @param interval * rollover interval (in seconds) of the estimator */ public MutableQuantiles(String name, String description, String sampleName, String valueName, int interval) { String ucName = StringUtils.capitalize(name); String usName = StringUtils.capitalize(sampleName); String uvName = StringUtils.capitalize(valueName); String desc = StringUtils.uncapitalize(description); String lsName = StringUtils.uncapitalize(sampleName); String lvName = StringUtils.uncapitalize(valueName); numInfo = info(ucName + "Num" + usName, String.format( "Number of %s for %s with %ds interval", lsName, desc, interval)); // Construct the MetricsInfos for the quantiles, converting to percentiles quantileInfos = new MetricsInfo[quantiles.length]; String nameTemplate = ucName + "%dthPercentile" + uvName; String descTemplate = "%d percentile " + lvName + " with " + interval + " second interval for " + desc; for (int i = 0; i < quantiles.length; i++) { int percentile = (int) (100 * quantiles[i].quantile); quantileInfos[i] = info(String.format(nameTemplate, percentile), String.format(descTemplate, percentile)); } estimator = new SampleQuantiles(quantiles); this.interval = interval; scheduler.scheduleAtFixedRate(new RolloverSample(this), interval, interval, TimeUnit.SECONDS); }
Example 7
Source Project: Pushjet-Android File: AnnotationProcessingTaskFactory.java License: BSD 2-Clause "Simplified" License | 5 votes |
public void attachActions(PropertyInfo parent, Class<?> type) { Class<?> superclass = type.getSuperclass(); if (!(superclass == null // Avoid reflecting on classes we know we don't need to look at || superclass.equals(ConventionTask.class) || superclass.equals(DefaultTask.class) || superclass.equals(AbstractTask.class) || superclass.equals(Object.class) )) { attachActions(parent, superclass); } for (Method method : type.getDeclaredMethods()) { if (!isGetter(method)) { continue; } String name = method.getName(); int prefixLength = name.startsWith("is") ? 2 : 3; // it's 'get' if not 'is'. String fieldName = StringUtils.uncapitalize(name.substring(prefixLength)); String propertyName = fieldName; if (parent != null) { propertyName = parent.getName() + '.' + propertyName; } PropertyInfo propertyInfo = new PropertyInfo(type, this, parent, propertyName, method); attachValidationActions(propertyInfo, fieldName); if (propertyInfo.required) { properties.add(propertyInfo); } } }
Example 8
Source Project: FlyCms File: AbstractTagPlugin.java License: MIT License | 5 votes |
@Override @PostConstruct public void init() throws TemplateModelException { String className = this.getClass().getName().substring(this.getClass().getName().lastIndexOf(".") + 1); String beanName = StringUtils.uncapitalize(className); String tagName = "fly_" + StringHelperUtils.toUnderline(beanName); freeMarkerConfigurer.getConfiguration().setSharedVariable(tagName, this.getApplicationContext().getBean(beanName)); }
Example 9
Source Project: configuration-as-code-plugin File: Configurator.java License: MIT License | 5 votes |
@NonNull static String normalize(@NonNull String name) { String result = name; if (result.toUpperCase().equals(name)) { result = result.toLowerCase(); } else { result = StringUtils.uncapitalize(name); } return result; }
Example 10
Source Project: rice File: XmlHelper.java License: Educational Community License v2.0 | 5 votes |
public static org.w3c.dom.Element propertiesToXml(org.w3c.dom.Document doc, Object o, String elementName) throws Exception { Class<?> c = o.getClass(); org.w3c.dom.Element wrapper = doc.createElement(elementName); Method[] methods = c.getMethods(); for (Method method : methods) { String name = method.getName(); if ("getClass".equals(name)) { continue; } // The post processor could be in another server and we would be unable to retrieve it. if ("getPostProcessor".equals(name)) { continue; } if (!name.startsWith("get") || method.getParameterTypes().length > 0) { continue; } name = name.substring("get".length()); name = StringUtils.uncapitalize(name); try { Object result = method.invoke(o); final String value; if (result == null) { LOG.debug("value of " + name + " method on object " + o.getClass() + " is null"); value = ""; } else { value = result.toString(); } org.w3c.dom.Element fieldE = doc.createElement(name); fieldE.appendChild(doc.createTextNode(value)); wrapper.appendChild(fieldE); } catch (Exception e) { throw new XmlException("Error accessing method '" + method.getName() + "' of instance of " + c, e); } } return wrapper; }
Example 11
Source Project: Pushjet-Android File: BuildConfigurationRule.java License: BSD 2-Clause "Simplified" License | 5 votes |
public void apply(String taskName) { if (taskName.startsWith(PREFIX)) { String configurationName = StringUtils.uncapitalize(taskName.substring(PREFIX.length())); Configuration configuration = configurations.findByName(configurationName); if (configuration != null) { Task task = tasks.create(taskName); task.dependsOn(configuration.getAllArtifacts()); task.setDescription(String.format("Builds the artifacts belonging to %s.", configuration)); } } }
Example 12
Source Project: Pushjet-Android File: DefaultSourceSet.java License: BSD 2-Clause "Simplified" License | 4 votes |
public String getRuntimeConfigurationName() { return StringUtils.uncapitalize(String.format("%sRuntime", getTaskBaseName())); }
Example 13
Source Project: pushfish-android File: TaskReportRenderer.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override protected String createHeader(Project project) { String header = super.createHeader(project); return "All tasks runnable from " + StringUtils.uncapitalize(header); }
Example 14
Source Project: Pushjet-Android File: TaskReportRenderer.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override protected String createHeader(Project project) { String header = super.createHeader(project); return "All tasks runnable from " + StringUtils.uncapitalize(header); }
Example 15
Source Project: pushfish-android File: DefaultSourceSet.java License: BSD 2-Clause "Simplified" License | 4 votes |
public String getCompileConfigurationName() { return StringUtils.uncapitalize(String.format("%sCompile", getTaskBaseName())); }
Example 16
Source Project: pushfish-android File: DefaultSourceSet.java License: BSD 2-Clause "Simplified" License | 4 votes |
public String getRuntimeConfigurationName() { return StringUtils.uncapitalize(String.format("%sRuntime", getTaskBaseName())); }
Example 17
Source Project: pushfish-android File: TaskReportRenderer.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override protected String createHeader(Project project) { String header = super.createHeader(project); return "All tasks runnable from " + StringUtils.uncapitalize(header); }
Example 18
Source Project: Pushjet-Android File: TaskReportRenderer.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override protected String createHeader(Project project) { String header = super.createHeader(project); return "All tasks runnable from " + StringUtils.uncapitalize(header); }
Example 19
Source Project: jdal File: ServiceBeanDefinitionParser.java License: Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ public AbstractBeanDefinition parse(Element element, ParserContext parserContext) { // default dao and service classes String daoClassName = JPA_DAO_CLASS_NAME; String serviceClassName = PERSISTENT_SERVICE_CLASS_NAME; String name = null; boolean declareService = false; if (element.hasAttribute(DAO_CLASS)) daoClassName = element.getAttribute(DAO_CLASS); if (element.hasAttribute(SERVICE_CLASS)) { serviceClassName = element.getAttribute(SERVICE_CLASS); declareService = true; } if (element.hasAttribute(NAME)) name = element.getAttribute(NAME); if (element.hasAttribute(ENTITY)) { String className = element.getAttribute(ENTITY); if (name == null) { name = StringUtils.uncapitalize( StringUtils.substringAfterLast(className, PropertyUtils.PROPERTY_SEPARATOR)); } parserContext.pushContainingComponent( new CompositeComponentDefinition(name, parserContext.extractSource(element))); // Dao BeanDefinitionBuilder daoBuilder = BeanDefinitionBuilder.genericBeanDefinition(daoClassName); NodeList nl = element.getElementsByTagNameNS(element.getNamespaceURI(), CRITERIA); if (nl.getLength() > 0) { ManagedMap<String, BeanReference> builders = new ManagedMap<String, BeanReference>(nl.getLength()); for (int i = 0; i < nl.getLength(); i++) { Element e = (Element) nl.item(i); builders.put(e.getAttribute(NAME), new RuntimeBeanReference(e.getAttribute(BUILDER))); } daoBuilder.addPropertyValue(CRITERIA_BUILDER_MAP, builders); } daoBuilder.addConstructorArgValue(ClassUtils.resolveClassName(className, null)); daoBuilder.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); String daoBeanName; if (declareService) { // use dao suffix daoBeanName = name + DAO_SUFFIX; registerBeanDefinition(parserContext, daoBuilder, daoBeanName); // register service wrapper String serviceBeanName = name + SERVICE_SUFFIX; BeanDefinitionBuilder serviceBuilder = BeanDefinitionBuilder.genericBeanDefinition(serviceClassName); serviceBuilder.addPropertyReference("dao", daoBeanName); registerBeanDefinition(parserContext, serviceBuilder, serviceBeanName); } else { // use service suffix for dao and declare an alias with dao suffix for compatibility with older api. daoBeanName = name + SERVICE_SUFFIX; String[] aliases = new String[] { name + DAO_SUFFIX }; BeanComponentDefinition bcd = new BeanComponentDefinition(daoBuilder.getBeanDefinition(), daoBeanName, aliases); parserContext.registerBeanComponent(bcd); } parserContext.popAndRegisterContainingComponent(); } return null; }
Example 20
Source Project: jdal File: BeanFilter.java License: Apache License 2.0 | 4 votes |
public BeanFilter() { this.filterName = StringUtils.uncapitalize(this.getClass().getSimpleName()); init(); }