Example usage for org.apache.commons.lang3 StringUtils capitalize

List of usage examples for org.apache.commons.lang3 StringUtils capitalize

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils capitalize.

Prototype

public static String capitalize(final String str) 

Source Link

Document

Capitalizes a String changing the first letter to title case as per Character#toTitleCase(char) .

Usage

From source file:be.nille.generator.parser.ParserUtils.java

public static String createEntityName(String string) {
    return StringUtils.capitalize(StringUtils.lowerCase(string));
}

From source file:cuchaz.m3l.lib.Side.java

public static Side get(String val) {
    return valueOf(StringUtils.capitalize(val.toLowerCase()));
}

From source file:be.nille.generator.parser.ParserUtils.java

public static String createFieldName(String string) {
    String[] array = string.split("\\_");
    if (array.length > 1) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < array.length; i++) {
            String s = array[i];//from  w  w  w  .  j av  a2s  . co  m
            if (i > 0) {
                s = StringUtils.capitalize(s);
            }
            sb.append(s);
        }
        return sb.toString();
    }
    return string;
}

From source file:android.databinding.tool.util.ParserHelper.java

public static String toClassName(String name) {
    StringBuilder builder = new StringBuilder();
    for (String item : name.split("[_-]")) {
        builder.append(StringUtils.capitalize(item));
    }// www . ja  va  2 s  . co  m
    return builder.toString();
}

From source file:com.jdy.ddj.common.utils.Reflections.java

/**
 * Getter./*from www .  j  av  a2s.  c om*/
 */
public static Object invokeGetter(Object obj, String propertyName) {
    String getterMethodName = "get" + StringUtils.capitalize(propertyName);
    return invokeMethod(obj, getterMethodName, new Class[] {}, new Object[] {});
}

From source file:cn.taqu.core.modules.utils.ReflectionUtils.java

/**
 * Getter./*from  ww  w . ja v  a 2  s  .  c  om*/
 */
public static Object invokeGetterMethod(Object obj, String propertyName) {
    String getterMethodName = "get" + StringUtils.capitalize(propertyName);
    return invokeMethod(obj, getterMethodName, new Class[] {}, new Object[] {});
}

From source file:com.threewks.thundr.view.jsp.el.StringFunctions.java

public static String sentenceCase(Object arg) {
    return arg == null ? null : StringUtils.capitalize(arg.toString());
}

From source file:com.cnksi.core.tools.utils.Reflections.java

/**
 * Getter.//  w  w  w  .  j  av  a2  s  . c  om
 */
public static Object invokeGetter(Object obj, String propertyName) {

    String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(propertyName);
    return invokeMethod(obj, getterMethodName, new Class[] {}, new Object[] {});
}

From source file:activiti.common.persistence.util.ReflectHelper.java

/**
 * Getter./*from  ww w. ja v a 2  s.c  o m*/
 */
public static Object invokeGetter(Object obj, String propertyName) {
    String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(propertyName);
    return invokeMethod(obj, getterMethodName, new Class[] {}, new Object[] {});
}

From source file:com.luna.common.utils.ReflectUtils.java

public static String getGetterMethodName(Object target, String fieldName) throws NoSuchMethodException {
    String methodName = "get" + StringUtils.capitalize(fieldName);

    try {/*ww w .j  a  va 2s . c  o m*/
        target.getClass().getDeclaredMethod(methodName);
    } catch (NoSuchMethodException ex) {
        methodName = "is" + StringUtils.capitalize(fieldName);

        target.getClass().getDeclaredMethod(methodName);
    }

    return methodName;
}