本文整理匯總了Java中org.apache.commons.lang.StringUtils.isBlank方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.isBlank方法的具體用法?Java StringUtils.isBlank怎麽用?Java StringUtils.isBlank使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isBlank方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkFieldFormat
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public static void checkFieldFormat(VirtualizationConnectorDto dto) throws VmidcBrokerInvalidEntryException {
ValidateUtil.checkForValidIpAddressFormat(dto.getProviderIP());
if (dto.getType().isOpenstack() && dto.getProviderAttributes() != null) {
String rabbitMqPort = dto.getProviderAttributes().get(ATTRIBUTE_KEY_RABBITMQ_PORT);
if (!StringUtils.isNumeric(rabbitMqPort)) {
throw new VmidcBrokerInvalidEntryException(
ATTRIBUTE_KEY_RABBITMQ_PORT + " expected to be an Integer. Value is: " + rabbitMqPort);
}
String rabbitMQIP = dto.getProviderAttributes().get(ATTRIBUTE_KEY_RABBITMQ_IP);
if (!StringUtils.isBlank(rabbitMQIP)) {
ValidateUtil.checkForValidIpAddressFormat(rabbitMQIP);
}
}
}
示例2: isMisConfigured
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public static boolean isMisConfigured(Properties clusterProps, Properties serverProps,
String key) {
String clusterPropValue = clusterProps.getProperty(key);
String serverPropValue = serverProps.getProperty(key);
// if this server prop is not specified, this is always OK.
if (StringUtils.isBlank(serverPropValue))
return false;
// server props is not blank, but cluster props is blank, NOT OK.
if (StringUtils.isBlank(clusterPropValue))
return true;
// at this point check for eqality
return !clusterPropValue.equals(serverPropValue);
}
示例3: setToolTipForMixedSchemeGridRow
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private String setToolTipForMixedSchemeGridRow(MixedSchemeGridRow mixedSchemeGridRow, String componentType){
if(StringUtils.isBlank(mixedSchemeGridRow.getDelimiter())
&& StringUtils.isBlank(mixedSchemeGridRow.getLength())){
return Messages.LENGTH_OR_DELIMITER_MUST_NOT_BE_BLANK;
}else if(StringUtils.isNotBlank(mixedSchemeGridRow.getLength()) && !(mixedSchemeGridRow.getLength().matches(REGULAR_EXPRESSION_FOR_NUMBER))){
return Messages.LENGTH_MUST_BE_AN_INTEGER_VALUE;
}else if(StringUtils.isNotBlank(mixedSchemeGridRow.getDelimiter())
&& StringUtils.isNotBlank(mixedSchemeGridRow.getLength())){
return Messages.ONLY_SPECIFY_LENGTH_OR_DELIMITER;
}
else if(StringUtils.isNotBlank(mixedSchemeGridRow.getLength()) && Integer.parseInt(mixedSchemeGridRow.getLength())==0){
return Messages.LENGTH_SHOULD_NOT_BE_ZERO;
}
if(StringUtils.equalsIgnoreCase(mixedSchemeGridRow.getDataTypeValue(), JAVA_UTIL_DATE)
&& StringUtils.isBlank(mixedSchemeGridRow.getDateFormat())){
return setToolTipForDateFormatIfBlank(mixedSchemeGridRow);
}else if((StringUtils.equalsIgnoreCase(mixedSchemeGridRow.getDataTypeValue(), JAVA_MATH_BIG_DECIMAL))){
return setToolTipForBigDecimal(mixedSchemeGridRow, componentType);
}
return "";
}
示例4: collectDirs
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private static void collectDirs(String path, List<String> collector) {
if (null == path || StringUtils.isBlank(path)) {
return;
}
File current = new File(path);
if (!current.exists() || !current.isDirectory()) {
return;
}
for (File child : current.listFiles()) {
if (!child.isDirectory()) {
continue;
}
collector.add(child.getAbsolutePath());
collectDirs(child.getAbsolutePath(), collector);
}
}
示例5: getSimilarFile
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* getSimilarFile
*
* @param directory
* @param prefix
* @param asc
* @return
*/
public static List<File> getSimilarFile(String directory, String prefix, final boolean asc) {
if (StringUtils.isBlank(directory)) {
return Lists.newArrayList();
}
File dir = new File(directory);
if (!dir.exists() || !dir.isDirectory()) {
return Lists.newArrayList();
}
boolean isFilter = StringUtils.isNotBlank(prefix);
File[] files = dir.listFiles((d, name) -> {
return isFilter ? name.startsWith(prefix) : true;
});
List<File> filelist = Arrays.asList(files);
Collections.sort(filelist, (file1, file2) -> {
long fm1 = ((file1 == null) ? 0 : file1.lastModified());
long fm2 = ((file2 == null) ? 0 : file2.lastModified());
if (fm1 == fm2) {
return 0;
}
return asc ? ((fm1 > fm2) ? 1 : -1) : ((fm1 > fm2) ? -1 : 1);
});
return filelist;
}
示例6: toUpperCaseFirstOne
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* 首字母轉大寫
* @param s
* @return
*/
public static String toUpperCaseFirstOne(String s) {
if (StringUtils.isBlank(s)) {
return s;
}
if (Character.isUpperCase(s.charAt(0))) {
return s;
} else {
return (new StringBuffer()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString();
}
}
示例7: getNewFriendList
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* 獲取新的好友列表
* @return
*/
@RequestMapping(value = "/getNewFriendList")
@ResponseBody
public PageData getNewFriendList(@RequestBody PageData pd) throws Exception {
if (StringUtils.isBlank(pd.getString("UI_ID"))) {
return WebResult.requestFailed(10001, "參數缺失!", null);
}
else {
List<PageData> res = appUserFriendMapper.getNewFriendList(pd);
return WebResult.requestSuccess(res);
}
}
示例8: doPost
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@Override
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {
Map<String, String> params = getSingleParameter(request);
String taskId = params.get("taskId");
String cid = params.get("cid");
String dstCid = params.get("dstCid");
String range = params.get("pieceRange");
if (StringUtils.isBlank(taskId) || StringUtils.isBlank(cid)
|| StringUtils.isBlank(range)) {
result(response, new ResultInfo(ResultCode.PARAM_ERROR,
"some param is empty", null));
return;
}
int pieceNum = RangeParseUtil.calculatePieceNum(range);
ResultInfo resultInfo = null;
if (pieceNum >= 0) {
resultInfo = progressService.updateProgress(taskId, cid,
dstCid, pieceNum, PeerPieceStatus.SUCCESS);
} else {
logger.error("do piece suc fail for cid:{} pieceNum:{}", cid,
pieceNum);
}
if (resultInfo == null) {
resultInfo = new ResultInfo(ResultCode.SYSTEM_ERROR);
}
result(response, resultInfo);
} catch (Exception e) {
result(response,
new ResultInfo(ResultCode.SYSTEM_ERROR, e.getMessage(),
null));
}
}
示例9: getScanList
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* 用戶瀏覽列表(專家)
* @return
*/
@RequestMapping(value = "/getScanList")
@ResponseBody
public PageData getScanList(@RequestBody PageData pd) throws Exception {
if (StringUtils.isBlank(pd.getString("UI_ID"))) {
return WebResult.requestFailed(10001, "參數缺失!", null);
}
else {
List<PageData> list = appUserScanMapper.getScanList(pd);
return WebResult.requestSuccess(list);
}
}
示例10: getPlayerById
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* Returns the player with the given ID.
*
* @param id The unique player ID.
* @return The player with the given ID, or <code>null</code> if no such player exists.
*/
public Player getPlayerById(String id) {
if (StringUtils.isBlank(id)) {
return null;
} else {
return playerDao.getPlayerById(id);
}
}
示例11: eval
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public boolean eval(Object left, Object right,Datatype datatype) {
if(left==null){
return true;
}else{
return StringUtils.isBlank(left.toString());
}
}
示例12: TradeCloseData
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public TradeCloseData(String outTradeNo, String tradeNo) {
if (StringUtils.isBlank(outTradeNo) && StringUtils.isBlank(tradeNo)) {
throw new NullArgumentException("outTradeNo or tradeNo");
}
this.outTradeNo = outTradeNo;
this.tradeNo = tradeNo;
}
示例13: getUserSportStepRankingBySelf
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* 用戶運動排行榜個人信息
* @return
*/
@RequestMapping(value = "/step/ranking/self")
@ResponseBody
public PageData getUserSportStepRankingBySelf(@RequestBody PageData pd) throws Exception {
if(StringUtils.isBlank(pd.getString("UI_ID"))){
return WebResult.requestFailed(10001, "參數缺失!", null);
}else{
PageData accInfo = appUserSportMapper.getUserSportStepRankingBySelf(pd);
return WebResult.requestSuccess(accInfo);
}
}
示例14: buildNameSearch
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private void buildNameSearch(StringBuilder queryText, String searchString) {
if (!StringUtils.isBlank(searchString)) {
String[] tokens = searchString.trim().split("\\s+");
for (String token : tokens) {
String escToken = StringEscapeUtils.escapeSql(token);
queryText.append(" AND (user.first_name LIKE '%").append(escToken)
.append("%' OR user.last_name LIKE '%").append(escToken).append("%' OR user.login_name LIKE '%")
.append(escToken).append("%')");
}
}
}
示例15: GiteaServer
import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
* @param displayName Optional name to use to describe the end-point.
* @param serverUrl The URL of this Bitbucket Server
* @param manageHooks {@code true} if and only if Jenkins is supposed to auto-manage hooks for this end-point.
* @param credentialsId The {@link StandardUsernamePasswordCredentials#getId()} of the credentials to use for
* auto-management of hooks.
*/
@DataBoundConstructor
public GiteaServer(@CheckForNull String displayName, @NonNull String serverUrl, boolean manageHooks,
@CheckForNull String credentialsId) {
this.manageHooks = manageHooks && StringUtils.isNotBlank(credentialsId);
this.credentialsId = manageHooks ? credentialsId : null;
this.serverUrl = GiteaServers.normalizeServerUrl(serverUrl);
this.displayName = StringUtils.isBlank(displayName)
? SCMName.fromUrl(this.serverUrl, COMMON_PREFIX_HOSTNAMES)
: displayName;
}