本文整理匯總了Java中com.obdobion.calendar.CalendarFactory.modify方法的典型用法代碼示例。如果您正苦於以下問題:Java CalendarFactory.modify方法的具體用法?Java CalendarFactory.modify怎麽用?Java CalendarFactory.modify使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.obdobion.calendar.CalendarFactory
的用法示例。
在下文中一共展示了CalendarFactory.modify方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: resolve
import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
if (values.size() < 1)
throw new Exception("missing operands for " + toString());
try
{
String adjustments = "";
if (getParameterCount() == 2)
adjustments = values.popString();
final Object dateInputObject = values.popWhatever();
LocalDate convertedInputDate = null;
if (dateInputObject instanceof String)
convertedInputDate = TemporalHelper.parseWithPredefinedParsers((String) dateInputObject).toLocalDate();
else
if (dateInputObject instanceof TokVariable)
throw new Exception("unresolved variable: " + ((TokVariable) dateInputObject).getName());
else if (dateInputObject instanceof Long)
convertedInputDate = CalendarFactory.at((Long) dateInputObject).toLocalDate();
else if (dateInputObject instanceof Double)
convertedInputDate = CalendarFactory.at(((Double) dateInputObject).longValue()).toLocalDate();
else
convertedInputDate = ((LocalDateTime) dateInputObject).toLocalDate();
final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
if (adjLdt.toLocalTime() != LocalTime.MIN)
throw new ParseException("Adjustments to time are not allowed", 0);
values.push(adjLdt);
} catch (final ParseException e)
{
e.fillInStackTrace();
throw new Exception(toString() + "; " + e.getMessage(), e);
}
}
示例2: resolve
import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
if (values.size() < 1)
throw new Exception("missing operands for " + toString());
try
{
String adjustments = "";
if (getParameterCount() == 2)
adjustments = values.popString();
final Object dateInputObject = values.popWhatever();
LocalTime convertedInputDate = null;
if (dateInputObject instanceof String)
convertedInputDate = TemporalHelper.parseWithPredefinedParsers((String) dateInputObject).toLocalTime();
else
if (dateInputObject instanceof TokVariable)
throw new Exception("unresolved variable: " + ((TokVariable) dateInputObject).getName());
else if (dateInputObject instanceof Long)
convertedInputDate = CalendarFactory.at((Long) dateInputObject).toLocalTime();
else if (dateInputObject instanceof Double)
convertedInputDate = CalendarFactory.at(((Double) dateInputObject).longValue()).toLocalTime();
else
convertedInputDate = ((LocalDateTime) dateInputObject).toLocalTime();
final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
if (adjLdt.toLocalDate() != LocalDate.MIN)
throw new ParseException("Adjustments to date are not allowed", 0);
values.push(adjLdt);
} catch (final ParseException e)
{
e.fillInStackTrace();
throw new Exception(toString() + "; " + e.getMessage(), e);
}
}
示例3: resolve
import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
if (values.size() < 2)
throw new Exception("missing operands for " + toString());
try
{
String adjustments = "";
if (getParameterCount() == 3)
adjustments = values.popString();
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(values.popString());
final String dateInputObject = values.popString();
final LocalTime convertedInputDate = LocalTime.parse(dateInputObject, dtf);
final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
if (adjLdt.toLocalDate() != LocalDate.MIN)
throw new ParseException("Adjustments to date are not allowed", 0);
values.push(adjLdt);
} catch (final ParseException e)
{
e.fillInStackTrace();
throw new Exception(toString() + "; " + e.getMessage(), e);
}
}
示例4: resolve
import com.obdobion.calendar.CalendarFactory; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public void resolve(final ValueStack values) throws Exception
{
if (values.size() < 2)
throw new Exception("missing operands for " + toString());
try
{
String adjustments = "";
if (getParameterCount() == 3)
adjustments = values.popString();
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(values.popString());
final String dateInputObject = values.popString();
final LocalDate convertedInputDate = LocalDate.parse(dateInputObject, dtf);
final LocalDateTime adjLdt = CalendarFactory.modify(convertedInputDate, adjustments);
if (adjLdt.toLocalTime() != LocalTime.MIN)
throw new ParseException("Adjustments to time are not allowed", 0);
values.push(adjLdt);
} catch (final ParseException e)
{
e.fillInStackTrace();
throw new Exception(toString() + "; " + e.getMessage(), e);
}
}