Example usage for org.springframework.util StringUtils capitalize

List of usage examples for org.springframework.util StringUtils capitalize

Introduction

In this page you can find the example usage for org.springframework.util StringUtils capitalize.

Prototype

public static String capitalize(String str) 

Source Link

Document

Capitalize a String , changing the first letter to upper case as per Character#toUpperCase(char) .

Usage

From source file:com.solxiom.social.signup.SignupController.java

@RequestMapping(value = "/signup", method = RequestMethod.GET)
public SignupForm signupForm(WebRequest request) {
    Connection<?> connection = ProviderSignInUtils.getConnection(request);
    if (connection != null) {
        request.setAttribute("message", new Message(MessageType.INFO, "Your "
                + StringUtils.capitalize(connection.getKey().getProviderId())
                + " account is not associated with a Spring Social Showcase account. If you're new, please sign up."),
                WebRequest.SCOPE_REQUEST);
        return SignupForm.fromProviderUser(connection.fetchUserProfile());
    } else {//w  w w. j  a v  a 2 s  . c o m
        return new SignupForm();
    }
}

From source file:org.halkneistiyor.social.web.SignupController.java

@RequestMapping(value = "/signup", method = RequestMethod.GET)
public SignupForm signupForm(WebRequest request) {
    Connection<?> connection = ProviderSignInUtils.getConnection(request);
    if (connection != null) {
        String txt = "Your " + StringUtils.capitalize(connection.getKey().getProviderId())
                + " account is not associated with an account. If you're new, please sign up.";
        Message message = new Message(MessageType.INFO, txt);
        request.setAttribute("message", message, WebRequest.SCOPE_REQUEST);
        return SignupForm.fromProviderUser(connection.fetchUserProfile());
    } else {//from   w  ww  .j  a v  a2  s . c om
        return new SignupForm();
    }
}

From source file:it.f2informatica.pagination.utils.SafeGetterMethodExecutor.java

private <T> Object _invokeGetter(String fieldName, T entity)
        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    Optional<Object> result = Optional.absent();
    for (String field : fieldName.split("_")) {
        if (fieldName.endsWith(".") || 0 == field.length()) {
            throw new IllegalArgumentException("Invalid property name '" + fieldName + "'");
        }/*from w  w w . ja  v  a  2s . co m*/

        Method getter = entity.getClass().getMethod("get" + StringUtils.capitalize(field));
        result = Optional.fromNullable(getter.invoke(entity));

        if (!result.isPresent()) {
            break;
        } else if (!field.equals(fieldName)) {
            // If the current field is not equals to the nested
            // field properties, then it will call itself until
            // reach the last property (via Recursive Call).
            // On the other hand, fieldName.substring(field.length() + 1)
            // means that I'm passing the entire nested field path
            // to the next recursive call, except the current property
            // evaluated considering also the 'dot'.
            // For example, if we have "someProperty." (will be excluded)
            return _invokeGetter(fieldName.substring(field.length() + 1), result.get());
        }
    }
    return result.orNull(); // Holds the final result from the last getter method
}

From source file:rd.kpath.signup.SignupController.java

@RequestMapping(value = "/signup", method = RequestMethod.GET)
public SignupForm signupForm(WebRequest request) {
    Connection<?> connection = providerSignInUtils.getConnectionFromSession(request);
    if (connection != null) {
        request.setAttribute("message", new Message(MessageType.INFO,
                "Your " + StringUtils.capitalize(connection.getKey().getProviderId())
                        + " account is not associated with a K-Path account. If you're new, please sign up."),
                WebRequest.SCOPE_REQUEST);
        return SignupForm.fromProviderUser(connection.fetchUserProfile());
    } else {//w  ww  . j a va2 s  .co m
        return new SignupForm();
    }
}

From source file:org.smigo.user.Language.java

public String getName() {
    return StringUtils.capitalize(this.locale.getDisplayName(this.locale));
}

From source file:org.echocat.redprecursor.annotations.utils.AccessAlsoProtectedMembersReflectivePropertyAccessor.java

@Override
protected Method findGetterForProperty(String propertyName, Class<?> clazz, boolean mustBeStatic) {
    Method result = null;/*from   w w  w  .  j  a v a2s  . c  om*/
    final PropertyDescriptor propertyDescriptor = findPropertyDescriptorFor(clazz, propertyName);
    if (propertyDescriptor != null) {
        result = propertyDescriptor.getReadMethod();
    }
    if (result == null) {
        Class<?> current = clazz;
        final String getterName = "get" + StringUtils.capitalize(propertyName);
        while (result == null && !Object.class.equals(current)) {
            try {
                final Method potentialMethod = current.getDeclaredMethod(getterName);
                if (!mustBeStatic || Modifier.isStatic(potentialMethod.getModifiers())) {
                    if (!potentialMethod.isAccessible()) {
                        potentialMethod.setAccessible(true);
                    }
                    result = potentialMethod;
                }
            } catch (NoSuchMethodException ignored) {
            }
            current = current.getSuperclass();
        }
    }
    return result;
}

From source file:com.kdubb.socialshowcaseboot.signup.SignupController.java

@RequestMapping(value = "/signup", method = RequestMethod.GET)
public SignupForm signupForm(WebRequest request) {
    Connection<?> connection = providerSignInUtils.getConnectionFromSession(request);
    if (connection != null) {
        request.setAttribute("message", new Message(MessageType.INFO, "Your "
                + StringUtils.capitalize(connection.getKey().getProviderId())
                + " account is not associated with a Spring Social Showcase account. If you're new, please sign up."),
                WebRequest.SCOPE_REQUEST);
        return SignupForm.fromProviderUser(connection.fetchUserProfile());
    } else {/*from   w  w w. j a va  2  s.c  o  m*/
        return new SignupForm();
    }
}

From source file:eu.gyza.eap.eapsocialontology.signup.SignupController.java

@RequestMapping(value = "/signup", method = RequestMethod.GET)
public SignupForm signupForm(WebRequest request) {
    Connection<?> connection = providerSignInUtils.getConnectionFromSession(request);
    if (connection != null) {
        request.setAttribute("message", new Message(MessageType.INFO, "Your "
                + StringUtils.capitalize(connection.getKey().getProviderId())
                + " account is not associated with a EAP Social Ontology account. If you're new, please sign up."),
                WebRequest.SCOPE_REQUEST);
        return SignupForm.fromProviderUser(connection.fetchUserProfile());
    } else {/*w w  w  . jav a  2 s .c  om*/
        return new SignupForm();
    }
}

From source file:mikeyp.spikes.controller.signup.SignupController.java

@ModelAttribute("signupForm")
public SignupForm createForm(WebRequest request) {
    Connection<?> connection = ProviderSignInUtils.getConnection(request);
    SignupForm form = null;//from   ww  w  .j  a v  a 2 s .  c om
    if (connection != null) {
        request.setAttribute("message", new Message(MessageType.INFO, "Your "
                + StringUtils.capitalize(connection.getKey().getProviderId())
                + " account is not associated with a Spring Social Showcase account. If you're new, please sign up."),
                WebRequest.SCOPE_REQUEST);
        form = SignupForm.fromProviderUser(connection.fetchUserProfile());
    } else {
        form = new SignupForm();
    }
    return form;
}

From source file:org.cloudfoundry.identity.app.web.TreeController.java

private void loadItems(Model model, String type) throws Exception {
    List<Map<String, Object>> items = getItems(type);
    model.addAttribute("items", items);
    model.addAttribute("name", StringUtils.capitalize(type));
    model.addAttribute("title", "Your " + StringUtils.capitalize(type));
}