Java Code Examples for org.apache.commons.lang3.StringUtils#isAllLowerCase()
The following examples show how to use
org.apache.commons.lang3.StringUtils#isAllLowerCase() .
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 File: AbstractElementSearchAction.java From vividus with 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 2
Source File: Api.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
/** * Creates an valid instance of the Api object * @param apiName a String in lowercase * @param apiScope SCOPE * @param apiVersion postive integer * @return Api */ public static Api valueOf(String apiName, String apiScope, String apiVersion) throws InvalidArgumentException { SCOPE scope = null; int version = 1; try { if (!StringUtils.isAllLowerCase(apiName)) throw new InvalidArgumentException("Api name must be lowercase"); scope = SCOPE.valueOf(apiScope.toUpperCase()); version = Integer.parseInt(apiVersion); if (version < 1) throw new InvalidArgumentException("Version must be a positive integer."); } catch (Exception error) { if (error instanceof InvalidArgumentException) throw (InvalidArgumentException)error; //Just throw it on. logger.debug("Invalid API definition: "+apiName+" "+apiScope+" "+apiVersion); throw new InvalidArgumentException("Invalid API definition:"+error.getMessage()); } Api anApi = new Api(apiName, scope, version); return ALFRESCO_PUBLIC.equals(anApi)?ALFRESCO_PUBLIC:anApi; }
Example 3
Source File: AzureStorageContainerRuntime.java From components with Apache License 2.0 | 5 votes |
@Override public ValidationResult initialize(RuntimeContainer runtimeContainer, ComponentProperties properties) { // init AzureStorageContainerProperties componentProperties = (AzureStorageContainerProperties) properties; this.containerName = componentProperties.container.getValue(); // validate ValidationResult validationResult = super.initialize(runtimeContainer, properties); if (validationResult.getStatus() == ValidationResult.Result.ERROR) { return validationResult; } String errorMessage = ""; // not empty if (StringUtils.isEmpty(containerName)) { errorMessage = messages.getMessage("error.ContainerEmpty"); } // valid characters 0-9 a-z and - else if (!StringUtils.isAlphanumeric(containerName.replaceAll("-", ""))) { errorMessage = messages.getMessage("error.IncorrectName"); } // all lowercase else if (!StringUtils.isAllLowerCase(containerName.replaceAll("(-|\\d)", ""))) { errorMessage = messages.getMessage("error.UppercaseName"); } // length range : 3-63 else if ((containerName.length() < 3) || (containerName.length() > 63)) { errorMessage = messages.getMessage("error.LengthError"); } if (errorMessage.isEmpty()) { return ValidationResult.OK; } else { return new ValidationResult(ValidationResult.Result.ERROR, errorMessage); } }
Example 4
Source File: IsLowerExpTest.java From jinjava with Apache License 2.0 | 5 votes |
@Override public boolean evaluate(Object var, JinjavaInterpreter interpreter, Object... args) { if (var == null || !(var instanceof String)) { return false; } return StringUtils.isAllLowerCase((String) var); }
Example 5
Source File: BoardRestController.java From jakduk-api with MIT License | 5 votes |
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.isAllLowerCase(text)) { setValue(text.toUpperCase()); } else { throw new ServiceException(ServiceError.INVALID_PARAMETER); } }
Example 6
Source File: BoardRestController.java From jakduk-api with MIT License | 5 votes |
@Override public void setAsText(String text) throws IllegalArgumentException { if (StringUtils.isAllLowerCase(text)) { setValue(text.toUpperCase()); } else { throw new ServiceException(ServiceError.INVALID_PARAMETER); } }
Example 7
Source File: JsonFormat.java From gsc-core with GNU Lesser General Public License v3.0 | 4 votes |
private static Object handlePrimitive(Tokenizer tokenizer, FieldDescriptor field, boolean selfType) throws ParseException { Object value = null; if ("null".equals(tokenizer.currentToken())) { tokenizer.consume("null"); return value; } switch (field.getType()) { case INT32: case SINT32: case SFIXED32: value = tokenizer.consumeInt32(); break; case INT64: case SINT64: case SFIXED64: value = tokenizer.consumeInt64(); break; case UINT32: case FIXED32: value = tokenizer.consumeUInt32(); break; case UINT64: case FIXED64: value = tokenizer.consumeUInt64(); break; case FLOAT: value = tokenizer.consumeFloat(); break; case DOUBLE: value = tokenizer.consumeDouble(); break; case BOOL: value = tokenizer.consumeBoolean(); break; case STRING: value = tokenizer.consumeString(); break; case BYTES: value = tokenizer.consumeByteString(field.getFullName(), selfType); break; case ENUM: { EnumDescriptor enumType = field.getEnumType(); if (tokenizer.lookingAtInteger()) { int number = tokenizer.consumeInt32(); value = enumType.findValueByNumber(number); if (value == null) { throw tokenizer.parseExceptionPreviousToken("Enum type \"" + enumType.getFullName() + "\" has no value with number " + number + "."); } } else { String id = tokenizer.consumeIdentifier(); if (StringUtils.isAllLowerCase(id)) { char b = id.charAt(0); b = (char) (b + 'A' - 'a'); String s = id.substring(1); id = b + s; } value = enumType.findValueByName(id); if (value == null) { throw tokenizer.parseExceptionPreviousToken("Enum type \"" + enumType.getFullName() + "\" has no value named \"" + id + "\"."); } } break; } case MESSAGE: case GROUP: throw new RuntimeException("Can't get here."); default: } return value; }
Example 8
Source File: IsAllLowerCase.java From vscrawler with Apache License 2.0 | 4 votes |
@Override protected boolean handle(CharSequence str) { return StringUtils.isAllLowerCase(str); }