Java Code Examples for cn.hutool.core.util.StrUtil#toString()

The following examples show how to use cn.hutool.core.util.StrUtil#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChineseValidator.java    From yue-library with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
	String validValue = null;
	if ((CharUtil.isChar(value) && !CharUtil.isBlankChar((char) value))
			|| (value instanceof String && StrUtil.isNotBlank((String) value))) {
		validValue = StrUtil.toString(value);
	}
	
	if (StringUtils.isNotBlank(validValue)) {
		return Validator.isChinese(validValue);
	}
	
	if (notNull) {
		return false;
	}
	
	return true;
}
 
Example 2
Source File: BaseForm.java    From datax-web with MIT License 5 votes vote down vote up
/**
 * 获取页码
 *
 * @return
 */
public Long getPageNo() {
    String pageNum = StrUtil.toString(this.get("current"));
    if (!StrUtil.isEmpty(pageNum) && NumberUtil.isNumber(pageNum)) {
        this.current = Long.parseLong(pageNum);
    }
    return this.current;
}
 
Example 3
Source File: BaseForm.java    From datax-web with MIT License 5 votes vote down vote up
/**
 * 获取页大小
 *
 * @return
 */
public Long getPageSize() {
    String pageSize = StrUtil.toString(this.get("size"));

    if (StrUtil.isNotEmpty(pageSize) && NumberUtil.isNumber(pageSize) && !"null".equalsIgnoreCase(pageSize)) {
        this.size = Long.parseLong(pageSize);
    }
    return this.size;
}
 
Example 4
Source File: JedisUtil.java    From scaffold-cloud with MIT License 5 votes vote down vote up
/**
 * 获取byte[]类型Key
 *
 * @param key
 * @return
 */
public static Object getObjectKey(byte[] key) {
    try {
        return StrUtil.toString(key);
    } catch (UnsupportedOperationException uoe) {
        try {
            return JedisUtil.toObject(key);
        } catch (UnsupportedOperationException uoe2) {
            uoe2.printStackTrace();
        }
    }
    return null;
}
 
Example 5
Source File: BaseForm.java    From datax-web with MIT License 2 votes vote down vote up
/**
 * 根据key获取values中String类型值
 *
 * @param key
 * @return String
 */
public String getString(String key) {
    return StrUtil.toString(get(key));
}
 
Example 6
Source File: BaseForm.java    From datax-web with MIT License 2 votes vote down vote up
/**
 * 获取排序字段
 *
 * @return
 */
public String getSort() {
    return StrUtil.toString(this.values.get("sort"));
}
 
Example 7
Source File: BaseForm.java    From datax-web with MIT License 2 votes vote down vote up
/**
 * 获取排序
 *
 * @return
 */
public String getOrder() {
    return StrUtil.toString(this.values.get("order"));
}
 
Example 8
Source File: BaseForm.java    From datax-web with MIT License 2 votes vote down vote up
/**
 * 获取排序
 *
 * @return
 */
public String getOrderby() {
    return StrUtil.toString(this.values.get("orderby"));
}