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


Java WordUtils.capitalize方法代码示例

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


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

示例1: annotate

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public void annotate(final MethodStep methodStep, final Method m) {

    // resources are not annotated at all, because the resource itself will contain a method
    // that will get into the public API. It is a method with GET annotation and empty path.
    if (!TypeHelper.isResource(methodStep.getReturnType())) {
      final String description = restOperation != null && restOperation.getDescription() != null ? restOperation.getDescription() : WordUtils.capitalize(StringHelper.splitCamelCase(m.getName()));

      getMethod().annotate(ApiOperation.class) //
        .param("value", StringHelper.firstSentence(description))
        .param("notes", description)
      ;

      if (restOperation != null && restOperation.getExternalDocUrl() != null) {
        getMethod().annotate(ExternalDocs.class)
          .param("value", "Reference Guide")
          .param("url", restOperation.getExternalDocUrl())
        ;
      }
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-swagger,代码行数:21,代码来源:ApiOperationStep.java

示例2: buildName

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private static String buildName( String displayName ) {
    String[] temp = displayName.split( " " );
    StringBuilder newName = new StringBuilder();

    for ( int i = 0; i < temp.length; i++ ) {
        String old = temp[i];
        if ( old.contains( "(" ) ) {
            old = old.replaceAll( "\\(", "" );
            old = old.replaceAll( "\\)", "" );
        }

        String part = WordUtils.capitalize( old.replaceAll( "'", "" ) );
        newName.append( part );
    }

    return newName.toString();
}
 
开发者ID:GoMint,项目名称:GoMint,代码行数:18,代码来源:ItemGenerator.java

示例3: createDeserSetters

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private List<String> createDeserSetters(Class<? extends Storable> storableClass, String typeName) {
    List<String> deserSetters = new LinkedList<>();

    Set<String> methodNames = new HashSet<>();
    for (Method method : storableClass.getDeclaredMethods()) {
        methodNames.add(method.getName());
    }

    for (Field field : storableClass.getDeclaredFields()) {
        String name = field.getName();
        String capitalizedName = WordUtils.capitalize(name);
        //make sure there's a setter
        if (methodNames.contains("set" + capitalizedName)) {
            deserSetters.add(String.format("%s.set%2$s(extended.get%2s());", WordUtils.uncapitalize(typeName), capitalizedName));
        }
    }
    return deserSetters;
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:19,代码来源:StorableClassesFactory.java

示例4: hasAttr

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public Boolean hasAttr(AbstractEntity entity, Integer key) {
	String attrName = getAttrName(key);
	String methodName = "has" + WordUtils.capitalize(attrName);
	Method method;
	try {
		method = entity.getClass().getMethod(methodName);
		Object ret = method.invoke(entity);
		return (Boolean) ret;
	} catch (NoSuchMethodException
		| SecurityException
		| IllegalAccessException
		| IllegalArgumentException
		| InvocationTargetException e) {
	}
	return null;
}
 
开发者ID:kennanmeyer,项目名称:SE-410-Project,代码行数:17,代码来源:RadioButtonGroup.java

示例5: modify

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
static String modify(String toModify, String modifier) {
    switch (modifier) {
        case ModifierTypes.LOWER:
            return toModify.toLowerCase();
        case ModifierTypes.UPPER:
            return toModify.toUpperCase();
        case ModifierTypes.FIRST_CAP:
            return StrUtils.capitalizeFully(toModify);
        case ModifierTypes.WORD_CAP:
            return WordUtils.capitalizeFully(toModify);
        case ModifierTypes.FIRST_CAP_SOFT:
            return StringUtils.capitalize(toModify);
        case ModifierTypes.WORD_CAP_SOFT:
            return WordUtils.capitalize(toModify);
        default:
            return toModify;
    }
}
 
开发者ID:OTBProject,项目名称:OTBProject,代码行数:19,代码来源:CommandResponseParser.java

示例6: basicInfo

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
/**
 * Add the basic information to the record.
 * 
 * @param textRecord
 *          Text format record, as a list of lines
 * @param person
 *          The person to export
 * @param endTime
 *          Time the simulation ended (to calculate age/deceased status)
 */
private static void basicInfo(List<String> textRecord, Person person, long endTime) {
  String name = (String) person.attributes.get(Person.NAME);

  textRecord.add(name);
  textRecord.add(name.replaceAll("[A-Za-z0-9 ]", "=")); // "underline" the characters in the name

  String race = (String) person.attributes.get(Person.RACE);
  if (race.equals("hispanic")) {
    textRecord.add("Race:                Other");
    String ethnicity = (String) person.attributes.get(Person.ETHNICITY);
    ethnicity = WordUtils.capitalize(ethnicity.replace('_', ' '));
    textRecord.add("Ethnicity:           " + ethnicity);
  } else {
    textRecord.add("Race:                " + WordUtils.capitalize(race));
    textRecord.add("Ethnicity:           Non-Hispanic");
  }

  textRecord.add("Gender:              " + person.attributes.get(Person.GENDER));

  String age = person.alive(endTime) ? Integer.toString(person.ageInYears(endTime)) : "DECEASED";
  textRecord.add("Age:                 " + age);

  String birthdate = dateFromTimestamp((long) person.attributes.get(Person.BIRTHDATE));
  textRecord.add("Birth Date:          " + birthdate);
  textRecord.add("Marital Status:      "
      + person.attributes.getOrDefault(Person.MARITAL_STATUS, "S"));

  Provider prov = person.getAmbulatoryProvider();
  if (prov != null) {
    textRecord.add("Outpatient Provider: " + prov.attributes.get("name"));
  }
}
 
开发者ID:synthetichealth,项目名称:synthea_java,代码行数:43,代码来源:TextExporter.java

示例7: capitalizeTrailingWords

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public String capitalizeTrailingWords(String name) {
    char[] wordDelimiters = generationConfig.getPropertyWordDelimiters();

    if (containsAny(name, wordDelimiters)) {
        String capitalizedNodeName = WordUtils.capitalize(name, wordDelimiters);
        name = name.charAt(0) + capitalizedNodeName.substring(1);

        for (char c : wordDelimiters) {
            name = remove(name, c);
        }
    }

    return name;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:NameHelper.java

示例8: toCamelCase

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private static String toCamelCase(String label) {
  if (label.length() >= 1) {
    String first = label.substring(0, 1);
    label = WordUtils.capitalize(label);
    label = first + label.substring(1);
    return label.replaceAll(" ", "");
  } else {
    return label;
  }
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:11,代码来源:LabelForUriManglator.java

示例9: forPrimitive

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private static AccessInfo forPrimitive(String memberType, Type type) {
	String camelCaseClassName = WordUtils.capitalize(type.getClassName());
	String capitalizedMemberType = WordUtils.capitalize(memberType);
	
	return new AccessInfo(
			memberType,
			"get" + camelCaseClassName + capitalizedMemberType,
			"set" + camelCaseClassName + capitalizedMemberType,
			type.getClassName(),
			type.getDescriptor(),
			type.getOpcode(ILOAD),
			type.getOpcode(IRETURN));
}
 
开发者ID:Javalbert,项目名称:faster-than-reflection,代码行数:14,代码来源:ClassAccessFactory.java

示例10: forPrimitiveWrapper

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private static AccessInfo forPrimitiveWrapper(String memberType, Class<?> clazz) {
	Class<?> primitiveClass = ClassUtils.wrapperToPrimitive(clazz);
	String camelCaseClassName = WordUtils.capitalize(primitiveClass.getName());
	String capitalizedMemberType = WordUtils.capitalize(memberType);
	
	return new AccessInfo(
			memberType,
			"getBoxed" + camelCaseClassName + capitalizedMemberType,
			"setBoxed" + camelCaseClassName + capitalizedMemberType,
			clazz.getName(),
			Type.getDescriptor(clazz),
			ALOAD,
			ARETURN);
}
 
开发者ID:Javalbert,项目名称:faster-than-reflection,代码行数:15,代码来源:ClassAccessFactory.java

示例11: forReferenceType

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
private static AccessInfo forReferenceType(String memberType, Class<?> clazz) {
	String capitalizedMemberType = WordUtils.capitalize(memberType);
	
	return new AccessInfo(
			memberType,
			"get" + clazz.getSimpleName() + capitalizedMemberType,
			"set" + clazz.getSimpleName() + capitalizedMemberType,
			clazz.getName(),
			Type.getDescriptor(clazz),
			ALOAD,
			ARETURN);
}
 
开发者ID:Javalbert,项目名称:faster-than-reflection,代码行数:13,代码来源:ClassAccessFactory.java

示例12: addToOntology

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
@Override
public void addToOntology() {
  OWLClass domain = featurePool.getExclusiveClass(":DatatypeMapsDomain");
  OWLDatatype range = factory.getOWLDatatype(datatype);

  String namespace = datatype.getPrefixedName().split(":")[0];
  String name = datatype.getShortForm();
  String propertyIri = ":" + namespace + WordUtils.capitalize(name) + "Property";
  OWLDataProperty property = factory.getOWLDataProperty(propertyIri, pm);

  addProperty(domain, property, range);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:13,代码来源:AbstractDatatypeMapFeature.java

示例13: getDisplayName

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
@SerializedName("legal")
LEGAL,
@SerializedName("not_legal")
NOT_LEGAL,
@SerializedName("restricted")
RESTRICTED,
@SerializedName("banned")
BANNED;

public String getDisplayName() {
	return WordUtils.capitalize(name().replaceAll("_", " ").toLowerCase());
}
 
开发者ID:BeMacized,项目名称:Grimoire,代码行数:13,代码来源:ScryfallCard.java

示例14: normalizeName

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public static String normalizeName(final String name) {
	String newName = name.trim();
	newName = newName.toLowerCase();
	newName = StringUtils.normalizeSpace(newName);
	newName = WordUtils.capitalize(newName);
	newName = normalizeNameCharacters(newName);
	
	return newName;
}
 
开发者ID:sjcdigital,项目名称:temis-api,代码行数:10,代码来源:Alderman.java

示例15: resolvePath

import org.apache.commons.lang3.text.WordUtils; //导入方法依赖的package包/类
public default String resolvePath() {
	if (this.name().equals("PREFIX")) return this.name();
	
	String[] split = this.name().toLowerCase().split("_");
	for (int cpt=1; cpt<split.length; cpt++) {
		split[cpt] = WordUtils.capitalize(split[cpt]);
	}
	return String.join("", split);
}
 
开发者ID:EverCraft,项目名称:EverAPI,代码行数:10,代码来源:EnumMessage.java


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