本文整理汇总了Java中org.openyu.commons.lang.BooleanHelper.toBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java BooleanHelper.toBoolean方法的具体用法?Java BooleanHelper.toBoolean怎么用?Java BooleanHelper.toBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openyu.commons.lang.BooleanHelper
的用法示例。
在下文中一共展示了BooleanHelper.toBoolean方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toObject
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected <T> T toObject(String value, String className) {
Object result = null;
// 非空白才處理
if (StringHelper.notBlank(value)) {
if ("java.util.Locale".equals(className)) {
result = LocaleHelper.toLocale(value);
} else if ("java.lang.String".equals(className)) {
result = value;
} else if ("boolean".equals(className)
|| "java.lang.Boolean".equals(className)) {
result = BooleanHelper.toBoolean(value);
} else if ("int".equals(className)
|| "java.lang.Integer".equals(className)) {
result = NumberHelper.toInt(value);
} else if ("long".equals(className)
|| "java.lang.Long".equals(className)) {
result = NumberHelper.toLong(value);
}
}
return (T) result;
}
示例2: getBooleanParameterValues
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
public static boolean[] getBooleanParameterValues(Request request, String name, boolean defaultValue) {
String[] paramValues = getParameterValues(request, name);
if (paramValues == null) {
return null;
}
if (paramValues.length < 1) {
return new boolean[0];
}
boolean[] values = new boolean[paramValues.length];
for (int i = 0; i < paramValues.length; i++) {
values[i] = BooleanHelper.toBoolean(paramValues[i], defaultValue);
}
return values;
}
示例3: toObject
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
/**
* disassemble常用
*
* @param value
* @param clazz
* @return
*/
@SuppressWarnings("unchecked")
protected <T> T toObject(String value, Class<T> clazz) {
Object result = null;
// 非空白才處理
if (StringHelper.notBlank(value)) {
if (String.class == clazz) {
result = value;
}
// date,calendar
else if (Date.class == clazz || Calendar.class == clazz) {
// 用long
long time = NumberHelper.toLong(value);
result = new Date(time);
} else if (Locale.class == clazz) {
result = LocaleHelper.toLocale(value);
}
// boolean
else if (boolean.class == clazz || Boolean.class == clazz) {
result = BooleanHelper.toBoolean(value);
}
// char
else if (char.class == clazz || Character.class == clazz) {
result = CharHelper.toChar(value);
}
// number
else if (byte.class == clazz || Byte.class == clazz) {
result = NumberHelper.toByte(value);
} else if (short.class == clazz || Short.class == clazz) {
result = NumberHelper.toShort(value);
} else if (int.class == clazz || Integer.class == clazz) {
result = NumberHelper.toInt(value);
} else if (long.class == clazz || Long.class == clazz) {
result = NumberHelper.toLong(value);
} else if (float.class == clazz || Float.class == clazz) {
result = NumberHelper.toFloat(value);
} else if (double.class == clazz || Double.class == clazz) {
result = NumberHelper.toDouble(value);
}
}
return (T) result;
}
示例4: getBooleanParameter
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
public static boolean getBooleanParameter(Request request, String name, boolean defaultValue) {
String value = getParameter(request, name);
return BooleanHelper.toBoolean(value, defaultValue);
}
示例5: getBooleanAttribute
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
public static boolean getBooleanAttribute(Request request, String name, boolean defaultValue) {
String value = (String) getAttribute(request, name);
return BooleanHelper.toBoolean(value, defaultValue);
}
示例6: getBooleanAttribute
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
public static boolean getBooleanAttribute(Session session, String name, boolean defaultValue) {
return BooleanHelper.toBoolean(getStringAttribute(session, name), defaultValue);
}
示例7: getBooleanInitParameter
import org.openyu.commons.lang.BooleanHelper; //导入方法依赖的package包/类
public static boolean getBooleanInitParameter(ListenerConfig config, String name, boolean defaultValue) {
String value = getInitParameter(config, name);
return BooleanHelper.toBoolean(value, defaultValue);
}