org.apache.commons.lang3.StringUtils#isAllUpperCase ( )源码实例Demo

下面列出了org.apache.commons.lang3.StringUtils#isAllUpperCase ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: we-cmdb   文件: CiTypeAttrsInterceptorService.java
private void validatePropertyName(Object oldPropertyName, Object propertyName, Integer ciTypeId) {
    if (propertyName != null) {
        String propertyNameStr = (String)propertyName;
        if (CmdbConstants.MYSQL_SCHEMA_KEYWORDS.contains(propertyNameStr.trim().toUpperCase())) {
            throw new InvalidArgumentException(String.format("Invalid property name [%s] as it is database key words.", propertyNameStr));
        }

        if (!propertyNameStr.equals(oldPropertyName) && ciTypeAttrRepository.existsByPropertyNameAndCiTypeId(propertyNameStr, ciTypeId)) {
            throw new InvalidArgumentException(String.format("Property name [%s] already existed for ciType [%s(%d)]", propertyNameStr, getCiTypeName(ciTypeId), ciTypeId));
        }

        if (propertyNameStr.length() > CmdbConstants.MAX_LENGTH_OF_COLUMN) {
            throw new InvalidArgumentException(String.format("Field propertyName [%s] is too long, max length is [%d]", propertyNameStr, CmdbConstants.MAX_LENGTH_OF_COLUMN));
        }

        if (!Pattern.matches("[a-zA-Z0-9_]+", propertyNameStr)) {
            throw new InvalidArgumentException(String.format("Field propertyName [%s] must be composed by letters, '_' or numbers", propertyNameStr));
        }

        if (StringUtils.isAllUpperCase(propertyNameStr.toString().substring(0, 1))) {
            throw new InvalidArgumentException(String.format("Field propertyName [%s] must be start with lowercase.", propertyNameStr));
        }
    }
}
 
源代码2 项目: vividus   文件: AbstractElementSearchAction.java
private boolean matchesToTextTransform(String word, String textTransform)
{
    if (word.isEmpty())
    {
        return true;
    }
    switch (textTransform)
    {
        case "uppercase":
            return StringUtils.isAllUpperCase(word);
        case "lowercase":
            return StringUtils.isAllLowerCase(word);
        case "capitalize":
            return Character.isUpperCase(word.charAt(0));
        default:
            return false;
    }
}
 
源代码3 项目: scava   文件: Token.java
public Token(String surface, String norm, String pos) {
      this.surface = surface;
      this.norm = norm;
      this.pos = pos;
      negation = false;
if (surface.matches(elongatedRegex))
	elongated = true;
else
	elongated = false;
if (surface.matches(punctuationRegex))
	punctuation = true;
else
	punctuation = false;
if (surface.matches(lettersRegex))
	letters = true;
else
	letters = false;
if (StringUtils.isAllUpperCase(surface))
	allCaps = true;
else
	allCaps = false;
  }
 
源代码4 项目: obridge   文件: StringHelper.java
public static String toOracleName(String s) {
    StringBuilder result = new StringBuilder();
    String currChar;
    if (s != null && !s.isEmpty()) {
        for (int i = 0; i < s.length(); i++) {
            currChar = s.substring(i, i + 1);
            if (i != 0 && StringUtils.isAllUpperCase(currChar)) {
                result.append("_" + currChar);
            } else {
                result.append(currChar);
            }
        }
    }
    return result.toString().toUpperCase().replaceAll("\\_\\_", "_");
}
 
源代码5 项目: jinjava   文件: IsUpperExpTest.java
@Override
public boolean evaluate(Object var, JinjavaInterpreter interpreter, Object... args) {
  if (!(var instanceof String || var instanceof SafeString)) {
    return false;
  }

  return StringUtils.isAllUpperCase(var.toString());
}
 
源代码6 项目: dungeon   文件: UppercaseStringJsonRule.java
@Override
public void validate(JsonValue value) {
  super.validate(value);
  if (!StringUtils.isAllUpperCase(value.asString())) {
    throw new IllegalArgumentException(value + " is not uppercase.");
  }
}
 
源代码7 项目: occurrence   文件: LocationInterpreter.java
private static String cleanName(String x) {
  x = StringUtils.normalizeSpace(x).trim();
  // if we get all upper names, Capitalize them
  if (StringUtils.isAllUpperCase(StringUtils.deleteWhitespace(x))) {
    x = StringUtils.capitalize(x.toLowerCase());
  }
  return x;
}
 
源代码8 项目: vscrawler   文件: IsAllUpperCase.java
@Override
protected boolean handle(CharSequence str) {
    return StringUtils.isAllUpperCase(str);
}
 
源代码9 项目: sentiment-analysis   文件: FeaturePreprocessor.java
/**Some common pre-processing stuff*/
	public String getProcessed(String str){
		
		StringTokenizer st = new StringTokenizer(str);
		String current;
		String toreturn = "";
		boolean isSpecial = false;
		while (st.hasMoreTokens()){		
			current = st.nextToken();						
			String backup = current;
			current = replaceEmoticons(current);			// current is altered to "happy"/"sad"
			current = replaceTwitterFeatures(current);		// i.e. links, mentions, hash-tags
//			current = replaceConsecutiveLetters(current);	// replaces more than 2 repetitive letters with 2
			current = replaceNegation(current);				// if current is a negation word, then current = "negation"

			for (int i=0; i<exclamationsymbol.size(); i++){
				if (current.contains(exclamationsymbol.get(i)) && current.contains(dotsymbol.get(i))){
					current="dotsymbol exclamationsymbol";
				} else if (current.contains(exclamationsymbol.get(i))){
					current="exclamationsymbol";
				} else if (current.contains(dotsymbol.get(i))){
					current="dotsymbol";
				}
			}
			if (StringUtils.isAllUpperCase(backup.replaceAll("[^A-Za-z]", "")) && backup.replaceAll("[^A-Za-z]", "").length()>3){
				isSpecial = true;
				current = backup.replaceAll("[^A-Za-z]", "").toLowerCase();
			}
			if (backup.contains("#")){
				isSpecial = true;
				current = backup.substring(backup.indexOf("#")+1);
			}
			if (backup.replaceAll("[^A-Za-z]", "").length()>0 && containsRepetitions(backup.replaceAll("[^A-Za-z]", ""))){
				isSpecial = true;
				current = replaceConsecutiveLetters(backup);
			}
			
			if ( (current.contains("hashtagsymbol") || current.contains("urlinksymbol") || current.contains("negation") || current.contains("usermentionsymbol") || current.contains("consecutivesymbol") || current.contains("dotsymbol") || current.contains("exclamationsymbol") || current.contains("alcapital")) )
				isSpecial = true;
			if (isSpecial==true)
				toreturn = toreturn.concat(" "+current);
			isSpecial = false;
		}
		return toreturn;
	}
 
 同类方法