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

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

源代码1 项目: arcusplatform   文件: IpcdRegistry.java
private List<com.iris.protocol.ipcd.message.model.Device> createDevicesFromBody(MessageBody body) {
   Map<String, String> attrs = readAttrs(body);

   String sn = attrs.get(IpcdProtocol.ATTR_SN);
   if(StringUtils.isBlank(sn)) {
      throw new ErrorEventException(Errors.invalidRequest(BridgeService.RegisterDeviceRequest.ATTR_ATTRS + " must contain " + IpcdProtocol.ATTR_SN));
   }
   sn = StringUtils.upperCase(sn);

   String devType = attrs.get(IpcdProtocol.ATTR_V1DEVICETYPE);
   List<com.iris.protocol.ipcd.message.model.Device> devices = IpcdDeviceTypeRegistry.INSTANCE.createDeviceForV1Type(devType, sn);
   if (null == devices || devices.isEmpty()) {
      throw new ErrorEventException(Errors.invalidRequest("The v1 device type [" + devType + "] and serial number [" + sn + "] failed to create any devices."));
   }

   return devices;
}
 
源代码2 项目: td-ameritrade-client   文件: HttpTdaClient.java
@Override
public PriceHistory priceHistory(String symbol) {
  symbol = StringUtils.upperCase(symbol);
  LOGGER.info("price history for symbol: {}", symbol);
  if (StringUtils.isBlank(symbol)) {
    throw new IllegalArgumentException("symbol cannot be empty");
  }

  HttpUrl url = baseUrl("marketdata", symbol, "pricehistory").build();
  Request request = new Request.Builder().url(url).headers(defaultHeaders()).build();
  try (Response response = this.httpClient.newCall(request).execute()) {
    checkResponse(response, false);
    return tdaJsonParser.parsePriceHistory(response.body().byteStream());
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
源代码3 项目: quartz-glass   文件: CronExpressionDescriptor.java
/**
 * @param description
 * @return
 */
private static String transformCase(String description, Options options) {
    String descTemp = description;
    switch (options.getCasingType()) {
        case Sentence:
            descTemp = StringUtils.upperCase("" + descTemp.charAt(0)) + descTemp.substring(1);
            break;
        case Title:
            descTemp = StringUtils.capitalize(descTemp);
            break;
        default:
            descTemp = descTemp.toLowerCase();
            break;
    }
    return descTemp;
}
 
源代码4 项目: jmeter-plugins   文件: CaseFormat.java
/**
 * Change case using delimiter between words
 * 
 * @param str
 * @param delimiter
 * @param isAllUpper
 * @param isAllLower
 * @return string after change case
 */
private static String caseFormatWithDelimiter(String str, String delimiter, boolean isAllUpper, boolean isAllLower) {
	StringBuilder builder = new StringBuilder(str.length());
	String[] tokens = NOT_ALPHANUMERIC_REGEX.split(str);
	boolean shouldAddDelimiter = StringUtils.isNotEmpty(delimiter);
	for (int i = 0; i < tokens.length; i++) {
		String currentToken = tokens[i];
		builder.append(currentToken);
		boolean hasNextToken = i + 1 != tokens.length;
		if (hasNextToken && shouldAddDelimiter) {
			builder.append(delimiter);
		}
	}
	String outputString = builder.toString();
	if (isAllLower) {
		return StringUtils.lowerCase(outputString);
	} else if (isAllUpper) {
		return StringUtils.upperCase(outputString);
	}
	return outputString;
}
 
源代码5 项目: openemm   文件: ComWorkflowEQLHelper.java
private String generateDateEQL(String resolvedFieldName, String field, int operatorCode, String dateFormat, String value, boolean disableThreeValuedLogic) throws EQLCreationException {
    TargetOperator targetOperator = getValidOperator(TargetNodeDate.getValidOperators(), operatorCode);
    
    if (targetOperator == null) {
        throw new EQLCreationException("No or invalid primary operator defined");
    }
    
    if(targetOperator == OPERATOR_IS) {
        return String.format("%s %s", resolvedFieldName, EqlUtils.getIsEmptyOperatorValue(value));
    }
    
    String eql;
    String dateFormatEQL = EqlUtils.toEQLDateFormat(StringUtils.defaultIfEmpty(dateFormat, DEFAULT_EQL_DATE_PATTERN));

    if (DATE_CURRENT_TIMESTAMP.equalsIgnoreCase(field) || DATE_SYSDATE.equalsIgnoreCase(field) || DATE_NOW.equalsIgnoreCase(field)) {
        eql = String.format("TODAY %s %s DATEFORMAT %s", targetOperator.getOperatorSymbol(), StringUtil.makeEqlStringConstant(value), StringUtil.makeEqlStringConstant(dateFormatEQL));
    } else {
        value = StringUtils.upperCase(value);

        if (value.startsWith(DATE_CURRENT_TIMESTAMP)) {
            value = "TODAY" + value.substring(DATE_CURRENT_TIMESTAMP.length());
        } else if (value.startsWith(DATE_SYSDATE)) {
            value = "TODAY" + value.substring(DATE_SYSDATE.length());
        } else if (value.startsWith(DATE_NOW)) {
            value = "TODAY" + value.substring(DATE_NOW.length());
        } else {
            value = StringUtil.makeEqlStringConstant(value);
        }

        value += " DATEFORMAT '" + dateFormatEQL + "'";

        eql = EqlUtils.makeEquation(resolvedFieldName, targetOperator, value, disableThreeValuedLogic);
    }
		
    return eql;
}
 
源代码6 项目: SkaETL   文件: UpperCaseTransformator.java
@Override
public void apply(String idProcess, ParameterTransformation parameterTransformation, ObjectNode jsonValue) {
    if (has(parameterTransformation.getKeyField(),jsonValue)) {
        JsonNode valueField = at(parameterTransformation.getKeyField(), jsonValue);
        String capitalized = StringUtils.upperCase(valueField.textValue());
        put(jsonValue, parameterTransformation.getKeyField(), capitalized);
    }
}
 
@Test
public void testAlternateSDUndoPruneParametersActuallyChangeData() {
    // This test simply tests that if we change the value of the parameter that the output is altered.

    final File output = createTempFile("gatkcnv.HCC1143", ".seg");
    final File outputNewParam = createTempFile("gatkcnv.HCC1143.sdundo", ".seg");

    final File tmpWeightsFile = IOUtils.createTempFile("integration-weight-file", ".txt");
    final double [] weights = new double[7677];
    Arrays.fill(weights, 1.0);
    ParamUtils.writeValuesToFile(weights, tmpWeightsFile);
    final String sampleName = "HCC1143";
    RCBSSegmenter.writeSegmentFile(sampleName, INPUT_FILE.getAbsolutePath(), output.getAbsolutePath(), true);
    final String[] arguments = {
            "-" + ExomeStandardArgumentDefinitions.TANGENT_NORMALIZED_COUNTS_FILE_SHORT_NAME, INPUT_FILE.getAbsolutePath(),
            "-" + ExomeStandardArgumentDefinitions.LOG2_SHORT_NAME,
            "-" + PerformSegmentation.TARGET_WEIGHT_FILE_SHORT_NAME, tmpWeightsFile.getAbsolutePath(),
            "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, output.getAbsolutePath(),
            "-" + PerformSegmentation.UNDOSPLITS_SHORT_NAME, StringUtils.upperCase(RCBSSegmenter.UndoSplits.PRUNE.toString())
    };
    runCommandLine(arguments);

    final String[] newArguments = {
            "-" + ExomeStandardArgumentDefinitions.TANGENT_NORMALIZED_COUNTS_FILE_SHORT_NAME, INPUT_FILE.getAbsolutePath(),
            "-" + ExomeStandardArgumentDefinitions.LOG2_SHORT_NAME,
            "-" + PerformSegmentation.TARGET_WEIGHT_FILE_SHORT_NAME, tmpWeightsFile.getAbsolutePath(),
            "-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputNewParam.getAbsolutePath(),
            "-" + PerformSegmentation.UNDOSPLITS_SHORT_NAME, StringUtils.upperCase(RCBSSegmenter.UndoSplits.PRUNE.toString()),
            "-" + PerformSegmentation.UNDOPRUNE_SHORT_NAME, String.valueOf(0.1)
    };
    runCommandLine(newArguments);

    SegmenterUnitTest.assertNotEqualSegments(outputNewParam, output);
}
 
源代码8 项目: para   文件: User.java
/**
 * Sets a preferred currency. Default is "EUR".
 * @param currency a 3-letter currency code
 */
public void setCurrency(String currency) {
	currency = StringUtils.upperCase(currency);
	if (!CurrencyUtils.getInstance().isValidCurrency(currency)) {
		currency = "EUR";
	}
	this.currency = currency;
}
 
源代码9 项目: para   文件: App.java
final boolean isAllowed(String subjectid, String resourcePath, String httpMethod) {
	boolean allowed = false;
	if (subjectid != null && resourcePath != null && getResourcePermissions().containsKey(subjectid)) {
		httpMethod = StringUtils.upperCase(httpMethod);
		String wildcard = ALLOW_ALL;
		String exactPathToMatch = resourcePath;
		if (fromString(httpMethod) == GUEST) {
			// special case where we have wildcard permissions * but public access is not allowed
			wildcard = httpMethod;
		}
		if (StringUtils.contains(resourcePath, '/')) {
			// we assume that a full resource path is given like: 'users/something/123'
			// so we check to see if 'users/something' is in the list of resources.
			// we don't want 'users/someth' to match, but only the exact full path
			String fragment = resourcePath.substring(0, resourcePath.lastIndexOf('/'));
			for (String resource : getResourcePermissions().get(subjectid).keySet()) {
				if (StringUtils.startsWith(fragment, resource) &&
						pathMatches(subjectid, resource, httpMethod, wildcard)) {
					allowed = true;
					break;
				}
				// allow basic wildcard matching
				if (StringUtils.endsWith(resource, "/*") &&
						resourcePath.startsWith(resource.substring(0, resource.length() - 1))) {
					exactPathToMatch = resource;
					break;
				}
			}
		}
		if (!allowed && getResourcePermissions().get(subjectid).containsKey(exactPathToMatch)) {
			// check if exact resource path is accessible
			allowed = pathMatches(subjectid, exactPathToMatch, httpMethod, wildcard);
		} else if (!allowed && getResourcePermissions().get(subjectid).containsKey(ALLOW_ALL)) {
			// check if ALL resources are accessible
			allowed = pathMatches(subjectid, ALLOW_ALL, httpMethod, wildcard);
		}
	}
	return allowed;
}
 
源代码10 项目: gazpachoquest   文件: AcronymGeneratorImpl.java
@Override
public String generate(String givenNames, String surname) {

    Assert.hasText(givenNames, "Given name is required");
    Assert.hasText(surname, "Surname is required");

    int wordsSize = 0;
    wordsSize += givenNames.length();
    wordsSize += surname.length();
    if (wordsSize < DEFAULT_SIZE) {
        return StringUtils.upperCase(new StringBuilder().append(givenNames).append(surname).toString());
    }

    // Character number to take from given names
    int fromGivenNames = 4;
    int fromSurname = 4;
    if (givenNames.length() < 4) {
        fromGivenNames = givenNames.length();
        fromSurname += (4 - givenNames.length());
    }
    if (surname.length() < 4) {
        fromSurname = surname.length();
        fromGivenNames += (4 - surname.length());
    }
    StringBuilder builder = new StringBuilder();
    builder.append(givenNames.substring(0, fromGivenNames));
    builder.append(surname.substring(0, fromSurname));
    return StringUtils.upperCase(builder.toString());
}
 
源代码11 项目: td-ameritrade-client   文件: MiscTest.java
private String doesCopy(String param) {
  param = StringUtils.upperCase(param);
  return param;
}
 
源代码12 项目: o2oa   文件: DynamicEntity.java
public String tableName() throws Exception {
	if (StringUtils.isEmpty(name)) {
		throw new Exception("name is empty.");
	}
	return TABLE_PREFIX + StringUtils.upperCase(name);
}
 
源代码13 项目: vscrawler   文件: UpperCase.java
@Override
protected String handleSingleStr(String input) {
    return StringUtils.upperCase(input);
}
 
源代码14 项目: cuba   文件: WebSearchField.java
protected void executeSearch(final String newFilter) {
    if (optionsBinding == null || optionsBinding.getSource() == null) {
        return;
    }

    String filterForDs = newFilter;
    if (mode == Mode.LOWER_CASE) {
        filterForDs = StringUtils.lowerCase(newFilter);
    } else if (mode == Mode.UPPER_CASE) {
        filterForDs = StringUtils.upperCase(newFilter);
    }

    if (escapeValueForLike && StringUtils.isNotEmpty(filterForDs)) {
        filterForDs = QueryUtils.escapeForLike(filterForDs);
    }

    CollectionDatasource optionsDatasource = ((DatasourceOptions) optionsBinding.getSource()).getDatasource();

    if (!isRequired() && StringUtils.isEmpty(filterForDs)) {
        setValue(null);
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }
        return;
    }

    if (StringUtils.length(filterForDs) >= minSearchStringLength) {
        optionsDatasource.refresh(Collections.singletonMap(SEARCH_STRING_PARAM, filterForDs));

        if (optionsDatasource.getState() == Datasource.State.VALID) {
            if (optionsDatasource.size() == 0) {
                if (searchNotifications != null) {
                    searchNotifications.notFoundSuggestions(newFilter);
                }
            } else if (optionsDatasource.size() == 1) {
                setValue((V) optionsDatasource.getItems().iterator().next());
            }
        }
    } else {
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }

        if (searchNotifications != null && StringUtils.length(newFilter) > 0) {
            searchNotifications.needMinSearchStringLength(newFilter, minSearchStringLength);
        }
    }
}
 
源代码15 项目: cuba   文件: WebSearchPickerField.java
protected void executeSearch(final String newFilter) {
    if (optionsBinding == null || optionsBinding.getSource() == null) {
        return;
    }

    String filterForDs = newFilter;
    if (mode == Mode.LOWER_CASE) {
        filterForDs = StringUtils.lowerCase(newFilter);
    } else if (mode == Mode.UPPER_CASE) {
        filterForDs = StringUtils.upperCase(newFilter);
    }

    if (escapeValueForLike && StringUtils.isNotEmpty(filterForDs)) {
        filterForDs = QueryUtils.escapeForLike(filterForDs);
    }

    CollectionDatasource optionsDatasource = ((DatasourceOptions) optionsBinding.getSource()).getDatasource();

    if (!isRequired() && StringUtils.isEmpty(filterForDs)) {
        setValue(null);
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }
        return;
    }

    if (StringUtils.length(filterForDs) >= minSearchStringLength) {
        optionsDatasource.refresh(Collections.singletonMap(SEARCH_STRING_PARAM, filterForDs));

        if (optionsDatasource.getState() == Datasource.State.VALID) {
            if (optionsDatasource.size() == 0) {
                if (searchNotifications != null) {
                    searchNotifications.notFoundSuggestions(newFilter);
                }
            } else if (optionsDatasource.size() == 1) {
                setValue((V) optionsDatasource.getItems().iterator().next());
            }
        }
    } else {
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }

        if (searchNotifications != null && StringUtils.length(newFilter) > 0) {
            searchNotifications.needMinSearchStringLength(newFilter, minSearchStringLength);
        }
    }
}
 
源代码16 项目: cuba   文件: DesktopSearchField.java
protected void handleSearch(final String newFilter) {
    clearSearchVariants();

    String filterForDs = newFilter;
    if (mode == Mode.LOWER_CASE) {
        filterForDs = StringUtils.lowerCase(newFilter);
    } else if (mode == Mode.UPPER_CASE) {
        filterForDs = StringUtils.upperCase(newFilter);
    }

    if (escapeValueForLike && StringUtils.isNotEmpty(filterForDs)) {
        filterForDs = QueryUtils.escapeForLike(filterForDs);
    }

    if (!isRequired() && StringUtils.isEmpty(filterForDs)) {
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }

        setValue(null);
        updateOptionsDsItem();
        return;
    }

    if (StringUtils.length(filterForDs) >= minSearchStringLength) {
        optionsDatasource.refresh(
                Collections.singletonMap(SearchField.SEARCH_STRING_PARAM, (Object) filterForDs));

        if (optionsDatasource.getState() == Datasource.State.VALID) {
            if (optionsDatasource.size() == 0) {
                if (searchNotifications != null)
                    searchNotifications.notFoundSuggestions(newFilter);
            } else if (optionsDatasource.size() == 1) {
                setValue(optionsDatasource.getItems().iterator().next());
                updateOptionsDsItem();
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        updateComponent(getValue());
                    }
                });
            } else {
                initSearchVariants();
                comboBox.showSearchPopup();
            }
        }
    } else {
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }

        if (searchNotifications != null && StringUtils.length(filterForDs) > 0) {
            searchNotifications.needMinSearchStringLength(newFilter, minSearchStringLength);
        }
    }
}
 
源代码17 项目: hesperides   文件: ModuleBuilder.java
public String buildNamespace() {
    return "modules#" + name + "#" + version + "#" + StringUtils.upperCase(versionType);
}
 
源代码18 项目: dss   文件: ApacheCommonsUtils.java
@Override
public String upperCase(String text) {
	return StringUtils.upperCase(text);
}
 
源代码19 项目: OpenEstate-IO   文件: TrovitUtils.java
/**
 * Write a {@link String} value for a country code into XML output.
 * <p>
 * The country has to be represendet by a ISO-Code wirh two or three
 * characters.
 *
 * @param value value to write
 * @return XML string
 * @throws IllegalArgumentException if a validation error occurred
 */
public static String printCountryValue(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        throw new IllegalArgumentException("Can't print empty country value!");
    if (value.length() != 2 && value.length() != 3)
        throw new IllegalArgumentException("Can't print country value '" + value + "' because it is neither an ISO-2-Code nor an ISO-3-Code!");

    return StringUtils.upperCase(value, Locale.ENGLISH);
}
 
源代码20 项目: demo-seata-springcloud   文件: CommonUtils.java
/**
 * md5加密
 * @param text
 * @param salt
 * @return
 * @author sly
 * @time 2018年12月12日
 */
public static String encodeMD5(String text,String salt) {
	return StringUtils.upperCase(DigestUtils.md5Hex(text + salt));
}
 
 同类方法