本文整理匯總了Java中com.obdobion.calendar.CalendarFactory.asDateLong方法的典型用法代碼示例。如果您正苦於以下問題:Java CalendarFactory.asDateLong方法的具體用法?Java CalendarFactory.asDateLong怎麽用?Java CalendarFactory.asDateLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.obdobion.calendar.CalendarFactory
的用法示例。
在下文中一共展示了CalendarFactory.asDateLong方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convertToDouble
import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/**
* <p>
* convertToDouble.
* </p>
*
* @param fromStack a {@link java.lang.Object} object.
* @return a double.
* @throws java.text.ParseException if any.
*/
protected double convertToDouble(final Object fromStack) throws ParseException
{
if (fromStack instanceof Number)
return ((Number) fromStack).doubleValue();
if (fromStack instanceof String)
return Double.parseDouble((String) fromStack);
if (fromStack instanceof LocalDateTime)
return CalendarFactory.asDateLong((LocalDateTime) fromStack);
final StringBuilder errMsg = new StringBuilder();
errMsg.append("invalid type ");
errMsg.append(fromStack.getClass().getSimpleName());
throw new ParseException(errMsg.toString(), 0);
}
示例2: convertToLong
import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/**
* <p>
* convertToDouble.
* </p>
*
* @param fromStack a {@link java.lang.Object} object.
* @return a double.
* @throws java.text.ParseException if any.
*/
protected long convertToLong(final Object fromStack) throws ParseException
{
if (fromStack instanceof Number)
return ((Number) fromStack).longValue();
if (fromStack instanceof String)
return Long.parseLong((String) fromStack);
if (fromStack instanceof LocalDateTime)
return CalendarFactory.asDateLong((LocalDateTime) fromStack);
final StringBuilder errMsg = new StringBuilder();
errMsg.append("invalid type ");
errMsg.append(fromStack.getClass().getSimpleName());
throw new ParseException(errMsg.toString(), 0);
}