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


Java StringUtils.capitalize方法代码示例

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


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

示例1: addAtlasProxyClazz

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public static void addAtlasProxyClazz(Document document, Set<String> nonProxyChannels,  Result result) {

        Element root = document.getRootElement();// Get the root node

        List<? extends Node> serviceNodes = root.selectNodes("//@android:process");

        String packageName = root.attribute("package").getStringValue();

        Set<String> processNames = new HashSet<>();
        processNames.add(packageName);

        for (Node node : serviceNodes) {
            if (null != node && StringUtils.isNotEmpty(node.getStringValue())) {
                String value = node.getStringValue();
                processNames.add(value);
            }
        }

        processNames.removeAll(nonProxyChannels);

        List<String> elementNames = Lists.newArrayList("activity", "service", "provider");

        Element applicationElement = root.element("application");

        for (String processName : processNames) {

            boolean isMainPkg = packageName.equals(processName);
            //boolean isMainPkg = true;
            String processClazzName = processName.replace(":", "").replace(".", "_");

            for (String elementName : elementNames) {

                String fullClazzName = "ATLASPROXY_" +  (isMainPkg ? "" : (packageName.replace(".", "_") + "_" )) +  processClazzName + "_" + StringUtils.capitalize(elementName);

                if ("activity".equals(elementName)) {
                    result.proxyActivities.add(fullClazzName);
                } else if ("service".equals(elementName)) {
                    result.proxyServices.add(fullClazzName);
                } else {
                    result.proxyProviders.add(fullClazzName);
                }

                Element newElement = applicationElement.addElement(elementName);
                newElement.addAttribute("android:name", ATLAS_PROXY_PACKAGE + "." + fullClazzName);

                if (!packageName.equals(processName)) {
                    newElement.addAttribute("android:process", processName);
                }

                boolean isProvider = "provider".equals(elementName);
                if (isProvider) {
                    newElement.addAttribute("android:authorities",
                                            ATLAS_PROXY_PACKAGE + "." + fullClazzName);
                }

            }

        }

    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:61,代码来源:AtlasProxy.java

示例2: makeColorName

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
static String makeColorName(DyeColor color) {
    String[] name = StringUtils.split(color.toString(), '_');
    for (int i = 0; i < name.length; i++) {
        name[i] = (i > 0 ? " " : "") + StringUtils.capitalize(name[i].toLowerCase());
    }
    return StringUtils.join(name);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:MonumentWoolFactory.java

示例3: getTableKeyByViewType

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
protected String getTableKeyByViewType(ReportViewType viewType, String id) throws Exception {
  String key;
  switch (viewType) {
    case BY_MATERIAL:
      key = getTableByMaterialKey(id);
      break;
    case BY_ENTITY:
      key = getTableByEntityKey(id);
      break;
    case BY_ENTITY_TAGS:
      key = TagUtil.getTagById(Long.valueOf(id), ITag.KIOSK_TAG);
      break;
    case BY_USER:
      key = getUserDetailsById(id);
      break;
    case BY_MANUFACTURER:
      key = StringUtils.capitalize(id);
      break;
    case BY_ASSET_TYPE:
      AssetSystemConfig assets = AssetSystemConfig.getInstance();
      key = assets.getAssetsNameByType(2).get(Integer.parseInt(id));
      break;
    default:
      key = id;
  }
  return key;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:28,代码来源:ReportServiceUtil.java

示例4: invokeSetter

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 调用Setter方法, 仅匹配方法名。
 * 支持多级,如:对象名.对象名.方法
 */
public static void invokeSetter(Object obj, String propertyName, Object value) {
    Object object = obj;
    String[] names = StringUtils.split(propertyName, ".");
    for (int i = 0; i < names.length; i++) {
        if (i < names.length - 1) {
            String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]);
            object = invokeMethod(object, getterMethodName, new Class[]{}, new Object[]{});
        } else {
            String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]);
            invokeMethodByName(object, setterMethodName, new Object[]{value});
        }
    }
}
 
开发者ID:guolf,项目名称:pds,代码行数:18,代码来源:Reflections.java

示例5: convertToTrueFalseValue

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Returns parameter value or TypeTrueFalse as read from engine xml 
 * @param value
 * @param propertyName
 * @return
 */
public Object convertToTrueFalseValue(TypeTrueFalse value, String propertyName) {
	LOGGER.debug("Converting Boolean to String - {}", propertyName);
	Object parsedValue = getValue(PropertyNameConstants.OVER_WRITE.value());
	if (parsedValue != null) {
		return parsedValue;
	} else {
		if(value != null && TrueFalse.FALSE.equals(value.getValue()))
			return StringUtils.capitalize(TrueFalse.FALSE.value());
		else{
			return StringUtils.capitalize(TrueFalse.TRUE.value());
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:OutputUiConverter.java

示例6: getSetter

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private Method getSetter() {
    try{
        String setterName = "set" + StringUtils.capitalize(field.getName());
        return field.getDeclaringClass().getMethod(setterName, field.getType());
    } catch (NoSuchMethodException e) {
        throw new OptionValidationException(String.format("No setter for Option annotated field '%s' in class '%s'.",
                getElementName(), getDeclaredClass()));
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:FieldOptionElement.java

示例7: formatErrorMessage

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public String formatErrorMessage(String singularItemDescription, Object container) {
    String capItem = StringUtils.capitalize(singularItemDescription);
    if (!matches.isEmpty()) {
        return String.format("%s '%s' is ambiguous in %s. Candidates are: %s.", capItem, pattern, container, GUtil.toString(matches));
    }
    if (!candidates.isEmpty()) {
        return String.format("%s '%s' not found in %s. Some candidates are: %s.", capItem, pattern, container, GUtil.toString(candidates));
    }
    return String.format("%s '%s' not found in %s.", capItem, pattern, container);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:NameMatcher.java

示例8: MetricMutableQuantiles

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Instantiates a new {@link MetricMutableQuantiles} for a metric that rolls itself over on the
 * specified time interval.
 *
 * @param name        of the metric
 * @param description long-form textual description of the metric
 * @param sampleName  type of items in the stream (e.g., "Ops")
 * @param valueName   type of the values
 * @param interval    rollover interval (in seconds) of the estimator
 */
public MetricMutableQuantiles(String name, String description, String sampleName,
                              String valueName, int interval) {
  String ucName = StringUtils.capitalize(name);
  String usName = StringUtils.capitalize(sampleName);
  String uvName = StringUtils.capitalize(valueName);
  String desc = StringUtils.uncapitalize(description);
  String lsName = StringUtils.uncapitalize(sampleName);
  String lvName = StringUtils.uncapitalize(valueName);

  numInfo = info(ucName + "Num" + usName, String.format(
      "Number of %s for %s with %ds interval", lsName, desc, interval));
  // Construct the MetricsInfos for the quantiles, converting to percentiles
  quantileInfos = new MetricsInfo[quantiles.length];
  String nameTemplate = "%s%dthPercentile%dsInterval%s";
  String descTemplate = "%d percentile %s with %d second interval for %s";
  for (int i = 0; i < quantiles.length; i++) {
    int percentile = (int) (100 * quantiles[i].quantile);
    quantileInfos[i] = info(String.format(nameTemplate, ucName, percentile, interval, uvName),
        String.format(descTemplate, percentile, lvName, interval, desc));
  }

  estimator = new MetricSampleQuantiles(quantiles);
  executor = new MetricsExecutorImpl();
  this.interval = interval;
  executor.getExecutor().scheduleAtFixedRate(new RolloverSample(this),
      interval,
      interval,
      TimeUnit.SECONDS);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:40,代码来源:MetricMutableQuantiles.java

示例9: getName

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Remove the prefix "get", if any, from the method name. Return the
 * capacitalized method name."
 */
protected String getName(Method method) {
  String methodName = method.getName();
  if (methodName.startsWith("get")) {
    return StringUtils.capitalize(methodName.substring(3));
  }
  return StringUtils.capitalize(methodName);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:12,代码来源:MutableMetricsFactory.java

示例10: invokeGetter

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 调用Getter方法.
 * 支持多级,如:对象名.对象名.方法
 */
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;
}
 
开发者ID:guolf,项目名称:pds,代码行数:13,代码来源:Reflections.java

示例11: writeDtoClass

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * Write Dto class to disk
 *
 * @param queryDesc description of query
 * @param isReq write request (true) or response (false)
 * @param baseDtoClassName name of parent dto class
 */
private void writeDtoClass(
        QueryDesc queryDesc,
        boolean isReq,
        String baseDtoClassName
) {
    if (isReq && CollectionUtils.isEmpty(queryDesc.getRequestParamList())
            || !isReq && CollectionUtils.isEmpty(queryDesc.getResponseParamList())) {
        return;
    }
    try {
        VelocityContext context = new VelocityContext();

        context.put("fields", isReq ? queryDesc.getRequestParamList() : queryDesc.getResponseParamList());

        String methodNameUpper = StringUtils.capitalize(queryDesc.getMethodName());
        String dtoClassName = methodNameUpper + (isReq ? "Req" : "Res");
        String packageName = queryDesc.getPackageName() + ".dto";

        List<String> implementsList = isReq ? queryDesc.getReqImplementsList() : queryDesc.getResImplementsList();
        processImplementsList(context, new HashSet<>(implementsList));

        context.put("dtoClassName", dtoClassName);
        context.put("classPackage", packageName);
        context.put("classJavadoc", queryDesc.getClassJavadoc());
        context.put("baseDtoClass", baseDtoClassName);

        JavaFileObject builderFile = processingEnv.getFiler().createSourceFile(packageName + "." + dtoClassName);

        try (PrintWriter writer = new PrintWriter(builderFile.openWriter())) {
            Template template = Velocity.getTemplate("dto-class-template.vm", MiscUtils.UTF_8);
            template.merge(context, writer);
        }

    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
 
开发者ID:nds842,项目名称:sql-first-mapper,代码行数:45,代码来源:DaoWriter.java

示例12: taskName

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public String taskName(String verb) {
    return verb + StringUtils.capitalize(binary.getProjectScopedName());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:5,代码来源:DefaultBinaryTasksCollection.java

示例13: invokeSetterMethod

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
/**
 * 调用Setter方法.
 *
 * @param propertyType 用于查找Setter方法,为空时使用value的Class替代.
 */
public static void invokeSetterMethod(Object obj, String propertyName, Object value, Class<?> propertyType) {
    Class<?> type = propertyType != null ? propertyType : value.getClass();
    String setterMethodName = "set" + StringUtils.capitalize(propertyName);
    invokeMethod(obj, setterMethodName, new Class[] { type }, new Object[] { value });
}
 
开发者ID:dragon-yuan,项目名称:Ins_fb_pictureSpider_WEB,代码行数:11,代码来源:ReflectionUtils.java

示例14: getCapitalized

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public String getCapitalized() {
    return StringUtils.capitalize(toString());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:ResourceOperation.java

示例15: getBuildDependentComponentsTaskName

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
private static String getBuildDependentComponentsTaskName(ComponentSpec component) {
    return BUILD_DEPENDENTS_TASK_NAME + StringUtils.capitalize(component.getName());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:NativeComponents.java


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