当前位置: 首页>>代码示例>>Java>>正文


Java WordUtils.uncapitalize方法代码示例

本文整理汇总了Java中org.apache.commons.lang.WordUtils.uncapitalize方法的典型用法代码示例。如果您正苦于以下问题:Java WordUtils.uncapitalize方法的具体用法?Java WordUtils.uncapitalize怎么用?Java WordUtils.uncapitalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.WordUtils的用法示例。


在下文中一共展示了WordUtils.uncapitalize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBean

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
 * Attempts to find a Spring bean based of the specified class. This method first attempts to load a bean
 * following the default Spring auto-naming conventions (de-capitalizing class simple name). In case the bean with 
 * this name can't be found, the method returns the first available bean of this class.
 * <p/>
 * Such logic is required in order to enable this method to lookup components from legacy contexts. "Older" beans seems to 
 * have identifiers hard-coded in the bean definition file, while "newer" bean identifiers are auto-generated by Spring based on the
 * annotations.
 * 
 * @param clazz
 * 		Class of the bean to be looked up
 * @return
 * 		Returns the bean instance
 * @throws NoSuchBeanDefinitionException if there is no bean definition with the specified name
 */
@SuppressWarnings("unchecked")
public static <T> T getBean(Class<?> clazz) {
	// legacy code - I wonder if it's necessary since we are looking up a bean based directly on the class name anyways
	// but to keep legacy logic working properly attempt to locate component based on the Spring conventions 
	String className = WordUtils.uncapitalize(clazz.getSimpleName());
	if (beanFactory.containsBean(className))
		return (T) beanFactory.getBean(className);
	
	if (ListableBeanFactory.class.isAssignableFrom(beanFactory.getClass())) {
		ListableBeanFactory listableBeanFactory = (ListableBeanFactory) beanFactory;
		String[] beanNames = listableBeanFactory.getBeanNamesForType(clazz);
		if (beanNames.length > 0)
			return (T) listableBeanFactory.getBean(beanNames[0]);
	}
	throw new NoSuchBeanDefinitionException(clazz);
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:32,代码来源:SpringUtils.java

示例2: getUncapitalizedName

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String getUncapitalizedName() {
    String tempName = name.replace("@", "");
    // if (tempName.contains("_")) {
    // tempName = WordUtils.capitalizeFully(tempName.replace('_', ' ')).replace(" ", "");
    // }
    return WordUtils.uncapitalize(tempName);
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:8,代码来源:JavaParameterHost.java

示例3: getCamelCaseUncapitalizedName

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String getCamelCaseUncapitalizedName() {
    String temp = name.replace("@", "");
    if (temp.contains("_")) {
        temp = WordUtils.capitalizeFully(temp.replace('_', ' ')).replace(" ", "");
    }
    return WordUtils.uncapitalize(temp);
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:8,代码来源:JavaParameterHost.java

示例4: getSuggestedNames

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@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;
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:37,代码来源:TypeHintSuggestionProvider.java

示例5: createMapClass

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private static void createMapClass(Retrieve retrieve, Map<String, Integer> columns, String packageName, File destinationDir) throws JClassAlreadyExistsException,
																															MapperEngineCodeGeneratorException,
																															IOException {
	JCodeModel codeModel = new JCodeModel();
	JDefinedClass mapClass = codeModel._class(String.format("%s.%sMap", packageName, retrieve.getId()));
	mapClass.javadoc().append("Auto generated class. Do not modify!");

	// Constructor
	JMethod constructor = mapClass.constructor(JMod.PROTECTED);
	constructor.param(codeModel.ref(Map.class).narrow(String.class, Object.class), "data");

	for (String column : columns.keySet()) {
		String varName = WordUtils.uncapitalize(column);
		Class<?> type = null;
		switch (columns.get(column)) {
		case Types.INTEGER:
			type = Integer.class;
			break;
		case Types.VARCHAR:
			type = String.class;
			break;
		case Types.DECIMAL:
			type = BigDecimal.class;
			break;
		default:
			throw new MapperEngineCodeGeneratorException(String.format("Missing Type map for column %s: %d", column, columns.get(column)));
		}

		JFieldVar field = mapClass.field(JMod.PRIVATE | JMod.FINAL, type, varName);

		// Getter
		JMethod getter = mapClass.method(JMod.PUBLIC, type, String.format("get%s", column));
		getter.body()._return(JExpr._this().ref(field));

		constructor.body().assign(JExpr._this().ref(varName), JExpr.cast(codeModel.ref(type), JExpr.ref("data").invoke("get").arg(column)));
	}
	codeModel.build(destinationDir);
}
 
开发者ID:vincenzomazzeo,项目名称:map-engine,代码行数:39,代码来源:MapperEngineCodeGenerator.java

示例6: onRightClick

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
	if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getClickedBlock().getState() instanceof Sign) {
		Sign clickedSign = (Sign) event.getClickedBlock().getState();
		if (ChatColor.stripColor(clickedSign.getLine(0)).equalsIgnoreCase("[HorseMount]") && event.getPlayer().hasPermission("horsemount.signs.use")) {
			if (this.mountArmor.get(WordUtils.uncapitalize(clickedSign.getLine(1))) != null) {
				PluginCommand setArmor = getServer().getPluginCommand("setarmor");
				String armorArgs[];
				armorArgs = new String[1];
				armorArgs[0] = WordUtils.uncapitalize(clickedSign.getLine(1));
				setArmor.execute(event.getPlayer(), "setarmor", armorArgs);
			} else {
				String[] lines = clickedSign.getLines();
				int argsCount = 0;
				for (String line : lines) {
					if (!line.equalsIgnoreCase("") && !ChatColor.stripColor(line).equalsIgnoreCase("[HorseMount]")) {
						argsCount++;
					}
				}
				PluginCommand setMount = getServer().getPluginCommand("setmount");
				String[] mountArgs;
				mountArgs = new String[argsCount];
				int count = 0;
				while (count < argsCount) {
					mountArgs[count] = WordUtils.uncapitalize(lines[count+1]);
					count++;
				}
				setMount.execute(event.getPlayer(), "setmount", mountArgs);
			}
		}
	}
}
 
开发者ID:ktross,项目名称:HorseMount,代码行数:33,代码来源:HorseMount.java

示例7: getVariableName

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String getVariableName() {
    return WordUtils.uncapitalize(pojoClassName);
}
 
开发者ID:ctripcorp,项目名称:dal,代码行数:4,代码来源:JavaMethodHost.java

示例8: simpleUniqueConstraintError

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private String simpleUniqueConstraintError(Identifiable<?> entity, String property) {
    return WordUtils.uncapitalize(entity.entityClassName()) + "_" + property + "_already_exists";
}
 
开发者ID:jaxio,项目名称:javaee-lab,代码行数:4,代码来源:JpaUniqueUtil.java

示例9: compositeUniqueConstraintErrorCode

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private String compositeUniqueConstraintErrorCode(Identifiable<?> entity, UniqueConstraint uniqueConstraint) {
    return WordUtils.uncapitalize(entity.entityClassName()) + "_"
            + (uniqueConstraint.name() == null ? "composite_unique_constraint_error" : uniqueConstraint.name().toLowerCase());
}
 
开发者ID:jaxio,项目名称:javaee-lab,代码行数:5,代码来源:JpaUniqueUtil.java

示例10: getInstance

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String getInstance() {
    return WordUtils.uncapitalize(getName());
}
 
开发者ID:feroult,项目名称:yawp,代码行数:4,代码来源:EndpointNaming.java

示例11: getPipeSinkInstance

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String getPipeSinkInstance() {
    return WordUtils.uncapitalize(getPipeSinkName());
}
 
开发者ID:feroult,项目名称:yawp,代码行数:4,代码来源:EndpointNaming.java

示例12: toName

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private static String toName(final FieldKey key) {
    return WordUtils.uncapitalize(WordUtils.capitalizeFully(key.name().replace('_', ' ')).replace(" ", ""));
}
 
开发者ID:edouardhue,项目名称:comeon,代码行数:4,代码来源:AudioReader.java

示例13: uncapitalize

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public static String uncapitalize(String s) 
{ 
  if (s == null) return s;
  return WordUtils.uncapitalize(s); 
}
 
开发者ID:dr-jts,项目名称:jeql,代码行数:6,代码来源:StringFunction.java

示例14: getWebServiceClassPath

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
 * Return the convention path for both SOAP and REST web service classes. All web
 * service classes are assumed to end with "ServiceSoap" or "ServiceRest". The
 * correspondence is then: class "MyServiceSoap" -> path "my"; class "MyServiceRest"
 * -> path "my".
 *
 * @param serviceClass
 *            SOAP or REST service class
 * @return corresponding web service deployment path
 */
public static String getWebServiceClassPath(final Class<?> serviceClass)
{
	return WordUtils.uncapitalize(serviceClass
			.getSimpleName()
			.replaceAll(SERVICE_SOAP_SUFFIX, EMPTY_STRING)
			.replaceAll(SERVICE_REST_SUFFIX, EMPTY_STRING));
}
 
开发者ID:openfurther,项目名称:further-open-core,代码行数:18,代码来源:WsUtil.java

示例15: AbstractDataSetURLGenerator

import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
 * Create the generator
 * 
 * @param typeUrlPart
 *            type part in URL (upper/lower case first char will be done via conversion)
 */
public AbstractDataSetURLGenerator( URLGeneratorBean urlBean, String typeUrlPart, String resourceDir ) {
	this( urlBean, WordUtils.uncapitalize( typeUrlPart ), WordUtils.capitalize( typeUrlPart ), resourceDir );
}
 
开发者ID:PE-INTERNATIONAL,项目名称:soda4lca,代码行数:10,代码来源:AbstractDataSetURLGenerator.java


注:本文中的org.apache.commons.lang.WordUtils.uncapitalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。