List of usage examples for org.apache.commons.lang StringUtils uncapitalize
public static String uncapitalize(String str)
Uncapitalizes a String changing the first letter to title case as per Character#toLowerCase(char) .
From source file:com.zavakid.mushroom.lib.MetricMutableStat.java
/** * Construct a sample statistics metric//from w w w . jav a 2 s . c o m * * @param name of the metric * @param description of the metric * @param sampleName of the metric (e.g. "ops") * @param valueName of the metric (e.g. "time", "latency") * @param extended create extended stats (stdev, min/max etc.) by default. */ public MetricMutableStat(String name, String description, String sampleName, String valueName, boolean extended) { super(name, description); String desc = StringUtils.uncapitalize(description); numSamplesName = name + "_num_" + sampleName; numSamplesDesc = "Number of " + sampleName + " for " + desc; avgValueName = name + "_avg_" + valueName; avgValueDesc = "Average " + valueName + " for " + desc; stdevValueName = name + "_stdev_" + valueName; stdevValueDesc = "Standard deviation of " + valueName + " for " + desc; iMinValueName = name + "_imin_" + valueName; iMinValueDesc = "Interval min " + valueName + " for " + desc; iMaxValueName = name + "_imax_" + valueName; iMaxValueDesc = "Interval max " + valueName + " for " + desc; minValueName = name + "_min_" + valueName; minValueDesc = "Min " + valueName + " for " + desc; maxValueName = name + "_max_" + valueName; maxValueDesc = "Max " + valueName + " for " + desc; this.extended = extended; }
From source file:de.boksa.rt.rest.response.parser.processor.FieldProcessorRegistry.java
public FieldProcessor getTicketFieldProcessor(RTTicket ticket, String ticketFieldName) { FieldProcessor fieldProcessor = null; Matcher m = RTCustomField.PATTERN_CUSTOM_FIELD_NAME.matcher(ticketFieldName); if (m.matches()) { fieldProcessor = customFieldProcessors.get(m.group(1)); if (fieldProcessor == null) { fieldProcessor = DefaultCustomFieldProcessor.getInstance(); }// ww w .ja v a 2s .c o m } else { fieldProcessor = standardFieldProcessors.get(ticketFieldName); if (fieldProcessor == null) { try { fieldProcessor = typeFieldProcessors .get(PropertyUtils.getPropertyType(ticket, StringUtils.uncapitalize(ticketFieldName))); } catch (Exception ex) { ex.printStackTrace(); } } } return (fieldProcessor != null) ? fieldProcessor : DefaultFieldProcessor.getInstance(); }
From source file:com.swtxml.events.registry.WidgetEventListenerMethod.java
public String getName() { if (StyledText.class == listenerAddMethod.getDeclaringClass() && ExtendedModifyListener.class == getListenerInterfaceClass()) { return "extendedModifyText"; }/* w w w . j av a 2 s . c o m*/ if (Browser.class == listenerAddMethod.getDeclaringClass()) { return StringUtils .uncapitalize(StringUtils.replace(getListenerInterfaceClass().getSimpleName(), "Listener", "")) + StringUtils.capitalize(listenerMethod.getName()); } return listenerMethod.getName(); }
From source file:com.github.jdot.type.Property.java
public static String getPropertyName(String methodName) { String propertyName = ""; if (methodName.startsWith("set")) { propertyName = StringUtils.uncapitalize(methodName.substring(3)); } else if (methodName.startsWith("get")) { propertyName = StringUtils.uncapitalize(methodName.substring(3)); } else if (methodName.startsWith("is")) { propertyName = StringUtils.uncapitalize(methodName.substring(2)); } else {/*from w w w . ja v a 2s . c o m*/ throw new RuntimeException("Method does not declare JavaBean property: " + methodName); } return propertyName; }
From source file:com.evolveum.midpoint.prism.marshaller.XNodeProcessorUtil.java
public static <T> void parseProtectedType(ProtectedDataType<T> protectedType, MapXNode xmap, PrismContext prismContext, ParsingContext pc) throws SchemaException { RootXNode xEncryptedData = xmap.getEntryAsRoot(ProtectedDataType.F_ENCRYPTED_DATA); if (xEncryptedData != null) { if (!(xEncryptedData.getSubnode() instanceof MapXNode)) { throw new SchemaException("Cannot parse encryptedData from " + xEncryptedData); }// w ww. j av a 2 s . c om EncryptedDataType encryptedDataType = prismContext.parserFor(xEncryptedData).context(pc) .parseRealValue(EncryptedDataType.class); protectedType.setEncryptedData(encryptedDataType); } else { // Check for legacy EncryptedData RootXNode xLegacyEncryptedData = xmap.getEntryAsRoot(ProtectedDataType.F_XML_ENC_ENCRYPTED_DATA); if (xLegacyEncryptedData != null) { if (!(xLegacyEncryptedData.getSubnode() instanceof MapXNode)) { throw new SchemaException("Cannot parse EncryptedData from " + xEncryptedData); } RootXNode xConvertedEncryptedData = (RootXNode) xLegacyEncryptedData.cloneTransformKeys(in -> { String elementName = StringUtils.uncapitalize(in.getLocalPart()); if (elementName.equals("type")) { // this is rubbish, we don't need it, we don't want it return null; } return new QName(null, elementName); }); EncryptedDataType encryptedDataType = prismContext.parserFor(xConvertedEncryptedData).context(pc) .parseRealValue(EncryptedDataType.class); protectedType.setEncryptedData(encryptedDataType); if (protectedType instanceof ProtectedStringType) { transformEncryptedValue(protectedType, prismContext); } } } RootXNode xHashedData = xmap.getEntryAsRoot(ProtectedDataType.F_HASHED_DATA); if (xHashedData != null) { if (!(xHashedData.getSubnode() instanceof MapXNode)) { throw new SchemaException("Cannot parse hashedData from " + xHashedData); } HashedDataType hashedDataType = prismContext.parserFor(xHashedData).context(pc) .parseRealValue(HashedDataType.class); protectedType.setHashedData(hashedDataType); } // protected data empty..check for clear value if (protectedType.isEmpty()) { XNode xClearValue = xmap.get(ProtectedDataType.F_CLEAR_VALUE); if (xClearValue == null) { //TODO: try to use common namespace (only to be compatible with previous versions) //FIXME maybe add some warning, info... xClearValue = xmap.get(new QName(ProtectedDataType.F_CLEAR_VALUE.getLocalPart())); } if (xClearValue == null) { return; } if (!(xClearValue instanceof PrimitiveXNode)) { //this is maybe not good.. throw new SchemaException("Cannot parse clear value from " + xClearValue); } // TODO: clearValue T clearValue = (T) ((PrimitiveXNode) xClearValue).getParsedValue(DOMUtil.XSD_STRING, String.class); protectedType.setClearValue(clearValue); } }
From source file:com.opengamma.language.object.BeanFunctionProvider.java
private <T extends Bean> Collection<PublishedFunction> createBeanFunctions(Class<T> beanClass) { final Collection<PublishedFunction> functions = new ArrayList<PublishedFunction>(); final String simpleBeanName = beanClass.getSimpleName(); functions.add(new CreateBeanFunction(simpleBeanName, beanClass)); final MetaBean metaBean = JodaBeanUtils.metaBean(beanClass); final MetaParameter beanParameter = new MetaParameter(StringUtils.uncapitalize(simpleBeanName), JavaTypeInfo.builder(beanClass).get()); beanParameter.setDescription("is the " + simpleBeanName + " to query"); for (MetaProperty<?> property : metaBean.metaPropertyIterable()) { final String accessorFunctionName = "Get" + simpleBeanName + StringUtils.capitalize(property.name()); functions.add(new GetBeanPropertyFunction(accessorFunctionName, property, beanParameter)); }/* w w w . ja va 2 s . c o m*/ s_logger.debug("Created function definitions: " + functions); return functions; }
From source file:com.google.gdt.eclipse.designer.model.widgets.panels.SplitPanelInfo.java
/** * @return the name of region used to associate given {@link WidgetInfo}. *///from ww w.j a va2 s .c om private static String getRegion(WidgetInfo widget) { String region = getWidgetAssociationMethod(widget); region = StringUtils.substringBetween(region, "set", "Widget"); region = StringUtils.uncapitalize(region); return region; }
From source file:com.liferay.taglib.aui.ComponentTag.java
protected void processEventAttribute(String key, String value, Map<String, String> afterEventOptions, Map<String, String> onEventsOptions) { if (key.startsWith("after")) { String eventName = StringUtils.uncapitalize(key.substring(5)); afterEventOptions.put(eventName, value); } else {//from w w w . j a v a 2s. c om String eventName = StringUtils.uncapitalize(key.substring(2)); onEventsOptions.put(eventName, value); } }
From source file:gDao.util.Finder.java
/** * Used by gDao framework. Prepare filter, sort and relation lists before searching with hibernate *//*from w w w .j a v a 2 s . c om*/ public void prepareCriteria(Criteria criteria, Class persistentClass) { for (Criterion criterion : criterionList) criteria.add(criterion); for (Order order : orderList) criteria.addOrder(order); for (Filter filter : relationList) { String[] joinedColumns = filter.getJoinedColumns(); for (int i = 0, joinedColumnsLength = joinedColumns.length - 1; i < joinedColumnsLength; i++) { String relatedColumn = joinedColumns[i]; String firstJoin; String persistentClassName = StringUtils.uncapitalize(persistentClass.getSimpleName()); if (joinedColumns[i].equals(persistentClassName)) relatedColumn = joinedColumns[i + 1]; if (i == 0) firstJoin = persistentClassName; else firstJoin = joinedColumns[i - 1]; criteria.createCriteria(firstJoin + "." + relatedColumn, relatedColumn); } } if (maxResult != 0) criteria.setMaxResults(maxResult); }
From source file:com.opengamma.language.connector.LanguageSpringContext.java
public LanguageSpringContext() { _springContext = createSpringContext(); final String clientFactoryClassName = System.getProperty(CLIENT_FACTORY_CLASS_PROPERTY); if (!StringUtils.isBlank(clientFactoryClassName)) { try {/*from ww w. java2 s .co m*/ Class<?> clientFactoryClass = Class.forName(clientFactoryClassName); Method factoryFactoryMethod = clientFactoryClass.getMethod(CLIENT_FACTORY_METHOD); _clientFactories = (ClientFactoryFactory) factoryFactoryMethod.invoke(null); } catch (Exception e) { throw new OpenGammaRuntimeException("Error using custom client factory: " + clientFactoryClassName, e); } } else { _clientFactories = ClientFactory.getFactory(); } final ClientContextFactory clientContextFactory = getBean(StringUtils.uncapitalize(CLIENT_CONTEXT_FACTORY), ClientContextFactory.class); if (clientContextFactory != null) { _defaultClientFactory = _clientFactories .createClientFactory(clientContextFactory.createClientContext()); } else { s_logger.info("No default client context factory"); _defaultClientFactory = null; } _defaultSessionContextFactory = getBean(StringUtils.uncapitalize(SESSION_CONTEXT_FACTORY), SessionContextFactory.class); if (_defaultSessionContextFactory == null) { s_logger.info("No default session context factory"); } }