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.github.jdot.util.NameUtil.java
public final static String classNameToFieldName(String className) { return StringUtils.uncapitalize(className); }
From source file:desi.juan.internal.util.MethodGeneratorUtils.java
public static String uriToCammelCase(String uri) { uri = uri.replace("{", "/").replace("}", "/"); StringBuilder result = new StringBuilder(); for (String word : StringUtils.split(uri, "/")) { if (word.contains("_")) { word = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, word); }//w ww. j a v a2 s. c o m result.append(StringUtils.capitalize(word)); } return StringUtils.uncapitalize(result.toString()); }
From source file:hr.fer.zemris.vhdllab.util.BeanUtil.java
public static String beanName(Class<?> clazz) { Validate.notNull(clazz, "Bean class can't be null"); return StringUtils.uncapitalize(clazz.getSimpleName()); }
From source file:com.liferay.alloy.util.ReservedAttributeUtil.java
public static String getOriginalName(String componentName, String attributeName) { String originalName = StringUtils.uncapitalize( StringUtil.replaceFirst(attributeName, componentName.toLowerCase(), StringPool.BLANK)); if (isReserved(originalName)) { attributeName = originalName;//from w ww. ja va 2 s . c o m } return attributeName; }
From source file:com.openshift.restclient.utils.BeanUtils.java
/** * Convert a delimited string to camelcase (e.g. foo-bar -> fooBar) * @param name the string to convert * @param delimiter the delimiter to use * @return the delimited string camelcased *//* www.j a v a 2s . c om*/ public static String toCamelCase(String name, String delimiter) { String[] parts = name.split("-"); List<String> capitalized = Stream.of(parts).map(p -> StringUtils.capitalize(p)) .collect(Collectors.toList()); return StringUtils.uncapitalize(StringUtils.join(capitalized, "")); }
From source file:com.zauberlabs.commons.mom.internal.UpperCaseNamingStyle.java
@Override public String getPropertyName(String mapKey) { return StringUtils.uncapitalize(mapKey); }
From source file:de.boksa.rt.rest.response.parser.processor.AbstractBeanProcessor.java
protected void copyProperty(Object object, String name, Object value) { try {//from w w w . j a v a 2 s . co m BeanUtils.copyProperty(object, StringUtils.uncapitalize(name), value); } catch (Exception ex) { } }
From source file:adalid.util.sql.SqlArtifact.java
public String getDecapitalizedJavaName() { return StringUtils.uncapitalize(getJavaName()); }
From source file:com.haulmont.chile.core.model.utils.MethodsCache.java
public MethodsCache(Class clazz) { final Method[] methods = clazz.getMethods(); for (Method method : methods) { String name = method.getName(); if (name.startsWith("get") && method.getParameterTypes().length == 0) { name = StringUtils.uncapitalize(name.substring(3)); method.setAccessible(true);/* www .ja va 2 s. c o m*/ getters.put(name, method); } if (name.startsWith("is") && method.getParameterTypes().length == 0) { name = StringUtils.uncapitalize(name.substring(2)); method.setAccessible(true); getters.put(name, method); } else if (name.startsWith("set") && method.getParameterTypes().length == 1) { name = StringUtils.uncapitalize(name.substring(3)); method.setAccessible(true); setters.put(name, method); } } }
From source file:com.github.jdot.type.Property.java
/** * Returns new BeanProperty instance if the specified element is a JavaBean accessor method, otherwise null. * /*from w w w . j a va 2 s. c om*/ * @param element * @return */ public static Property build(Type owner, ExecutableElement element) { Property beanProperty = null; String name = null; boolean propertyFound = true; boolean writeable = false; String type = null; // Check modifiers boolean publicFound = false; boolean staticFound = false; for (Modifier modifier : element.getModifiers()) { if (Modifier.PUBLIC.equals(modifier)) { publicFound = true; } if (Modifier.STATIC.equals(modifier)) { staticFound = true; } } if (!publicFound || staticFound) { propertyFound = false; } // Check method name if (propertyFound) { String methodName = element.getSimpleName().toString(); if (methodName.startsWith("set") && Character.isUpperCase(methodName.charAt(3))) { name = StringUtils.uncapitalize(methodName.substring(3)); writeable = true; } else if (methodName.startsWith("get") && Character.isUpperCase(methodName.charAt(3))) { name = StringUtils.uncapitalize(methodName.substring(3)); } else if (methodName.startsWith("is") && Character.isUpperCase(methodName.charAt(2))) { name = StringUtils.uncapitalize(methodName.substring(2)); } else { propertyFound = false; } } // Check arguments / return type if (propertyFound) { if (writeable) { if (element.getParameters().size() == 1 && TypeKind.VOID.equals(element.getReturnType().getKind())) { type = element.getParameters().get(0).asType().toString(); } else { propertyFound = false; } } else { if (TypeKind.VOID.equals(element.getReturnType().getKind())) { propertyFound = false; } else { type = element.getReturnType().toString(); } } } if (propertyFound) { beanProperty = new Property(owner, element, name, type, writeable); } return beanProperty; }