本文整理汇总了Java中jodd.typeconverter.Convert类的典型用法代码示例。如果您正苦于以下问题:Java Convert类的具体用法?Java Convert怎么用?Java Convert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Convert类属于jodd.typeconverter包,在下文中一共展示了Convert类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: index
import jodd.typeconverter.Convert; //导入依赖的package包/类
/**
* 试题列表
*/
public void index() {
int pageNum = Convert.toInteger(getPara("pageNumber", "1"));
int pageSize = Convert.toInteger(getPara("pageSize", String.valueOf(10)));
String type = getPara(0);
Page<Test> t = Test.dao.pageQuery(pageNum, pageSize, type);
setAttr("page", 3);
setAttr("leftPage", type);
setAttr("examPage", t);
if (t != null) {
setPage(t);
setAttr("pageUrl", "/exam/" + type);
}
Test test = Test.findExamCountByType(getUser().getInt("id"));
ExamBean bean = new ExamBean();
bean.setAll(test.get("allexam").toString());
bean.setLow(test.get("low").toString());
bean.setMiddle(test.get("middle").toString());
bean.setHeight(test.get("height").toString());
bean.setMyTest(test.get("myCount").toString());
setAttr("examCount",bean);
render("index.jsp");
}
开发者ID:yaokwok,项目名称:loveabc,代码行数:26,代码来源:ExamController.java
示例2: myTests
import jodd.typeconverter.Convert; //导入依赖的package包/类
/**
* 我做过的试卷列表
*/
public void myTests(){
int pageNum = Convert.toInteger(getPara("pageNumber", "1"));
int pageSize = Convert.toInteger(getPara("pageSize", String.valueOf(10)));
Page<Reply> r = Reply.dao.findTestByUser(pageNum,pageSize,getUser().getInt("id"));
setAttr("page",3);
setAttr("leftPage", 6);
setAttr("testPage", r);
if (r != null) {
setPage(r);
setAttr("pageUrl", "/exam/myTests");
}
Test test = Test.findExamCountByType(getUser().getInt("id"));
ExamBean bean = new ExamBean();
bean.setAll(test.get("allexam").toString());
bean.setLow(test.get("low").toString());
bean.setMiddle(test.get("middle").toString());
bean.setHeight(test.get("height").toString());
bean.setMyTest(test.get("myCount").toString());
setAttr("examCount",bean);
}
开发者ID:yaokwok,项目名称:loveabc,代码行数:24,代码来源:ExamController.java
示例3: parseNameSpaces
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static StrMap parseNameSpaces(Node doc) {
StrMap ns = new StrMap();
String rootNodeName = doc.getNodeName();
//parse namespaces
StrMap attrs = XmlUtil.getAttributes(doc);
for (String attrName : attrs.keySet()) {
if (attrName.trim().startsWith(NamespacePrefix)) {
String value = Convert.toString(attrs.get(attrName));
String name = attrName.substring(NamespacePrefix.length());
ns.put(prefix(rootNodeName) + name, value);
}
}
return ns;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:15,代码来源:XmlUtil.java
示例4: booleanValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static boolean booleanValue(Object value, boolean defaultValue) {
if (value != null && value instanceof String && ((String) value).trim().length() > 0) {
String v = ((String) value).trim();
if ("1".equals(v) || "true".equalsIgnoreCase(v) || "yes".equalsIgnoreCase(v) || "on".equalsIgnoreCase(v)) {
return true;
}
if ("0".equals(v) || "false".equalsIgnoreCase(v) || "no".equalsIgnoreCase(v) || "off".equalsIgnoreCase(v)) {
return false;
}
return Convert.toBooleanValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:14,代码来源:ValuePlus.java
示例5: index
import jodd.typeconverter.Convert; //导入依赖的package包/类
@RequiresRoles(value = { "管理员", "超级管理员" }, logical = Logical.OR)
public void index() {
int pageNum = Convert.toInteger(getPara("pageNumber", "1"));
int pageSize = Convert.toInteger(getPara("pageSize", String.valueOf(_defaultNumPerPage)));
Page<User> UserPage = BGDispatch.userService.query_sort(pageNum, pageSize, getUser());
if (UserPage != null) {
setPage(UserPage);
setAttr("UserPage", UserPage);
setAttr("pageUrl", "/user");
}
this.setAttr("page", 3);
render("userList.jsp");
}
开发者ID:yaokwok,项目名称:loveabc,代码行数:16,代码来源:UserController.java
示例6: validate
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static boolean validate(Object value, double max) {
if (value == null) {
return true;
}
double val = Convert.toDoubleValue(value);
return val < max;
}
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:8,代码来源:MaxConstraint.java
示例7: validate
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static boolean validate(Object value, JDateTime then) {
if (value == null) {
return true;
}
JDateTime now = Convert.toJDateTime(value);
return now.isBefore(then);
}
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:8,代码来源:TimeBeforeConstraint.java
示例8: validate
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static boolean validate(Object value, double min, double max) {
if (value == null) {
return true;
}
double val = Convert.toDoubleValue(value);
return val >= min && val <= max;
}
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:8,代码来源:RangeConstraint.java
示例9: validate
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static boolean validate(Object value, JDateTime then) {
if (value == null) {
return true;
}
JDateTime now = Convert.toJDateTime(value);
return now.isAfter(then);
}
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:8,代码来源:TimeAfterConstraint.java
示例10: validate
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static boolean validate(Object value, double min) {
if (value == null) {
return true;
}
double val = Convert.toDoubleValue(value);
return val > min;
}
开发者ID:indic-ocr,项目名称:LibreOCR,代码行数:8,代码来源:MinConstraint.java
示例11: init
import jodd.typeconverter.Convert; //导入依赖的package包/类
/**
* Filter initialization.
*/
public void init(FilterConfig config) throws ServletException {
try {
wildcards = Convert.toBooleanValue(config.getInitParameter("wildcards"), false);
} catch (TypeConversionException ignore) {
wildcards = false;
}
// match string
String uriMatch = config.getInitParameter("match");
if ((uriMatch != null) && (uriMatch.equals("*") == false)) {
matches = StringUtil.splitc(uriMatch, ',');
for (int i = 0; i < matches.length; i++) {
matches[i] = matches[i].trim();
}
}
// exclude string
String uriExclude = config.getInitParameter("exclude");
if (uriExclude != null) {
excludes = StringUtil.splitc(uriExclude, ',');
for (int i = 0; i < excludes.length; i++) {
excludes[i] = excludes[i].trim();
}
}
}
开发者ID:Appverse,项目名称:appverse-server,代码行数:32,代码来源:XssFilter.java
示例12: init
import jodd.typeconverter.Convert; //导入依赖的package包/类
/**
* Filter initialization.
*/
@Override
public void init(FilterConfig config) throws ServletException {
try {
wildcards = Convert.toBooleanValue(config.getInitParameter("wildcards"), false);
} catch (TypeConversionException ignore) {
wildcards = false;
}
// match string
String uriMatch = config.getInitParameter("match");
if ((uriMatch != null) && (uriMatch.equals("*") == false)) {
matches = uriMatch.split(",");
for (int i = 0; i < matches.length; i++) {
matches[i] = matches[i].trim();
}
}
// exclude string
String uriNoCache = config.getInitParameter("nocache");
if (uriNoCache != null) {
nocaches = uriNoCache.split(",");
for (int i = 0; i < nocaches.length; i++) {
nocaches[i] = nocaches[i].trim();
}
}
}
开发者ID:Appverse,项目名称:appverse-server,代码行数:33,代码来源:StaticContentCacheFilter.java
示例13: intValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static int intValue(Object value, int defaultValue) {
if (value != null) {
return Convert.toIntValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例14: longValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static long longValue(Object value, long defaultValue) {
if (value != null) {
return Convert.toLongValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例15: shortValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static short shortValue(Object value, short defaultValue) {
if (value != null) {
return Convert.toShortValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例16: floatValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static float floatValue(Object value, float defaultValue) {
if (value != null) {
return Convert.toFloatValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例17: doubleValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static double doubleValue(Object value, double defaultValue) {
if (value != null) {
return Convert.toDoubleValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例18: byteValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static byte byteValue(Object value, byte defaultValue) {
if (value != null) {
return Convert.toByteValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例19: charValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static char charValue(Object value, char defaultValue) {
if (value != null) {
return Convert.toCharValue(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
示例20: strValue
import jodd.typeconverter.Convert; //导入依赖的package包/类
public static String strValue(Object value, String defaultValue) {
if (value != null) {
return Convert.toString(value);
}
return defaultValue;
}
开发者ID:DataAgg,项目名称:DAFramework,代码行数:7,代码来源:ValuePlus.java
注:本文中的jodd.typeconverter.Convert类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论