本文整理汇总了Java中jodd.util.StringUtil.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.isBlank方法的具体用法?Java StringUtil.isBlank怎么用?Java StringUtil.isBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jodd.util.StringUtil
的用法示例。
在下文中一共展示了StringUtil.isBlank方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveActiveProfiles
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Resolves active profiles from special property.
* This property can be only a base property!
* If default active property is not defined, nothing happens.
* Otherwise, it will replace currently active profiles.
*/
protected void resolveActiveProfiles() {
if (activeProfilesProp == null) {
activeProfiles = null;
return;
}
final PropsEntry pv = data.getBaseProperty(activeProfilesProp);
if (pv == null) {
// no active profile set as the property, exit
return;
}
final String value = pv.getValue();
if (StringUtil.isBlank(value)) {
activeProfiles = null;
return;
}
activeProfiles = StringUtil.splitc(value, ',');
StringUtil.trimAll(activeProfiles);
}
示例2: readHeaders
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Parses headers.
*/
protected void readHeaders(BufferedReader reader) {
while (true) {
String line;
try {
line = reader.readLine();
} catch (IOException ioex) {
throw new HttpException(ioex);
}
if (StringUtil.isBlank(line)) {
break;
}
int ndx = line.indexOf(':');
if (ndx != -1) {
header(line.substring(0, ndx), line.substring(ndx + 1));
} else {
throw new HttpException("Invalid header: " + line);
}
}
}
示例3: getVariableMap
import jodd.util.StringUtil; //导入方法依赖的package包/类
public Map<String, Object> getVariableMap() {
Map<String, Object> vars = new HashMap<String, Object>();
ConvertUtils.register(new DateConverter(), java.util.Date.class);
if (StringUtil.isBlank(keys)) {
return vars;
}
String[] arrayKey = keys.split(",");
String[] arrayValue = values.split(",");
String[] arrayType = types.split(",");
for (int i = 0; i < arrayKey.length; i++) {
String key = arrayKey[i];
String value = arrayValue[i];
String type = arrayType[i];
Class<?> targetType = Enum.valueOf(PropertyType.class, type).getValue();
Object objectValue = ConvertUtils.convert(value, targetType);
vars.put(key, objectValue);
}
return vars;
}
示例4: parseId
import jodd.util.StringUtil; //导入方法依赖的package包/类
public static Long parseId(Object id) {
if (id == null) {
return null;
}
if (id instanceof String && !StringUtil.isBlank((String) id)) {
return Long.parseLong((String) id);
} else if (id instanceof Number) {
return ((Number) id).longValue();
}
return -1l;
}
示例5: getLable
import jodd.util.StringUtil; //导入方法依赖的package包/类
public static String getLable(String type) {
if(StringUtil.isBlank(type)){
return "";
}
switch (type) {
case Man:
return "男";
case Woman:
return "女";
default:
return "";
}
}
示例6: getNotificationClient
import jodd.util.StringUtil; //导入方法依赖的package包/类
public static NotificationClientApi getNotificationClient(NotifyConfiguration config){
NotificationClientApi client = null;
DebugType type = DebugType.None;
String debugTypeString = config.getDebugType();
if (StringUtil.isBlank(debugTypeString) == false){
type = DebugType.valueOf(debugTypeString);
}
switch(type){
case None:
default:
client = new ConfigurationAwareNotificationClient(config);
break;
case NotifyClientException:
String httpCode = config.getDebugHttpCode();
if (StringUtil.isBlank(httpCode) == false){
client = new ExceptionThrowingNotificationClient(Integer.parseInt(httpCode));
} else {
client = new ExceptionThrowingNotificationClient();
}
break;
case RuntimeException:
client = new RuntimeExceptionThrowingNotificationClient();
break;
}
log.info("Creating NotificationClientApi - {} - {}", debugTypeString, client.getClass().getCanonicalName());
return client;
}
示例7: readFrom
import jodd.util.StringUtil; //导入方法依赖的package包/类
/**
* Parses input stream and creates new <code>HttpRequest</code> object.
*/
public static HttpRequest readFrom(InputStream in) {
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(in, StringPool.ISO_8859_1));
} catch (UnsupportedEncodingException uneex) {
return null;
}
HttpRequest httpRequest = new HttpRequest();
String line;
try {
line = reader.readLine();
} catch (IOException ioex) {
throw new HttpException(ioex);
}
if (!StringUtil.isBlank(line)) {
String[] s = StringUtil.splitc(line, ' ');
httpRequest.method(s[0]);
httpRequest.path(s[1]);
httpRequest.httpVersion(s[2]);
httpRequest.readHeaders(reader);
httpRequest.readBody(reader);
}
return httpRequest;
}
示例8: isBlank
import jodd.util.StringUtil; //导入方法依赖的package包/类
public static boolean isBlank(Node node) {
return node != null && ((node.getNodeType() == Node.TEXT_NODE && StringUtil.isBlank(node.getNodeValue())) || (node.getNodeType() == Node.COMMENT_NODE));
}
示例9: prefix
import jodd.util.StringUtil; //导入方法依赖的package包/类
public static String prefix(String key) {
return StringUtil.isBlank(key) ? "" : (key + ".");
}
示例10: postfix
import jodd.util.StringUtil; //导入方法依赖的package包/类
public static String postfix(String key) {
return StringUtil.isBlank(key) ? "" : ("." + key);
}
示例11: upload
import jodd.util.StringUtil; //导入方法依赖的package包/类
@RequestMapping(value="/upload")
public ActionResultObj upload(HttpServletRequest request, HttpServletResponse response){
ActionResultObj result = new ActionResultObj();
try{
String grouping = request.getParameter("grouping");
if(StringUtil.isBlank(grouping)||grouping.equalsIgnoreCase("null")){
grouping = IdGen.uuid();
}
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
String newFilePath = filePath+"/"+grouping+"/";
File file = new File(rootPath+ newFilePath);
if (!file.exists()) {
file.mkdirs();
}
String fileName = null;
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile mf = entity.getValue();
fileName = mf.getOriginalFilename();
String newFileName = FileUtil.generateFileName(fileName);// 构成新文件名。
File uploadFile = new File(rootPath + newFilePath + newFileName);
FileCopyUtils.copy(mf.getBytes(), uploadFile);
EFile eFile = new EFile();
eFile.setName(FileUtil.getFileNameNotSuffix(fileName)+FileUtil.getFileNameSuffix(fileName));
eFile.setPath(newFilePath+newFileName);
eFile.setGrouping(grouping);
if(fileService.save(eFile) != null){
WMap map = new WMap();
map.put("data", eFile);
result.ok(map);
result.okMsg("上传成功!");
}else{
result.errorMsg("上传失败!");
}
}
}catch(Exception e){
LOG.error("上传失败,原因:"+e.getMessage());
result.error(e);
}
return result;
}