本文整理汇总了Java中org.openyu.commons.lang.NumberHelper.toLong方法的典型用法代码示例。如果您正苦于以下问题:Java NumberHelper.toLong方法的具体用法?Java NumberHelper.toLong怎么用?Java NumberHelper.toLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openyu.commons.lang.NumberHelper
的用法示例。
在下文中一共展示了NumberHelper.toLong方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toObject
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的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: toLongs
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的package包/类
/**
* 集合內元素轉成Long
*
* @param values
* @return
*/
public static List<Serializable> toLongs(List<Serializable> values) {
List<Serializable> result = new LinkedList<Serializable>();
if (notEmpty(values)) {
for (Serializable entry : values) {
Long buff = NumberHelper.toLong(entry);
result.add(buff);
}
}
return result;
}
示例3: getLongParameterValues
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的package包/类
public static long[] getLongParameterValues(Request request, String name, long defaultValue) {
String[] paramValues = getParameterValues(request, name);
if (paramValues == null) {
return null;
}
if (paramValues.length < 1) {
return new long[0];
}
long[] values = new long[paramValues.length];
for (int i = 0; i < paramValues.length; i++) {
values[i] = NumberHelper.toLong(paramValues[i], defaultValue);
}
return values;
}
示例4: toObject
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的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;
}
示例5: getLongParameter
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的package包/类
public static long getLongParameter(Request request, String name, long defaultValue) {
String value = getParameter(request, name);
return NumberHelper.toLong(value, defaultValue);
}
示例6: getLongAttribute
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的package包/类
public static long getLongAttribute(Request request, String name, long defaultValue) {
String value = (String) getAttribute(request, name);
return NumberHelper.toLong(value, defaultValue);
}
示例7: getLongAttribute
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的package包/类
public static long getLongAttribute(Session session, String name, long defaultValue) {
return NumberHelper.toLong(getStringAttribute(session, name), defaultValue);
}
示例8: getLongInitParameter
import org.openyu.commons.lang.NumberHelper; //导入方法依赖的package包/类
public static long getLongInitParameter(ListenerConfig config, String name, long defaultValue) {
String value = getInitParameter(config, name);
return NumberHelper.toLong(value, defaultValue);
}