本文整理汇总了Java中org.openyu.commons.lang.BooleanHelper类的典型用法代码示例。如果您正苦于以下问题:Java BooleanHelper类的具体用法?Java BooleanHelper怎么用?Java BooleanHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BooleanHelper类属于org.openyu.commons.lang包,在下文中一共展示了BooleanHelper类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: toString
import org.openyu.commons.lang.BooleanHelper; //导入依赖的package包/类
protected String toString(boolean value) {
return BooleanHelper.toString(value);
}
示例4: randomBoolean
import org.openyu.commons.lang.BooleanHelper; //导入依赖的package包/类
protected static boolean randomBoolean() {
return BooleanHelper.randomBoolean();
}
示例5: 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;
}
示例6: 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);
}
示例7: getBooleanAttribute
import org.openyu.commons.lang.BooleanHelper; //导入依赖的package包/类
public static boolean getBooleanAttribute(Request request, String name) {
return getBooleanAttribute(request, name, BooleanHelper.DEFAULT_VALUE);
}
示例8: getBooleanAttribute
import org.openyu.commons.lang.BooleanHelper; //导入依赖的package包/类
public static boolean getBooleanAttribute(Session session, String name) {
return getBooleanAttribute(session, name, BooleanHelper.DEFAULT_VALUE);
}
示例9: 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);
}
示例10: safeGet
import org.openyu.commons.lang.BooleanHelper; //导入依赖的package包/类
/**
* Safe get.
*
* @param value
* the value
* @return true, if successful
*/
public static boolean safeGet(BooleanEnum value) {
return (value != null ? value.getValue() : BooleanHelper.DEFAULT_VALUE);
}
示例11: safeGet
import org.openyu.commons.lang.BooleanHelper; //导入依赖的package包/类
/**
* Safe get.
*
* @param value
* the value
* @return true, if successful
*/
protected boolean safeGet(Boolean value) {
return BooleanHelper.safeGet(value);
}