本文整理汇总了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())
;
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
}
示例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"));
}
}
示例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;
}
示例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;
}
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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;
}
示例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);
}