Java Code Examples for org.apache.commons.lang.WordUtils#uncapitalize()

The following examples show how to use org.apache.commons.lang.WordUtils#uncapitalize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaParameterHost.java    From das with Apache License 2.0 5 votes vote down vote up
public String getUncapitalizedName() {
    String tempName = name.replace("@", "");
    // if (tempName.contains("_")) {
    // tempName = WordUtils.capitalizeFully(tempName.replace('_', ' ')).replace(" ", "");
    // }
    return WordUtils.uncapitalize(tempName);
}
 
Example 2
Source File: JavaParameterHost.java    From das with Apache License 2.0 5 votes vote down vote up
public String getCamelCaseUncapitalizedName() {
    String temp = name.replace("@", "");
    temp = WordUtils.capitalizeFully(temp);
    if (temp.contains("_")) {
        temp = WordUtils.capitalizeFully(temp.replace('_', ' ')).replace(" ", "");
    }
    return WordUtils.uncapitalize(temp);
}
 
Example 3
Source File: CodeGeneratorService.java    From smart-admin with MIT License 5 votes vote down vote up
/**
 * 表名转 java变量前缀
 *
 * @param tableName
 * @param tablePrefix
 * @return
 */
private String tableName2Var(String tableName, String tablePrefix) {
    if (StringUtils.isNotBlank(tablePrefix)) {
        tableName = tableName.replaceFirst(tablePrefix, "");
    }
    String transName = WordUtils.capitalizeFully(tableName, new char[]{'_'}).replace("_", "");
    return WordUtils.uncapitalize(transName);
}
 
Example 4
Source File: ExprStringCase.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("null")
private static String toCamelCase(String str, boolean strict) {
	String[] words = str.split(" "); // Splits at spaces 
	String buf = words.length > 0 ? (strict ? words[0].toLowerCase() : WordUtils.uncapitalize(words[0])) : "";
	for (int i = 1; i < words.length; i++)
		buf += strict ? WordUtils.capitalizeFully(words[i]) : WordUtils.capitalize(words[i]);
	return buf;
}
 
Example 5
Source File: JavaParameterHost.java    From dal with Apache License 2.0 5 votes vote down vote up
public String getUncapitalizedName() {
    String tempName = name.replace("@", "");
    // if (tempName.contains("_")) {
    // tempName = WordUtils.capitalizeFully(tempName.replace('_', ' ')).replace(" ", "");
    // }
    return WordUtils.uncapitalize(tempName);
}
 
Example 6
Source File: JavaParameterHost.java    From dal with Apache License 2.0 5 votes vote down vote up
public String getCamelCaseUncapitalizedName() {
    String temp = name.replace("@", "");
    if (temp.contains("_")) {
        temp = WordUtils.capitalizeFully(temp.replace('_', ' ')).replace(" ", "");
    }
    return WordUtils.uncapitalize(temp);
}
 
Example 7
Source File: TypeHintSuggestionProvider.java    From idea-php-toolbox with MIT License 5 votes vote down vote up
@Nullable
@Override
public SuggestedNameInfo getSuggestedNames(PsiElement psiElement, PsiElement psiElement1, Set<String> set) {

    if(!(psiElement instanceof Parameter)) {
        return null;
    }

    List<String> filter = ContainerUtil.filter(PhpNameSuggestionUtil.variableNameByType((Parameter) psiElement, psiElement.getProject(), false), s -> !StringUtil.containsChar(s, '\\'));

    if(filter.size() == 0) {
        return null;
    }

    for (String item : filter) {

        for(String end: TRIM_STRINGS) {

            // ending
            if(item.toLowerCase().endsWith(end)) {
                item = item.substring(0, item.length() - end.length());
            }

            // remove starting
            if(item.toLowerCase().startsWith(end)) {
                item = WordUtils.uncapitalize(item.substring(end.length()));
            }
        }

        if(StringUtils.isNotBlank(item)) {
            set.add(item);
        }
    }

    return null;
}
 
Example 8
Source File: TypeHintSuggestionProvider.java    From idea-php-toolbox with MIT License 5 votes vote down vote up
@Nullable
@Override
public SuggestedNameInfo getSuggestedNames(PsiElement psiElement, PsiElement psiElement1, Set<String> set) {

    if(!(psiElement instanceof Parameter)) {
        return null;
    }

    List<String> filter = ContainerUtil.filter(PhpNameSuggestionUtil.variableNameByType((Parameter) psiElement, psiElement.getProject(), false), s -> !StringUtil.containsChar(s, '\\'));

    if(filter.size() == 0) {
        return null;
    }

    for (String item : filter) {

        for(String end: TRIM_STRINGS) {

            // ending
            if(item.toLowerCase().endsWith(end)) {
                item = item.substring(0, item.length() - end.length());
            }

            // remove starting
            if(item.toLowerCase().startsWith(end)) {
                item = WordUtils.uncapitalize(item.substring(end.length()));
            }
        }

        if(StringUtils.isNotBlank(item)) {
            set.add(item);
        }
    }

    return null;
}
 
Example 9
Source File: JavaMethodHost.java    From das with Apache License 2.0 4 votes vote down vote up
public String getVariableName() {
    return WordUtils.uncapitalize(pojoClassName);
}
 
Example 10
Source File: JavaMethodHost.java    From dal with Apache License 2.0 4 votes vote down vote up
public String getVariableName() {
    return WordUtils.uncapitalize(pojoClassName);
}
 
Example 11
Source File: JpaUniqueUtil.java    From javaee-lab with Apache License 2.0 4 votes vote down vote up
private String simpleUniqueConstraintError(Identifiable<?> entity, String property) {
    return WordUtils.uncapitalize(entity.entityClassName()) + "_" + property + "_already_exists";
}
 
Example 12
Source File: JpaUniqueUtil.java    From javaee-lab with Apache License 2.0 4 votes vote down vote up
private String compositeUniqueConstraintErrorCode(Identifiable<?> entity, UniqueConstraint uniqueConstraint) {
    return WordUtils.uncapitalize(entity.entityClassName()) + "_"
            + (uniqueConstraint.name() == null ? "composite_unique_constraint_error" : uniqueConstraint.name().toLowerCase());
}
 
Example 13
Source File: CodeGeneratorService.java    From smart-admin with MIT License 2 votes vote down vote up
/**
 * 列名转字段名
 *
 * @param columnName
 * @return
 */
private String columnName2Field(String columnName) {
    String transName = WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "");
    return WordUtils.uncapitalize(transName);
}