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

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

Introduction

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

Prototype

public static String capitalize(String str) 

Source Link

Document

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

Usage

From source file:com.belle.infrastructure.util.ReflectionUtils.java

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

From source file:com.liferay.alloy.util.ReservedAttributeUtil.java

public static String getSafeName(Attribute attribute) {
    String name = attribute.getName();

    Component component = attribute.getComponent();

    if (isReserved(attribute) && (component != null)) {
        String componentName = component.getName();

        name = componentName.toLowerCase().concat(StringUtils.capitalize(name));
    }/*from   w ww  .  jav a2s .c o  m*/

    return name;
}

From source file:es.amplia.research.maven.protodocbook.cmd.Factory.java

@SuppressWarnings("unchecked")
public static Cmd newCommand(String cmd)
        throws ClassNotFoundException, InstantiationException, IllegalAccessException {

    String packageName = Factory.class.getPackage().getName();

    String className = new StringBuilder().append(packageName).append(".").append(StringUtils.capitalize(cmd))
            .append("Cmd").toString();

    Class<Cmd> cmdClass = ((Class<Cmd>) Class.forName(className));

    return cmdClass.newInstance();
}

From source file:com.hubrick.raml.mojo.util.JavaNames.java

public static String toSimpleClassName(String className) {
    return StringUtils.capitalize(toJavaName(className));
}

From source file:dmh.swing.enumselect.EnumSelectAction.java

/**
 * Construct a new enum select action./*from w  w w.j av a 2s.  c om*/
 * @param enumValue The value this action represents.
 * @param enumSelectable Handler object for enum selections.
 */
EnumSelectAction(T enumValue, EnumSelectable<T> enumSelectable) {
    super(StringUtils.capitalize(enumValue.toString().toLowerCase()));
    this.enumValue = enumValue;
    this.enumSelectable = enumSelectable;
}

From source file:cn.com.widemex.core.utils.reflection.ReflectionUtils.java

/**
 * Setter.//ww w  .  j  av  a 2  s  . c o  m
 * 
 * @param propertyType Setter,valueClass.
 */
public static void invokeSetterMethod(Object obj, String propertyName, Object value, Class<?> propertyType) {
    Class<?> type = propertyType != null ? propertyType : value.getClass();
    String setterMethodName = "set" + StringUtils.capitalize(propertyName);
    invokeMethod(obj, setterMethodName, new Class[] { type }, new Object[] { value });
}

From source file:adalid.util.sql.SqlArtifact.java

public String getCapitalizedJavaName() {
    return StringUtils.capitalize(getJavaName());
}

From source file:com.common.poi.excel.util.Reflections.java

/**
 * Setter, ???/*from www . j a  v a  2  s. c om*/
 * ???.??.
 */
public static void invokeSetter(Object obj, String propertyName, Object value) {
    Object object = obj;
    String[] names = StringUtils.split(propertyName, ".");
    for (int i = 0; i < names.length; i++) {
        if (i < names.length - 1) {
            String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
            object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
        } else {
            String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
            invokeMethodByName(object, setterMethodName, new Object[] { value });
        }
    }
}

From source file:com.zauberlabs.commons.mom.NaiveProperties.java

/**
 * Answers the getter of a given property and class, or null, if such
 * property is not readable or inexistent
 *///from ww  w  .java 2 s  .c om
public static Method getterOrNull(@NonNull final Class<?> clazz, @NotEmpty final String propertyName) {
    String capitalizedName = StringUtils.capitalize(propertyName);
    return findMethodOrNull(clazz, 0, Strings.matches("(get|is)" + capitalizedName));
}

From source file:com.kalessil.phpStorm.phpInspectionsEA.inspectors.phpUnit.strategy.AssertConstantStrategy.java

static public boolean apply(@NotNull String methodName, @NotNull MethodReference reference,
        @NotNull ProblemsHolder holder) {
    boolean result = false;
    if (targetMapping.containsKey(methodName)) {
        final PsiElement[] arguments = reference.getParameters();
        if (arguments.length > 1) {
            for (final PsiElement argument : arguments) {
                if (argument instanceof ConstantReference) {
                    final String constantName = ((ConstantReference) argument).getName();
                    if (constantName != null) {
                        final String constantNameNormalized = constantName.toLowerCase();
                        if (targetConstants.contains(constantNameNormalized)) {
                            final String suggestedAssertion = String.format(targetMapping.get(methodName),
                                    StringUtils.capitalize(constantNameNormalized));
                            final String[] suggestedArguments = new String[arguments.length - 1];
                            suggestedArguments[0] = Arrays.stream(arguments).filter(a -> a != argument)
                                    .findFirst().get().getText();
                            if (arguments.length > 2) {
                                suggestedArguments[1] = arguments[2].getText();
                            }// w  w w  .ja va2s . c  o  m
                            holder.registerProblem(reference, String.format(messagePattern, suggestedAssertion),
                                    new PhpUnitAssertFixer(suggestedAssertion, suggestedArguments));

                            result = true;
                            break;
                        }
                    }
                }
            }
        }
    }
    return result;
}