Java Code Examples for org.apache.commons.lang3.StringUtils#isAllUpperCase()
The following examples show how to use
org.apache.commons.lang3.StringUtils#isAllUpperCase() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: we-cmdb File: CiTypeAttrsInterceptorService.java License: Apache License 2.0 | 6 votes |
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)); } } }
Example 2
Source Project: vividus File: AbstractElementSearchAction.java License: Apache License 2.0 | 6 votes |
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; } }
Example 3
Source Project: scava File: Token.java License: Eclipse Public License 2.0 | 6 votes |
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; }
Example 4
Source Project: obridge File: StringHelper.java License: MIT License | 5 votes |
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("\\_\\_", "_"); }
Example 5
Source Project: jinjava File: IsUpperExpTest.java License: Apache License 2.0 | 5 votes |
@Override public boolean evaluate(Object var, JinjavaInterpreter interpreter, Object... args) { if (!(var instanceof String || var instanceof SafeString)) { return false; } return StringUtils.isAllUpperCase(var.toString()); }
Example 6
Source Project: dungeon File: UppercaseStringJsonRule.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void validate(JsonValue value) { super.validate(value); if (!StringUtils.isAllUpperCase(value.asString())) { throw new IllegalArgumentException(value + " is not uppercase."); } }
Example 7
Source Project: occurrence File: LocationInterpreter.java License: Apache License 2.0 | 5 votes |
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; }
Example 8
Source Project: vscrawler File: IsAllUpperCase.java License: Apache License 2.0 | 4 votes |
@Override protected boolean handle(CharSequence str) { return StringUtils.isAllUpperCase(str); }
Example 9
Source Project: sentiment-analysis File: FeaturePreprocessor.java License: Apache License 2.0 | 4 votes |
/**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; }