本文整理汇总了Java中org.apache.commons.lang3.StringUtils.isAnyEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isAnyEmpty方法的具体用法?Java StringUtils.isAnyEmpty怎么用?Java StringUtils.isAnyEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isAnyEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildQuery
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
public static String buildQuery(Map<String, String> params, String charset) throws IOException {
if (params == null || params.isEmpty()) {
return null;
}
StringBuilder query = new StringBuilder();
Set<Entry<String, String>> entries = params.entrySet();
boolean hasParam = false;
for (Entry<String, String> entry : entries) {
String name = entry.getKey();
String value = entry.getValue();
// 忽略参数名或参数值为空的参数
if (StringUtils.isAnyEmpty(name, value)) {
if (hasParam) {
query.append("&");
} else {
hasParam = true;
}
query.append(name).append("=").append(URLEncoder.encode(value, charset));
}
}
return query.toString();
}
示例2: loginDo
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
@RequestMapping(value = "login", method = RequestMethod.POST)
@ResponseBody
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, @RequestParam("user") String user) {
if (!PermissionInterceptor.ifLogin(request)) {
if (StringUtils.isAnyEmpty(user)) {
return ReturnT.FAIL;
}
JSONObject jsonObject = JSONObject.parseObject(user);
UserAuthDO user1 = JSONObject.toJavaObject(jsonObject, UserAuthDO.class);
User user2 = userService.getByName(user1.getName());
if (user2 != null) {
if (user2.getPass().equals(user1.getPass())) {
PermissionInterceptor.login(response, user2);
return ReturnT.SUCCESS;
}
return ReturnT.FAIL;
}
}
return ReturnT.FAIL;
}
示例3: createTagPool
import org.apache.commons.lang3.StringUtils; //导入方法依赖的package包/类
private List<TagPool> createTagPool(CSVParser parser) throws BuenOjoCSVParserException{
ArrayList<TagPool> list = new ArrayList<>();
for (CSVRecord record : parser) {
String name = record.get(TagPoolColumn.TAG.ordinal()).toString();
Tag tag = tagMap.get(name);
for (int i = TagPoolColumn.SIMILAR_1.ordinal(); (i <record.size()) && i <= TagPoolColumn.SIMILAR_3.ordinal(); i++) {
String similarTagName = record.get(i);
if (similarTagName != null && !StringUtils.isAnyEmpty(similarTagName)){
Tag similarTag = tagMap.get(similarTagName);
if (similarTag != null){
TagPool tagPool = new TagPool();
tagPool.setTag(tag);
tagPool.setSimilarTag(similarTag);
tagPool.setSimilarity(i);
list.add(tagPool);
} else {
throw new BuenOjoCSVParserException("no se pudo obtener la etiqueta con nombre: '"+similarTagName+"'");
}
}
}
}
return list;
}