當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。