Example usage for org.springframework.util StringUtils uncapitalize

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

Introduction

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

Prototype

public static String uncapitalize(String str) 

Source Link

Document

Uncapitalize a String , changing the first letter to lower case as per Character#toLowerCase(char) .

Usage

From source file:org.springframework.beans.CachedIntrospectionResults.java

@Nullable
PropertyDescriptor getPropertyDescriptor(String name) {
    PropertyDescriptor pd = this.propertyDescriptorCache.get(name);
    if (pd == null && StringUtils.hasLength(name)) {
        // Same lenient fallback checking as in Property...
        pd = this.propertyDescriptorCache.get(StringUtils.uncapitalize(name));
        if (pd == null) {
            pd = this.propertyDescriptorCache.get(StringUtils.capitalize(name));
        }//from   ww  w  .  ja  v  a 2  s  .c  om
    }
    return (pd == null || pd instanceof GenericTypeAwarePropertyDescriptor ? pd
            : buildGenericTypeAwarePropertyDescriptor(getBeanClass(), pd));
}

From source file:org.springframework.data.mapping.PropertyPath.java

/**
 * Creates a leaf {@link PropertyPath} (no nested ones with the given name and owning type.
 * //from   w  w  w  . ja  v  a2 s. co m
 * @param name must not be {@literal null} or empty.
 * @param owningType must not be {@literal null}.
 * @param base the {@link PropertyPath} previously found.
 */
PropertyPath(String name, TypeInformation<?> owningType, List<PropertyPath> base) {

    Assert.hasText(name);
    Assert.notNull(owningType);

    String propertyName = name.matches(ALL_UPPERCASE) ? name : StringUtils.uncapitalize(name);
    boolean isSpecli = org.apache.commons.lang3.StringUtils.contains(propertyName, "*");

    String _propertyName = isSpecli
            ? propertyName.replaceAll("\\*(.*)", org.apache.commons.lang3.StringUtils.EMPTY)
            : propertyName;

    if (propertyName.startsWith("iF")) {
        _propertyName = "name";
    }
    TypeInformation<?> propertyType = owningType.getProperty(_propertyName);

    if (!isSpecli) {
        if (propertyType == null) {
            throw new PropertyReferenceException(propertyName, owningType, base);
        }
    } else {

        if (true) {
            //for debug
        }

    }

    this.owningType = owningType;
    this.isCollection = propertyType == null ? false : propertyType.isCollectionLike();

    if (propertyType == null) {
        throw new PropertyReferenceException(_propertyName, owningType, base);
    }
    this.type = propertyType.getActualType();
    this.name = propertyName;
}

From source file:org.springframework.richclient.command.config.DefaultCommandConfigurer.java

public AbstractCommand configure(AbstractCommand command, ApplicationObjectConfigurer configurer) {
    command.setCommandServices(getCommandServices());
    String objectName = command.getId();
    if (command.isAnonymous()) {
        objectName = ClassUtils.getShortNameAsProperty(command.getClass());
        int lastDot = objectName.lastIndexOf('.');
        if (lastDot != -1) {
            objectName = StringUtils.uncapitalize(objectName.substring(lastDot + 1));
        }//from  w w  w  .j a v  a 2s  .  c  o m
    }

    // Configure the command itself
    configurer.configure(command, objectName);

    // Configure the command face
    if (logger.isDebugEnabled()) {
        logger.debug("Configuring faces (aka visual appearance descriptors) for " + command);
    }
    CommandFaceDescriptor face = new CommandFaceDescriptor();
    configurer.configure(face, objectName);
    command.setFaceDescriptor(face);
    return command;
}