List of usage examples for java.lang Character isUpperCase
public static boolean isUpperCase(int codePoint)
From source file:kltn.controller.StartController.java
public static boolean checkUpper(String s) { if (s.length() >= 1) { return Character.isUpperCase(s.charAt(0)); }/*from ww w .j a va 2 s.c om*/ return false; }
From source file:com.google.dart.engine.services.internal.correction.CorrectionUtils.java
private static String getBaseNameFromExpression(Expression expression) { String name = null;/* w w w.j av a 2 s . com*/ // e as Type if (expression instanceof AsExpression) { AsExpression asExpression = (AsExpression) expression; expression = asExpression.getExpression(); } // analyze expressions if (expression instanceof SimpleIdentifier) { SimpleIdentifier node = (SimpleIdentifier) expression; return node.getName(); } else if (expression instanceof PrefixedIdentifier) { PrefixedIdentifier node = (PrefixedIdentifier) expression; return node.getIdentifier().getName(); } else if (expression instanceof MethodInvocation) { name = ((MethodInvocation) expression).getMethodName().getName(); } // strip known prefixes if (name != null) { for (int i = 0; i < KNOWN_METHOD_NAME_PREFIXES.length; i++) { String curr = KNOWN_METHOD_NAME_PREFIXES[i]; if (name.startsWith(curr)) { if (name.equals(curr)) { return null; // don't suggest 'get' as variable name } else if (Character.isUpperCase(name.charAt(curr.length()))) { return name.substring(curr.length()); } } } } // done return name; }
From source file:CharUtils.java
/** * True if string is all caps.//w ww . j a v a 2 s .c o m * * @param s * String to check for being all capitals. * * @return True if string is all capitals. */ public static boolean isAllCaps(String s) { boolean result = true; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (Character.isLetter(ch)) { result = result && Character.isUpperCase(ch); if (!result) break; } } return result; }
From source file:com.sinosoft.one.mvc.web.impl.module.ModulesBuilderImpl.java
private List<InterceptorDelegate> findInterceptors(XmlWebApplicationContext context) throws FileNotFoundException, ParserConfigurationException, SAXException, IOException { String[] interceptorNames = SpringUtils.getBeanNames(context.getBeanFactory(), ControllerInterceptor.class); ArrayList<InterceptorDelegate> interceptors = new ArrayList<InterceptorDelegate>(interceptorNames.length); for (String beanName : interceptorNames) { ControllerInterceptor interceptor = (ControllerInterceptor) context.getBean(beanName); Class<?> userClass = ClassUtils.getUserClass(interceptor); if (userClass.isAnnotationPresent(Ignored.class)) { if (logger.isDebugEnabled()) { logger.debug("Ignored interceptor (Ignored):" + interceptor); }/*from ww w . j a v a 2s .c o m*/ continue; } if (userClass.isAnnotationPresent(NotForSubModules.class) && !context.getBeanFactory().containsBeanDefinition(beanName)) { if (logger.isDebugEnabled()) { logger.debug("Ignored interceptor (NotForSubModules):" + interceptor); } continue; } if (!userClass.getSimpleName().endsWith(MvcConstants.INTERCEPTOR_SUFFIX)) { logger.error("", new IllegalArgumentException("Interceptor must be end with '" + MvcConstants.INTERCEPTOR_SUFFIX + "': " + userClass.getName())); continue; } InterceptorBuilder builder = new InterceptorBuilder(interceptor); Interceptor annotation = userClass.getAnnotation(Interceptor.class); if (annotation != null) { builder.oncePerRequest(annotation.oncePerRequest()); } String interceporName; if (beanName.startsWith(AUTO_BEAN_NAME_PREFIX)) { interceporName = StringUtils.removeEnd(StringUtils.uncapitalize(userClass.getSimpleName()), MvcConstants.INTERCEPTOR_SUFFIX); } else { interceporName = StringUtils.removeEnd(beanName, MvcConstants.INTERCEPTOR_SUFFIX); } final String mvc = "mvc"; if (interceporName.startsWith(mvc) && (interceporName.length() == mvc.length() || Character.isUpperCase(interceporName.charAt(mvc.length()))) && !userClass.getName().startsWith("com.sinosoft.one.mvc.")) { throw new IllegalArgumentException("illegal interceptor name '" + interceporName + "' for " + userClass.getName() + ": don't starts with 'mvc', it's reserved"); } builder.name(interceporName); InterceptorDelegate wrapper = builder.build(); interceptors.add(wrapper); if (logger.isDebugEnabled()) { int priority = 0; if (interceptor instanceof Ordered) { priority = ((Ordered) interceptor).getPriority(); } logger.debug("recognized interceptor[priority=" + priority + "]: " // \r\n + wrapper.getName() + "=" + userClass.getName()); } } // start by kylin List<String> rList = ResourceLoaderUtil.getResource("interceptors-order.xml", true); if (rList != null) { Collections.sort(interceptors); int tempGlobalPriority = 1; for (String configInterName : rList) { for (int j = 0, length = interceptors.size(); j < length; j++) { InterceptorDelegate interceptorDelegate = interceptors.get(j); ControllerInterceptor temp = InterceptorDelegate .getMostInnerInterceptor(interceptorDelegate.getInterceptor()); if (temp.getClass().getName().startsWith("com.sinosoft.one.mvc.web") || temp.getClass().getName().startsWith("com.sinosoft.one.mvc.controllers")) { continue; } if (rList.toString().contains(temp.getClass().getName())) { if (configInterName.trim().equals(temp.getClass().getName())) { if (temp instanceof ControllerInterceptorAdapter) { ((ControllerInterceptorAdapter) temp).setPriority( this.GLOBAL_INTERCEPTOR_CONFIG_START_PRIORITY - tempGlobalPriority++); continue; } else { if (temp instanceof ControllerInterceptorAdapter) { ((ControllerInterceptorAdapter) temp).setPriority( this.INTERCEPTOR_NOT_CONFIG_START_PRIORITY - tempGlobalPriority++); } } } } else { if (temp instanceof ControllerInterceptorAdapter) { ((ControllerInterceptorAdapter) temp) .setPriority(this.INTERCEPTOR_NOT_CONFIG_START_PRIORITY - tempGlobalPriority++); } } if (logger.isDebugEnabled()) { logger.debug("Interceptor's Priority:" + temp.getClass().getName() + ":" + ((ControllerInterceptorAdapter) temp).getPriority()); } } } } // end by kylin Collections.sort(interceptors); throwExceptionIfDuplicatedNames(interceptors); return interceptors; }
From source file:org.jiemamy.utils.JmStringUtil.java
/** * Java???Java???SLQ????/*from w ww.j a va2 s . co m*/ * * <p>SQL?????????????</p> * * @param str Java?????Java?? * @return SQL???{@code str}????????? */ public static String toSqlName(String str) { if (isEmpty(str)) { return str; } if (isSqlName(str)) { return str; } if ((isJavaClassName(str) || isJavaName(str)) == false) { return str.toUpperCase(Locale.getDefault()); } StringBuilder sb = new StringBuilder(str); for (int i = 0; i < sb.length(); i++) { char c = sb.charAt(i); if (Character.isUpperCase(c) && i != 0) { sb.insert(i++, "_"); } else { sb.setCharAt(i, Character.toUpperCase(c)); } } return sb.toString(); }
From source file:org.jsweet.input.typescriptdef.util.Util.java
public static boolean elligibleToClass(ModuleDeclaration module) { if (Character.isUpperCase(module.getName().charAt(0)) && !StringUtils.isAllUpperCase(module.getName())) { for (Declaration declaration : module.getMembers()) { if (declaration instanceof TypeDeclaration || declaration instanceof ModuleDeclaration) { return false; }//from w w w. j ava 2 s. com } return true; } else { return false; } }
From source file:org.languagetool.rules.de.VerbAgreementRule.java
private RuleMatch ruleMatchWrongVerbSubject(AnalyzedTokenReadings subject, AnalyzedTokenReadings verb, String expectedVerbPOS, int pos, AnalyzedSentence sentence) { String msg = "Mglicherweise fehlende grammatische bereinstimmung zwischen Subjekt (" + subject.getToken() + ") und Prdikat (" + verb.getToken() + ") bezglich Person oder Numerus (Einzahl, Mehrzahl - Beispiel: " + "'ich sind' statt 'ich bin')."; List<String> suggestions = new ArrayList<>(); List<String> verbSuggestions = new ArrayList<>(); List<String> pronounSuggestions = new ArrayList<>(); RuleMatch ruleMatch;/* w w w. j a va 2s .co m*/ if (subject.getStartPos() < verb.getStartPos()) { ruleMatch = new RuleMatch(this, sentence, pos + subject.getStartPos(), pos + verb.getStartPos() + verb.getToken().length(), msg); verbSuggestions.addAll(getVerbSuggestions(verb, expectedVerbPOS, false)); for (String verbSuggestion : verbSuggestions) { suggestions.add(subject.getToken() + " " + verbSuggestion); } pronounSuggestions .addAll(getPronounSuggestions(verb, Character.isUpperCase(subject.getToken().charAt(0)))); for (String pronounSuggestion : pronounSuggestions) { suggestions.add(pronounSuggestion + " " + verb.getToken()); } ruleMatch.setSuggestedReplacements(suggestions); } else { ruleMatch = new RuleMatch(this, sentence, pos + verb.getStartPos(), pos + subject.getStartPos() + subject.getToken().length(), msg); verbSuggestions.addAll( getVerbSuggestions(verb, expectedVerbPOS, Character.isUpperCase(verb.getToken().charAt(0)))); for (String verbSuggestion : verbSuggestions) { suggestions.add(verbSuggestion + " " + subject.getToken()); } pronounSuggestions.addAll(getPronounSuggestions(verb, false)); for (String pronounSuggestion : pronounSuggestions) { suggestions.add(verb.getToken() + " " + pronounSuggestion); } ruleMatch.setSuggestedReplacements(suggestions); } return ruleMatch; }
From source file:com.adaptc.mws.plugins.testing.transformations.TestMixinTransformation.java
/** * Calculate the name for a getter method to retrieve the specified property * @param propertyName//from ww w . j a v a 2s . co m * @return The name for the getter method for this property, if it were to exist, i.e. getConstraints */ public static String getGetterName(String propertyName) { final String suffix; if (propertyName.length() > 1 && Character.isLowerCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { suffix = propertyName; } else { suffix = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); } return "get" + suffix; }
From source file:CharUtils.java
/** * True if string contains at least one capital letter. * // w w w. j a v a 2s . com * @param s * String to check for having a capital letter. * * @return True if string has a capital letter. */ public static boolean hasCapitalLetter(String s) { boolean result = false; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); result = result || Character.isLetter(ch) && Character.isUpperCase(ch); if (result) break; } return result; }