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:cc.vidr.datum.tools.Console.java

private static void printFact(Literal fact, int depth) {
    Literal[] proof = Server.getProof(fact);
    String response = StringUtils.capitalize(QA.respond(fact));
    System.out.print(StringUtils.repeat("  ", depth));
    System.out.print("- ");
    System.out.print(response != null ? response : fact);
    System.out.println(proof.length > 0 ? ", because:" : ".");
    for (Literal literal : proof)
        printFact(literal, depth + 1);//from w w w.j  ava2  s. c o m
}

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

/**
 * Getter./*from ww  w  .  jav  a  2 s.c o  m*/
 * ???.??.
 */
public static Object invokeGetter(Object obj, String propertyName) {
    Object object = obj;
    for (String name : StringUtils.split(propertyName, ".")) {
        String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name);
        object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {});
    }
    return object;
}

From source file:edu.northwestern.bioinformatics.studycalendar.web.taglibs.jsgenerator.InsertHtml.java

protected void writeJavascript() throws JspException {
    String insertion = StringUtils.capitalize(position.toLowerCase());
    writeCall("new Insertion." + insertion, getTargetElement(), getBodyContent().getString());
}

From source file:com.personal.tools.Reflections.java

/**
 * Setter, ???//from  www  . j  a  v a2s.c  o  m
 */
public static void invokeSetter(Object obj, String propertyName, Object value) {
    String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(propertyName);
    invokeMethodByName(obj, setterMethodName, new Object[] { value });
}

From source file:com.angstoverseer.util.ReflectionUtil.java

public static Object getPropertyValue(Object target, String propertyName) {
    try {/*  ww w . j  a  va 2s .co  m*/
        final Method getter = extractMethod(target, "get" + StringUtils.capitalize(propertyName));
        getter.setAccessible(true);
        return getter.invoke(target);
    } catch (Exception e) {
        throw new RuntimeException("Could not invoke method.", e);
    }
}

From source file:ch.entwine.weblounge.common.content.movie.ScanType.java

/**
 * Creates a new scan type object from the given argument.
 * //from w  ww.j av a 2 s  . c om
 * @param value
 *          the scan type as a string
 * @return the scan type
 * @throws IllegalArgumentException
 *           if no such scan type exists
 */
public static ScanType fromString(String value) {
    return ScanType.valueOf(StringUtils.capitalize(value));
}

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

public static String toJavaName(String string) {
    checkArgument(!Strings.isNullOrEmpty(string), "Input string cannot be null or empty");
    final String[] elements = string.split("(?i:[^a-z0-9]+)");
    return stream(spliterator(elements), false).map(indexed())
            .map(element -> element.index() > 0 ? StringUtils.capitalize(element.value()) : element.value())
            .collect(Collectors.joining());
}

From source file:com.foo.Foo.java

public Foo() {
    System.out.println("This is a simple application that prints this line.");
    System.out.println(StringUtils.capitalize("this is run through StringUtils from commons-lang."));
}

From source file:com.vsct.dt.hesperides.templating.models.annotation.HesperidesAnnotationConstructor.java

/**
 * Create annotation object./*from  w  w  w. j  a  va  2s. c  o m*/
 *
 * @param annotation annotation like "@default" or "default"
 * @param value value of annotation
 *
 * @return anootation object or null if annotation not found.
 */
public static HesperidesAnnotation createAnnotationObject(final String annotation, final String value) {
    String classAnnotation;
    HesperidesAnnotation obj = null;

    if (annotation.startsWith("@")) {
        classAnnotation = StringUtils.capitalize(annotation.substring(1).toLowerCase());
    } else {
        classAnnotation = StringUtils.capitalize(annotation.toLowerCase());
    }

    try {
        Class<HesperidesAnnotation> clazz = (Class<HesperidesAnnotation>) Class.forName(String.format(
                "com.vsct.dt.hesperides.templating.models.annotation.Hesperides%sAnnotation", classAnnotation));

        Constructor<HesperidesAnnotation> constructor = clazz.getConstructor(String.class, String.class);

        obj = constructor.newInstance(classAnnotation.toLowerCase(), value);
    } catch (ClassNotFoundException e) {
        // Not good.
    } catch (NoSuchMethodException e) {
        // Not good.
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InstantiationException e) {
        // Not good.
    } catch (IllegalAccessException e) {
        // Not good.
    }

    return obj;
}

From source file:antbuild.example.Example.java

public void example() {
    System.out.println(">>> " + StringUtils.capitalize("hello world!"));
}