List of usage examples for org.apache.commons.lang WordUtils uncapitalize
public static String uncapitalize(String str)
Uncapitalizes all the whitespace separated words in a String.
From source file:com.asual.summer.core.util.StringUtils.java
public static String toCamelCase(String str) { return WordUtils.uncapitalize(str); }
From source file:edu.utah.further.core.ws.WsUtil.java
/** * Return the convention path for both SOAP and REST web service classes. All web * service classes are assumed to end with "ServiceSoap" or "ServiceRest". The * correspondence is then: class "MyServiceSoap" -> path "my"; class "MyServiceRest" * -> path "my"./* w ww .ja v a 2 s.c om*/ * * @param serviceClass * SOAP or REST service class * @return corresponding web service deployment path */ public static String getWebServiceClassPath(final Class<?> serviceClass) { return WordUtils.uncapitalize(serviceClass.getSimpleName().replaceAll(SERVICE_SOAP_SUFFIX, EMPTY_STRING) .replaceAll(SERVICE_REST_SUFFIX, EMPTY_STRING)); }
From source file:au.com.dw.testdatacapturej.builder.BuilderUtil.java
/** * Create a field name to be used in the generated log for code that is creating an array, e.g. * in a construction line./*from w ww .j ava2 s . c o m*/ * * An example - * We want to generate a line in the log to create an array of the class org.test.Item, a * constructor line may be generated something like this: * org.test.Item[] [field name]0 = new org.test.Item[5]; * This method is responsible for creating the [field name] portion of that line, note that * it does not include the numerical index suffix which is generated elsewhere. * e.g. * org.test.Item[] itemArray0 = new org.test.Item[5]; * Here the method has created the field name fragment 'itemArray'. * * @param arrayType The fully qualified class name of the array type * @param fieldNamePrefix Any prefix to add to the field name * @param fieldNameSuffix Any suffix to add to the field name (not the index number) * @return The field name to be used for the array in the generated log, without the numerical index */ public static String createArrayClassFieldName(String arrayType, String fieldNamePrefix, String fieldNameSuffix) { String arrayFieldNameSuffix = "Array"; String objectType = arrayType; StringBuilder fieldNameBuilder = new StringBuilder(); // derive the class field name portion if (fieldNamePrefix != null) { fieldNameBuilder.append(fieldNamePrefix); objectType = WordUtils.capitalize(objectType.substring(objectType.lastIndexOf(".") + 1)); } else { objectType = WordUtils.uncapitalize(objectType.substring(objectType.lastIndexOf(".") + 1)); } fieldNameBuilder.append(objectType); fieldNameBuilder.append(arrayFieldNameSuffix); if (fieldNameSuffix != null) { fieldNameBuilder.append(fieldNameSuffix); } return fieldNameBuilder.toString(); }
From source file:au.com.dw.testdatacapturej.builder.MethodBuilder.java
/** * Create the end of the method wrapping code. * //from ww w . j av a 2s. co m * e.g. would generate something like: * * return objectClassName; * } * * @param object Object to be logged for code generation * @return */ public String createMethodCompletion(Object object) { StringBuilder builder = new StringBuilder(); // this is a kludge, should really get the field name from the recursive logging if possible // but here we are assuming that the field name will be the class name suffixed by '0' builder.append("\nreturn "); builder.append(WordUtils.uncapitalize(object.getClass().getSimpleName()) + "0;"); builder.append(SystemUtils.LINE_SEPARATOR); // end of method builder.append("}"); builder.append(SystemUtils.LINE_SEPARATOR); builder.append(SystemUtils.LINE_SEPARATOR); return builder.toString(); }
From source file:com.dbs.sdwt.jpa.JpaUniqueUtil.java
private String simpleUniqueConstraintError(Identifiable<?> entity, String property) { return WordUtils.uncapitalize(jpaUtil.getEntityName(entity)) + "_" + property + "_already_exists"; }
From source file:gov.redhawk.ide.internal.ui.templates.ResourceControlPanelTemplateSection.java
/** * @return/* www. ja v a 2 s.c om*/ */ private String getPropertyFieldsCode() { StringBuilder builder = new StringBuilder(); EObject selection = getSelection(); if (selection instanceof SoftPkg) { SoftPkg spd = (SoftPkg) selection; if (spd.getPropertyFile() != null && spd.getPropertyFile().getProperties() != null) { for (Simple s : spd.getPropertyFile().getProperties().getSimple()) { String field = getField(s, false); field = WordUtils.uncapitalize(field.replace(" ", "")); builder.append(" private Text " + field + ";\n"); } } } return builder.toString(); }
From source file:com.dbs.sdwt.jpa.JpaUniqueUtil.java
private String compositeUniqueConstraintErrorCode(Identifiable<?> entity, UniqueConstraint uniqueConstraint) { return WordUtils.uncapitalize(jpaUtil.getEntityName(entity)) + "_" + (uniqueConstraint.name() == null ? "composite_unique_constraint_error" : uniqueConstraint.name().toLowerCase()); }
From source file:com.willowtreeapps.androidcontentprovidergenerator.model.Field.java
public String getNameCamelCaseLowerCase() { return WordUtils.uncapitalize(getNameCamelCase()); }
From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.MemberLookupCompleter.java
/** * This method tries to find the class which is defined for the given filter and returns a set with all methods and fields of the class * * @param variableName/*from w w w . j a v a 2 s . com*/ * @param text * @param document * @return Set of methods and fields, never null */ private Set<String> resolveClass(String variableName, String text, Document document) { Set<String> items = new LinkedHashSet<>(); FileObject fo = getFileObject(document); ClassPath sourcePath = ClassPath.getClassPath(fo, ClassPath.SOURCE); ClassPath compilePath = ClassPath.getClassPath(fo, ClassPath.COMPILE); ClassPath bootPath = ClassPath.getClassPath(fo, ClassPath.BOOT); if (sourcePath == null) { return items; } ClassPath cp = ClassPathSupport.createProxyClassPath(sourcePath, compilePath, bootPath); MemberLookupResolver resolver = new MemberLookupResolver(text, cp); Set<MemberLookupResult> results = resolver.performMemberLookup( StringUtils.defaultString(StringUtils.substringBeforeLast(variableName, "."), variableName)); for (MemberLookupResult result : results) { Matcher m = GETTER_PATTERN.matcher(result.getMethodName()); if (m.matches() && m.groupCount() >= 2) { items.add(result.getVariableName() + "." + WordUtils.uncapitalize(m.group(2))); } else { items.add(result.getVariableName() + "." + WordUtils.uncapitalize(result.getMethodName())); } } return items; }
From source file:net.ageto.gyrex.persistence.jdbc.pool.internal.commands.ListPools.java
private TreeMap<String, String> readPoolConfig(final BoneCPDataSource dataSource) { final TreeMap<String, String> poolConfig = new TreeMap<String, String>(); final BoneCPConfig config = dataSource.getConfig(); for (final Method method : BoneCPConfig.class.getDeclaredMethods()) { String key = null;//from w w w.ja va 2s .com if (method.getName().startsWith("is")) { key = WordUtils.uncapitalize(method.getName().substring(2)); } else if (method.getName().startsWith("get")) { key = WordUtils.uncapitalize(method.getName().substring(3)); } else { continue; } // skip deprecated methods if ((null != method.getAnnotation(Deprecated.class)) || key.equals("maxConnectionAge")) { continue; } if ((method.getParameterTypes().length == 0) && (method.getReturnType() != Void.TYPE)) { try { final Object value = method.invoke(config); if (null != value) { poolConfig.put(key, String.valueOf(value)); } } catch (final Exception e) { // ignored } } } return poolConfig; }