Java Code Examples for org.apache.commons.lang.StringUtils.lowerCase()

The following are Jave code examples for showing how to use lowerCase() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DWSurvey   File: PageRequest.java   Source Code and License Vote up 6 votes
/**
 * 设置排序方式向.
 * 
 * @param orderDir
 *            可选值为desc或asc,多个排序字段时用','分隔.
 */
public void setOrderDir(final String orderDir) {
	String lowcaseOrderDir = StringUtils.lowerCase(orderDir);

	// 检查order字符串的合法值
	String[] orderDirs = StringUtils.split(lowcaseOrderDir, ',');
	for (String orderDirStr : orderDirs) {
		if (!StringUtils.equals(Sort.DESC, orderDirStr)
				&& !StringUtils.equals(Sort.ASC, orderDirStr)) {
			throw new IllegalArgumentException("排序方向" + orderDirStr
					+ "不是合法值");
		}
	}

	this.orderDir = lowcaseOrderDir;
}
 
Example 2
Project: airsonic   File: ImportPlaylistController.java   Source Code and License Vote up 5 votes
@RequestMapping(method = RequestMethod.POST)
protected String handlePost(RedirectAttributes redirectAttributes,
                                       HttpServletRequest request
                                       ) throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();

    try {
        if (ServletFileUpload.isMultipartContent(request)) {

            FileItemFactory factory = new DiskFileItemFactory();
            ServletFileUpload upload = new ServletFileUpload(factory);
            List<?> items = upload.parseRequest(request);
            for (Object o : items) {
                FileItem item = (FileItem) o;

                if ("file".equals(item.getFieldName()) && !StringUtils.isBlank(item.getName())) {
                    if (item.getSize() > MAX_PLAYLIST_SIZE_MB * 1024L * 1024L) {
                        throw new Exception("The playlist file is too large. Max file size is " + MAX_PLAYLIST_SIZE_MB + " MB.");
                    }
                    String playlistName = FilenameUtils.getBaseName(item.getName());
                    String fileName = FilenameUtils.getName(item.getName());
                    String format = StringUtils.lowerCase(FilenameUtils.getExtension(item.getName()));
                    String username = securityService.getCurrentUsername(request);
                    Playlist playlist = playlistService.importPlaylist(username, playlistName, fileName,
                                                                       item.getInputStream(), null);
                    map.put("playlist", playlist);
                }
            }
        }
    } catch (Exception e) {
        map.put("error", e.getMessage());
    }

    redirectAttributes.addFlashAttribute("model", map);
    return "redirect:importPlaylist";
}
 
Example 3
Project: dag-runner   File: DagRunner.java   Source Code and License Vote up 5 votes
public static String getDefaultJobName(Object obj) {
    String className;
    if (obj instanceof JobCommand) {
        return ((JobCommand) obj).getJobName();
    } else if (obj instanceof Class) {
        className = ((Class) obj).getSimpleName();
    } else if (obj instanceof String) {
        className = (String) obj;
    } else {
        className = obj.getClass().getSimpleName();
    }
    return StringUtils.lowerCase(StringUtils.substring(className, 0, 1))
            + StringUtils.substring(className, 1);
}
 
Example 4
Project: dag-runner   File: JobCommand.java   Source Code and License Vote up 5 votes
public String getJobName() {
    if (StringUtils.isNotEmpty(this.jobName)) {
        return this.jobName;
    } else {
        String className = this.getClass().getSimpleName();
        return StringUtils.lowerCase(StringUtils.substring(className, 0, 1))
                + StringUtils.substring(className, 1);
    }
}
 
Example 5
Project: Ins_fb_pictureSpider_WEB   File: Page.java   Source Code and License Vote up 5 votes
/**
 * 设置排序方式向.
 *
 * @param order 可选值为desc或asc,多个排序字段时用','分隔.
 */
public void setOrder(final String order) {
    //检查order字符串的合法值
    String[] orders = StringUtils.split(StringUtils.lowerCase(order), ',');
    for (String orderStr : orders) {
        if (!StringUtils.equals(DESC, orderStr) && !StringUtils.equals(ASC, orderStr)) {
            throw new IllegalArgumentException("排序方向" + orderStr + "不是合法值");
        }
    }

    this.order = StringUtils.lowerCase(order);
}
 
Example 6
Project: instalint   File: LanguageDetection.java   Source Code and License Vote up 4 votes
static String sanitizeExtension(String suffix) {
  return StringUtils.lowerCase(StringUtils.removeStart(suffix, "."));
}