本文整理匯總了Java中com.obdobion.calendar.CalendarFactory類的典型用法代碼示例。如果您正苦於以下問題:Java CalendarFactory類的具體用法?Java CalendarFactory怎麽用?Java CalendarFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CalendarFactory類屬於com.obdobion.calendar包,在下文中一共展示了CalendarFactory類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: assignVariable
import com.obdobion.calendar.CalendarFactory; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public void assignVariable(final String variableName, final Object value, final boolean sysgen) throws Exception
{
/*
* Only store supported types in the stack.
*/
if (value instanceof Date)
getVariables().put(variableName.toLowerCase(),
new Variable(variableName, CalendarFactory.convert((Date) value), sysgen));
else if (value instanceof Calendar)
getVariables().put(variableName.toLowerCase(),
new Variable(variableName, CalendarFactory.convert((Calendar) value), sysgen));
else
getVariables().put(variableName.toLowerCase(),
new Variable(variableName, value, sysgen));
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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 LocalDateTime convertedInputDate = LocalDateTime.parse(dateInputObject, dtf);
values.push(CalendarFactory.modify(convertedInputDate, adjustments));
} catch (final ParseException e)
{
e.fillInStackTrace();
throw new Exception(toString() + "; " + e.getMessage(), e);
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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();
LocalDateTime convertedInputDate = null;
if (dateInputObject instanceof String)
convertedInputDate = TemporalHelper.parseWithPredefinedParsers((String) dateInputObject);
else
if (dateInputObject instanceof TokVariable)
throw new Exception("unresolved variable: " + ((TokVariable) dateInputObject).getName());
else if (dateInputObject instanceof Long)
convertedInputDate = CalendarFactory.at((Long) dateInputObject);
else if (dateInputObject instanceof Double)
convertedInputDate = CalendarFactory.at(((Double) dateInputObject).longValue());
else
convertedInputDate = (LocalDateTime) dateInputObject;
values.push(CalendarFactory.modify(convertedInputDate, adjustments));
} catch (final ParseException e)
{
e.fillInStackTrace();
throw new Exception(toString() + "; " + e.getMessage(), e);
}
}
示例9: 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);
}
}