本文整理了Java中org.apache.cayenne.util.Util.specialCharsToJava()
方法的一些代码示例,展示了Util.specialCharsToJava()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.specialCharsToJava()
方法的具体详情如下:
包路径:org.apache.cayenne.util.Util
类名称:Util
方法名:specialCharsToJava
[英]Replaces special chars with human-readable and Java-id-compatible symbols.
[中]用人类可读且与Java id兼容的符号替换特殊字符。
代码示例来源:origin: org.apache.cayenne/cayenne-cgen
/**
* Converts property name to Java constants naming convention.
*
* @since 1.1
*/
public String capitalizedAsConstant(String name) {
if (name == null || name.length() == 0)
return name;
// clear of non-java chars. While the method name implies that a passed identifier
// is pure Java, it is used to build pk columns names and such, so extra safety
// check is a good idea
name = Util.specialCharsToJava(name);
char charArray[] = name.toCharArray();
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < charArray.length; i++) {
if ((Character.isUpperCase(charArray[i])) && (i != 0)) {
char prevChar = charArray[i - 1];
if ((Character.isLowerCase(prevChar))) {
buffer.append("_");
}
}
buffer.append(Character.toUpperCase(charArray[i]));
}
return buffer.toString();
}
代码示例来源:origin: org.apache.cayenne/cayenne-server
token = specialCharsToJava(token);
内容来源于网络,如有侵权,请联系作者删除!